provider

package
v0.0.0-...-14dc775 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2025 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 CompleteOptions

type CompleteOptions struct {
	Stream StreamHandler
	Effort ReasoningEffort

	Stop  []string
	Tools []Tool

	MaxTokens   *int
	Temperature *float32

	Format CompletionFormat
	Schema *Schema
}

type Completer

type Completer interface {
	Complete(ctx context.Context, messages []Message, options *CompleteOptions) (*Completion, error)
}

type Completion

type Completion struct {
	ID string

	Reason CompletionReason

	Message Message

	Usage *Usage
}

type CompletionFormat

type CompletionFormat string
const (
	CompletionFormatJSON CompletionFormat = "json"
)

type CompletionReason

type CompletionReason string
const (
	CompletionReasonStop   CompletionReason = "stop"
	CompletionReasonLength CompletionReason = "length"
	CompletionReasonTool   CompletionReason = "tool"
	CompletionReasonFilter CompletionReason = "filter"
)

type Embedder

type Embedder interface {
	Embed(ctx context.Context, texts []string) (*Embedding, error)
}

type Embedding

type Embedding struct {
	Embeddings [][]float32

	Usage *Usage
}

type File

type File struct {
	Name string

	ContentType string
	Content     io.Reader
}

type Image

type Image struct {
	ID string

	Name   string
	Reader io.ReadCloser
}

type ImageStyle

type ImageStyle string
const (
	ImageStyleNatural ImageStyle = "natural"
	ImageStyleVivid   ImageStyle = "vivid"
)

type Message

type Message struct {
	Role    MessageRole
	Content string

	Files []File

	Tool      string
	ToolCalls []ToolCall
}

type MessageRole

type MessageRole string
const (
	MessageRoleSystem    MessageRole = "system"
	MessageRoleUser      MessageRole = "user"
	MessageRoleAssistant MessageRole = "assistant"
	MessageRoleTool      MessageRole = "tool"
)

type Model

type Model struct {
	ID string
}

type Provider

type Provider = any

type Ranking

type Ranking struct {
	Text  string
	Score float64
}

type ReasoningEffort

type ReasoningEffort string
const (
	ReasoningEffortLow    ReasoningEffort = "low"
	ReasoningEffortMedium ReasoningEffort = "medium"
	ReasoningEffortHigh   ReasoningEffort = "high"
)

type RenderOptions

type RenderOptions struct {
	Style ImageStyle
}

type Renderer

type Renderer interface {
	Render(ctx context.Context, input string, options *RenderOptions) (*Image, error)
}

type RerankOptions

type RerankOptions struct {
	Limit *int
}

type Reranker

type Reranker interface {
	Rerank(ctx context.Context, query string, texts []string, options *RerankOptions) ([]Ranking, error)
}

type Schema

type Schema struct {
	Name        string
	Description string

	Strict *bool

	Schema map[string]any
}

type StreamHandler

type StreamHandler = func(ctx context.Context, completion Completion) error

type Synthesis

type Synthesis struct {
	ID string

	Name   string
	Reader io.ReadCloser
}

type SynthesizeOptions

type SynthesizeOptions struct {
	Voice string
}

type Synthesizer

type Synthesizer interface {
	Synthesize(ctx context.Context, input string, options *SynthesizeOptions) (*Synthesis, error)
}

type Tool

type Tool struct {
	Name        string
	Description string

	Strict *bool

	Parameters map[string]any
}

type ToolCall

type ToolCall struct {
	ID string

	Name      string
	Arguments string
}

type TranscribeOptions

type TranscribeOptions struct {
	Language    string
	Temperature *float32
}

type Transcriber

type Transcriber interface {
	Transcribe(ctx context.Context, input File, options *TranscribeOptions) (*Transcription, error)
}

type Transcription

type Transcription struct {
	ID string

	Text string

	Language string
	Duration float64
}

type Usage

type Usage struct {
	InputTokens  int
	OutputTokens int
}

Jump to

Keyboard shortcuts

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