provider

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2025 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContentAccumulator

type ContentAccumulator struct {
	Response
}

func (*ContentAccumulator) AddChunk

func (acc *ContentAccumulator) AddChunk(chunk *Response) error

func (*ContentAccumulator) HasFinished

func (acc *ContentAccumulator) HasFinished() bool

type ErrChunkAddition

type ErrChunkAddition struct {
	Accumulator Response
	Chunk       *Response
}

func (ErrChunkAddition) Error

func (e ErrChunkAddition) Error() string

type ErrUnknownRole

type ErrUnknownRole struct {
	Role string
}

func (ErrUnknownRole) Error

func (e ErrUnknownRole) Error() string

type Model

type Model struct {
	// LLM identifier
	Name string
	// Provider name (e.g., "ollama", "openai")
	Provider string
	// Model implementation
	Impl ModelImpl
}

type ModelImpl

type ModelImpl interface {
	Chat(context.Context, *Request, *chat.Options) (Response, error)
	ChatStreaming(context.Context, *Request, *chat.Options) (ResponseChannel, error)
}

type Request

type Request struct {
	Messages []chat.Message
	Tools    []tools.Tool
}

type Response

type Response struct {
	ID           string          `json:"id"`
	Created      time.Time       `json:"created"`
	Content      string          `json:"content"`
	Refusal      string          `json:"refusal"`
	Reasoning    string          `json:"reasoning"`
	ToolCalls    []chat.ToolCall `json:"tool_calls"`
	FinishReason string          `json:"finish_reason"`
	Metrics      metrics.Metrics `json:"metrics"`
}

type ResponseChannel

type ResponseChannel chan ResponseChunk

func NewResponseChannel

func NewResponseChannel(size ...int) ResponseChannel

func (ResponseChannel) Close

func (rs ResponseChannel) Close()

func (ResponseChannel) Next

func (rs ResponseChannel) Next() (*Response, error)

func (ResponseChannel) Send

func (rs ResponseChannel) Send(data *Response)

func (ResponseChannel) SendErr

func (rs ResponseChannel) SendErr(err error)

type ResponseChunk

type ResponseChunk struct {
	Chunk *Response
	Error error
}

func (*ResponseChunk) ToMarshalable

func (rc *ResponseChunk) ToMarshalable() ResponseChunkMarshalable

type ResponseChunkMarshalable

type ResponseChunkMarshalable struct {
	Chunk *Response `json:"chunk,omitempty"`
	Error string    `json:"error,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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