Documentation
¶
Index ¶
- Constants
- Variables
- type Client
- func (_c Client) Demo(ctx context.Context, method string, relativeURL string, body any) (res *http.Response, err error)
- func (_c Client) ForHost(host string) Client
- func (_c Client) Turn(ctx context.Context, model string, messages []llmapi.Message, ...) (content string, toolCalls []llmapi.ToolCall, stopReason string, ...)
- func (_c Client) WithOptions(opts ...pub.Option) Client
- type MulticastClient
- func (_c MulticastClient) Demo(ctx context.Context, method string, relativeURL string, body any) iter.Seq[*pub.Response]
- func (_c MulticastClient) ForHost(host string) MulticastClient
- func (_c MulticastClient) Turn(ctx context.Context, model string, messages []llmapi.Message, ...) iter.Seq[*TurnResponse]
- func (_c MulticastClient) WithOptions(opts ...pub.Option) MulticastClient
- type TurnIn
- type TurnOut
- type TurnResponse
Constants ¶
const Description = `Chatbox is a demo LLM provider that pattern-matches user messages to demonstrate the tool-calling flow.`
Description is the human-readable summary of the microservice, surfaced in OpenAPI and discovery.
const Hostname = "chatbox.example"
Hostname is the default hostname of the microservice.
const Name = "Chatbox"
Name is the decorative PascalCase name of the microservice.
const Version = 4
Version is a generation counter bumped on each regeneration, not a semantic version.
Variables ¶
var Demo = define.Web{ Host: Hostname, Method: "ANY", Route: "//chatbox.example/demo", }
Demo serves the interactive demo page for the chatbox.
var Turn = define.Function{ Host: Hostname, Method: "POST", Route: ":444/turn", In: TurnIn{}, Out: TurnOut{}, }
Turn executes a single LLM turn using the chatbox demo provider. It pattern-matches math questions and generates tool calls to the calculator.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a lightweight proxy for making unicast calls to the microservice.
func (Client) Demo ¶
func (_c Client) Demo(ctx context.Context, method string, relativeURL string, body any) (res *http.Response, err error)
Demo serves the interactive demo page for the chatbox.
func (Client) ForHost ¶
ForHost returns a copy of the client with a different hostname to be applied to requests.
func (Client) Turn ¶
func (_c Client) Turn(ctx context.Context, model string, messages []llmapi.Message, tools []llmapi.Tool, options *llmapi.TurnOptions) (content string, toolCalls []llmapi.ToolCall, stopReason string, usage llmapi.Usage, err error)
Turn executes a single LLM turn using the chatbox demo provider. It pattern-matches math questions and generates tool calls to the calculator.
type MulticastClient ¶
type MulticastClient struct {
// contains filtered or unexported fields
}
MulticastClient is a lightweight proxy for making multicast calls to the microservice.
func NewMulticastClient ¶
func NewMulticastClient(caller service.Publisher) MulticastClient
NewMulticastClient creates a new multicast client proxy to the microservice.
func (MulticastClient) Demo ¶ added in v1.27.0
func (_c MulticastClient) Demo(ctx context.Context, method string, relativeURL string, body any) iter.Seq[*pub.Response]
Demo serves the interactive demo page for the chatbox.
func (MulticastClient) ForHost ¶
func (_c MulticastClient) ForHost(host string) MulticastClient
ForHost returns a copy of the client with a different hostname to be applied to requests.
func (MulticastClient) Turn ¶
func (_c MulticastClient) Turn(ctx context.Context, model string, messages []llmapi.Message, tools []llmapi.Tool, options *llmapi.TurnOptions) iter.Seq[*TurnResponse]
Turn executes a single LLM turn using the chatbox demo provider. It pattern-matches math questions and generates tool calls to the calculator.
func (MulticastClient) WithOptions ¶
func (_c MulticastClient) WithOptions(opts ...pub.Option) MulticastClient
WithOptions returns a copy of the client with options to be applied to requests.
type TurnIn ¶
type TurnIn struct {
Model string `json:"model,omitzero" jsonschema_description:"Model is the model identifier"`
Messages []llmapi.Message `json:"messages,omitzero" jsonschema_description:"Messages is the conversation history"`
Tools []llmapi.Tool `json:"tools,omitzero" jsonschema_description:"Tools is the list of tools available to the LLM"`
Options *llmapi.TurnOptions `json:"options,omitzero" jsonschema_description:"Options configures the turn"`
}
TurnIn are the input arguments of Turn.
type TurnOut ¶
type TurnOut struct {
Content string `json:"content,omitzero" jsonschema_description:"Content is the LLM text response"`
ToolCalls []llmapi.ToolCall `json:"toolCalls,omitzero" jsonschema_description:"ToolCalls is the list of tool calls"`
StopReason string `json:"stopReason,omitzero" jsonschema_description:"StopReason is the normalized reason the turn ended"`
Usage llmapi.Usage `json:"usage,omitzero" jsonschema_description:"Usage is the token consumption"`
}
TurnOut are the output arguments of Turn.
type TurnResponse ¶
type TurnResponse multicastResponse // MARKER: Turn
TurnResponse packs the response of Turn.