provider

package
v0.0.0-...-32dd017 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatMessage

type ChatMessage struct {
	Role       string     `json:"role"`
	Content    string     `json:"content"`
	ToolCalls  []ToolCall `json:"tool_calls,omitempty"`
	ToolCallID string     `json:"tool_call_id,omitempty"`
}

ChatMessage represents a single message in the conversation.

type ChatRequest

type ChatRequest struct {
	Messages []ChatMessage
	Tools    []ToolDefinition
}

ChatRequest represents a request to the LLM with optional tool definitions.

type ChatResponse

type ChatResponse struct {
	Content      string
	ToolCalls    []ToolCall
	FinishReason string // "stop" or "tool_calls"
}

ChatResponse represents the LLM response.

type FunctionCall

type FunctionCall struct {
	Name      string `json:"name"`
	Arguments string `json:"arguments"`
}

FunctionCall contains the function name and serialized arguments.

type FunctionDef

type FunctionDef struct {
	Name        string          `json:"name"`
	Description string          `json:"description"`
	Parameters  json.RawMessage `json:"parameters"`
}

FunctionDef describes a function tool.

type Provider

type Provider interface {
	ChatCompletion(ctx context.Context, req ChatRequest) (*ChatResponse, error)
}

Provider is the interface that LLM providers must implement for tool-use support.

type ToolCall

type ToolCall struct {
	ID       string       `json:"id"`
	Type     string       `json:"type"`
	Function FunctionCall `json:"function"`
}

ToolCall represents a tool invocation requested by the LLM.

type ToolDefinition

type ToolDefinition struct {
	Type     string      `json:"type"`
	Function FunctionDef `json:"function"`
}

ToolDefinition describes a tool available to the LLM.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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