Documentation
¶
Index ¶
- type Client
- func (c *Client) CallTool(ctx context.Context, name string, input json.RawMessage) (json.RawMessage, error)
- func (c *Client) CallToolStream(ctx context.Context, name string, input json.RawMessage, ...) (json.RawMessage, error)
- func (c *Client) GetTool(ctx context.Context, name string) (*schema.Tool, error)
- func (c *Client) ListNamespaces(ctx context.Context) (*schema.NamespaceList, error)
- func (c *Client) ListTools(ctx context.Context, req schema.ToolListRequest) (*schema.ToolList, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client is an llm toolkit HTTP client that wraps the base HTTP client and provides typed methods for interacting with the llm toolkit API.
func New ¶
New creates a new llm toolkit HTTP client with the given base URL and options. The url parameter should point to the shared API endpoint (the same one the registry, filer and credential clients use), e.g. "http://localhost:8080/api" - each method includes its own "llm/..." path segment, matching how httphandler registers its routes.
func (*Client) CallTool ¶
func (c *Client) CallTool(ctx context.Context, name string, input json.RawMessage) (json.RawMessage, error)
CallTool runs the tool with the canonical name, such as "weatherapi:current", with the input, which may be empty, and returns its result as JSON, or nil when the tool has no result
func (*Client) CallToolStream ¶ added in v0.6.0
func (c *Client) CallToolStream(ctx context.Context, name string, input json.RawMessage, stream llm.GeneratorStreamFn) (json.RawMessage, error)
CallToolStream runs the tool with the canonical name, with the input, as CallTool does, and calls the function with what it logs, and its progress, as llm.Progress, as JSON, as it runs, and returns its result. The request isn't timed out, as a tool, such as an agent, can take a while, but is cancelled with the context.
func (*Client) GetTool ¶
GetTool returns the tool with the name, which is its canonical name, such as "weatherapi:current", or its name without a namespace, when only one namespace has a tool with the name
func (*Client) ListNamespaces ¶ added in v1.0.0
ListNamespaces returns the namespaces, in order of name, with their descriptions, and how many tools each has