provider

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatClient

type ChatClient interface {
	Chat(ctx context.Context, req ChatRequest) (<-chan StreamEvent, error)
	Model() string
	ContextWindow() int
}

type ChatRequest

type ChatRequest struct {
	Model           string            `json:"model"`
	Messages        []message.Message `json:"messages"`
	Tools           []message.ToolDef `json:"tools,omitempty"`
	Stream          bool              `json:"stream"`
	MaxTokens       int               `json:"max_tokens,omitempty"`
	StreamOptions   *StreamOptions    `json:"stream_options,omitempty"`
	Thinking        *ThinkingConfig   `json:"thinking,omitempty"`
	ReasoningEffort string            `json:"reasoning_effort,omitempty"`
}

type Client

type Client struct {
	Profile ModelProfile
	// contains filtered or unexported fields
}

func NewClient

func NewClient(baseURL, model, apiKey string, profile ModelProfile) *Client

func (*Client) Chat

func (c *Client) Chat(ctx context.Context, req ChatRequest) (<-chan StreamEvent, error)

func (*Client) ContextWindow

func (c *Client) ContextWindow() int

func (*Client) Model

func (c *Client) Model() string

func (*Client) SetDebug

func (c *Client) SetDebug(enabled bool)

type ModelProfile

type ModelProfile struct {
	ContextWindow   int
	MaxOutputTokens int
	ThinkingType    string
	ReasoningEffort string
}

type StreamEvent

type StreamEvent struct {
	Type           string          `json:"type"`
	Delta          string          `json:"delta,omitempty"`
	ReasoningDelta string          `json:"reasoningDelta,omitempty"`
	ToolCall       *StreamToolCall `json:"toolCall,omitempty"`
	Usage          *Usage          `json:"usage,omitempty"`
	FinishReason   string          `json:"finishReason,omitempty"`
	Error          error           `json:"-"`
}

type StreamOptions

type StreamOptions struct {
	IncludeUsage bool `json:"include_usage"`
}

type StreamToolCall

type StreamToolCall struct {
	ID        string
	Name      string
	Arguments string
}

type ThinkingConfig

type ThinkingConfig struct {
	Type string `json:"type"`
}

type Usage

type Usage struct {
	PromptTokens         int `json:"prompt_tokens"`
	CompletionTokens     int `json:"completion_tokens"`
	TotalTokens          int `json:"total_tokens"`
	PromptCacheHitTokens int `json:"prompt_cache_hit_tokens"`
}

Jump to

Keyboard shortcuts

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