What one scripted call to a ScriptedLLMClient returns: a text answer, one or more tool calls, or a failure.
Build one with Reply.text, Reply.toolCall, Reply.toolCalls or Reply.failure, and adjust it with the with* methods:
Reply.text("Paris").withUsage(TokenUsage(promptTokens = 12, completionTokens = 1, totalTokens = 13))
Reply.toolCall("get_weather", """{"city": "Paris"}""")
Reply.failure(RateLimitError("openai"))
A reply that carries a failure is returned as a Left; every other reply becomes a Completion.
Tool-call arguments are written as a JSON string, so the kit's own factories need no JSON library in the test. Reply.toolCalls and withToolCalls take core's ToolCall as it is, for a test that already builds them.
Value parameters
- content
-
the text of the answer; empty for a reply that only calls tools
- failure
-
the error to return instead of a completion
- model
-
the model name reported in the completion
- toolCalls
-
the tool calls the model makes; a call whose
idis empty is given the idcall-<call number>-<position>when the client returns it - usage
-
the token usage reported in the completion
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass Any