chatboxapi

package
v1.45.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
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.

View Source
const Hostname = "chatbox.example"

Hostname is the default hostname of the microservice.

View Source
const Name = "Chatbox"

Name is the decorative PascalCase name of the microservice.

View Source
const Version = 5

Version is a generation counter bumped on each regeneration, not a semantic version.

Variables

View Source
var Demo = define.Web{
	Host: Hostname, Method: "ANY", Route: "//chatbox.example/demo",
}

Demo serves the interactive demo page for the chatbox.

View Source
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 NewClient

func NewClient(caller service.Publisher) Client

NewClient creates a new unicast client proxy 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

func (_c Client) ForHost(host string) Client

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, items []llmapi.Item, tools []llmapi.Tool, options *llmapi.TurnOptions) (itemsOut []llmapi.Item, 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.

func (Client) WithOptions

func (_c Client) WithOptions(opts ...pub.Option) Client

WithOptions returns a copy of the client with options to be applied to requests.

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

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, items []llmapi.Item, 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"`
	Items   []llmapi.Item       `json:"items,omitzero" jsonschema_description:"Items 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 {
	ItemsOut   []llmapi.Item `json:"items,omitzero" jsonschema_description:"items is the LLM's response turn"`
	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.

func (*TurnResponse) Get

func (_res *TurnResponse) Get() (itemsOut []llmapi.Item, stopReason string, usage llmapi.Usage, err error)

Get unpacks the return arguments of Turn.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL