EndpointTool

org.llm4s.tapir.EndpointTool
See theEndpointTool companion object
@Experimental
final case class EndpointTool

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 /path when 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
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def withDescription(description: String): EndpointTool

The description shown to the model, in place of the endpoint's own.

The description shown to the model, in place of the endpoint's own.

Attributes

def withDescription(description: Option[String]): EndpointTool

The description shown to the model, or the endpoint's own when None.

The description shown to the model, or the endpoint's own when None.

Attributes

def withHeaders(headers: Map[String, String]): EndpointTool

The headers the application sends on every call, replacing any given before.

The headers the application sends on every call, replacing any given before.

Attributes

def withModelHeaders(names: String*): EndpointTool

The header inputs the model may set, replacing any given before. Never list an authentication header.

The header inputs the model may set, replacing any given before. Never list an authentication header.

Attributes

def withRequiresApproval(requiresApproval: Boolean): EndpointTool

Whether an agent should ask before the tool runs.

Whether an agent should ask before the tool runs.

Attributes

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product