Mock Prompt Executor - Structured Responses #505
-
|
Hello everyone, Take this example: I want to mock an LLM structured response so that when the input contains "Mocked LLM Response", it returns an instance of my structured response class. How can I achieve this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Hi! Thanks for your question! If you check how So providing a JSON string in tests should work. |
Beta Was this translation helpful? Give feedback.
Hi! Thanks for your question!
Currently there's no DSL for that but you can do that using the ordinary
mockLLMAnswer(String). Just provide the JSON structure of your response as String -- the way you would expect the LLM to generate it, and it should work.If you check how
PromptExecutor.executeStructuredis implemented, you'll see the following:So providing a JSON string in tests shou…