providers

package
v0.0.0-...-fa69716 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Apply

type Apply struct {
	ToolUse  []ToolCall
	Continue bool
	Abort    bool
}

type Client

type Client interface {
	Completion(ctx context.Context, request Request) Response
	CompletionNonStreaming(ctx context.Context, request Request) (string, error)
	StructuredPredict(ctx context.Context, request Request, model any) error
}

type CommonResponse

type CommonResponse struct {
	Stream chan Delta
	Err    chan error
	Token  Tokens
}

func NewCommonResponse

func NewCommonResponse() *CommonResponse

func (*CommonResponse) Error

func (r *CommonResponse) Error() <-chan error

func (*CommonResponse) Message

func (r *CommonResponse) Message() <-chan Delta

func (*CommonResponse) Tokens

func (r *CommonResponse) Tokens() Tokens

type ContextWindowProvider

type ContextWindowProvider interface {
	ContextWindow() int64
}

type Delta

type Delta struct {
	Content            string
	Reasoning          string
	ReasoningSignature string
	RedactedThinking   string
	ToolUse            []ToolCall
}

type Embedding

type Embedding interface {
	Vectorization(ctx context.Context, content string) ([]float64, error)
}

type Request

type Request interface {
	Messages() []types.Message
	History() []types.Message
	ToolDefines() []ToolDefine
	SystemPrompt() string
	PromptCacheKey() string

	SetHistory([]types.Message)
	SetToolDefines([]ToolDefine)
	SetSystemPrompt(string)
	SetPromptCacheKey(string)
	AppendHistory(...types.Message)
	AppendToolDefines(...ToolDefine)
	AppendSystemPrompt(...string)
}

func NewPromptRequest

func NewPromptRequest(prompt string) Request

func NewRequest

func NewRequest(systemMessage string, history ...types.Message) Request

type Response

type Response interface {
	Message() <-chan Delta
	Error() <-chan error
	Tokens() Tokens
}

type Tokens

type Tokens struct {
	CompletionTokens   int64
	PromptTokens       int64
	CachedPromptTokens int64
	TotalTokens        int64
}

type ToolCall

type ToolCall struct {
	ID        string
	Name      string
	Arguments string
	Error     string
}

type ToolDefine

type ToolDefine interface {
	GetName() string
	GetDescription() string
	GetParameters() map[string]any
}

func NewToolDefine

func NewToolDefine(name, description string, parameters map[string]any) ToolDefine

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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