org.llm4s.tapir
Members list
Type members
Classlikes
One tapir endpoint offered to a model as a tool, before it is built into a ToolFunction by EndpointTools.registry.
One tapir endpoint offered to a model as a tool, before it is built into a ToolFunction by EndpointTools.registry.
The tool's parameters are the endpoint's inputs: each path capture, query parameter and request body becomes a property of the tool's JSON schema, under its tapir name (the body under body). A header input is a parameter only when it is listed in modelHeaders; any other header, and every authentication input, is the application's: its value comes from headers, never from the model.
Create one with EndpointTools.tool.
Value parameters
- description
-
the description shown to the model; the endpoint's own description, summary or
METHOD /pathwhen absent - endpoint
-
the tapir endpoint the tool calls
- headers
-
the headers the application sends on every call, such as
Authorization - modelHeaders
-
the header inputs the model may set, by name, compared without regard to case
- name
-
the tool's name, as the model calls it;
[a-zA-Z0-9_-]{1,64} - requiresApproval
-
whether the tool changes something, so that an agent should ask before it runs; read it with EndpointTools.requiringApproval
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Creates an EndpointTool; EndpointTools.tool is the usual way in.
Creates an EndpointTool; EndpointTools.tool is the usual way in.
Attributes
- Companion
- class
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
EndpointTool.type
Turns tapir endpoints a service already has into tools a model can call, with each tool's parameter schema derived from the endpoint's own inputs.
Turns tapir endpoints a service already has into tools a model can call, with each tool's parameter schema derived from the endpoint's own inputs.
val tools: Result[ToolRegistry] = EndpointTools.registry(
uri"https://orders.internal",
HttpClientSyncBackend(),
EndpointTools.tool("get_order", getOrder),
EndpointTools.tool("cancel_order", cancelOrder)
)
A call decodes the model's arguments with the endpoint's own codecs, so its types and validators check them before anything is sent, then calls the endpoint through sttp. Every failure (an argument the endpoint rejects, an error response, a server error, a request that cannot be sent) is a tool error the model reads; nothing throws.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
EndpointTools.type