Package-level declarations
Types
The state of a toolAgent: the conversation so far, oldest message first, and what it cost.
What a DecisionModel answered to one Question.
A DecisionModel that asks a ChatModel, so that choose, isYes, score and decisionEdge work with the model an app already has: Claude, OpenAI, Gemini, Ollama, or any other.
What a ChatModel emits while it writes an answer. See ChatModel.stream.
One message of a conversation with a ChatModel.
A call to a ChatModel failed: the provider could not be reached, it returned an error, or the model declined to answer.
What a ChatModel is asked.
What a ChatModel answered.
A model that decides instead of writing: it picks one of the options you give it, answers yes or no, or rates something on a scale, and says how sure it is. Such a model is fast and cheap, and its answer has a fixed type, which makes it a good fit for the places where a graph has to decide: which node comes next, whether an answer is good enough, whether a person has to look.
A call to a DecisionModel failed: the provider could not be reached, it returned an error, or its answer does not fit the question.
What a DecisionModel is asked.
What a DecisionModel answered.
A question to a DecisionModel. Its kind decides the kind of Answer.
A function a model may call that reads the state of the run and changes it: add a line to an order, book a seat, move a piece. What it did is in the state, so a checkpoint holds it and the next node sees it.
The tokens a call to a ChatModel read (inputTokens) and wrote (outputTokens), or those of several calls added up. TokenUsage() is no tokens, the start of a count:
What a StateTool did.
What ask returns for a ChatRequest.
Properties
The piece of text a model wrote, when this event is a node's report of one, and null for every other event. toolLoop and chatWithProgress report these. A report from inside a subgraph is read as well.
Functions
Returns the model's next message for request as an instance of the @Serializable class Answer, with the message it was read from. Use it to ask for a value at the end of a conversation. See the overload with a prompt for how the model is asked.
Sends prompt as a single user message and returns the answer as an instance of the @Serializable class Answer, for a node that needs a value from the model and not a text.
Returns the model's next message for request as a value read with serializer. See the overload with a reified type.
Sends prompt as a single user message and returns the text of the answer, for a node that only needs a piece of text from the model. Call ChatModel.chat with a ChatRequest when you need to know whether the answer was cut off.
Returns the model's next message for request, like ChatModel.chat, and lets a streamed run watch the model write it. Use it in a node in place of ChatModel.chat:
Sends prompt as a single user message and returns the text of the answer, like chat with a prompt, and lets a streamed run watch the model write it. See the overload with a ChatRequest.
Asks which constant of the enum Option fits state. The model sees the names of the constants, and for each one the text that describe returns. Read the constant from the answer with value.
Adds a conditional edge from from on which a DecisionModel picks the next node: a router that understands language, at the speed and price of a decision model.
Asks a yes/no question about state. Read Answer.YesNo.isYes, or compare Answer.YesNo.probability with a line of your own.
Returns the tool calls of the last assistant message that have no ChatMessage.ToolResult yet.
Creates a StateTool for a graph with the state State, whose input is the @Serializable type Input. The input schema is built from the type as for a Tool. Use StateTool<State, Unit> for a tool that takes no input.
Creates a StateTool whose input is read with serializer. See the overload with a reified type.
Creates a Tool whose input is the @Serializable type Input. The input schema is built from the type, with the text of Description annotations as the description of each property.
Creates a Tool whose input is read with serializer. See the overload with a reified type.
Adds the loop of a tool-calling agent to this graph and returns its first node.