models

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnthropicProvider

type AnthropicProvider struct {
	// contains filtered or unexported fields
}

AnthropicProvider handles Anthropic family of models

func NewAnthropicProvider

func NewAnthropicProvider() *AnthropicProvider

NewAnthropicProvider creates a new Anthropic provider instance

func (*AnthropicProvider) Configure

func (a *AnthropicProvider) Configure(apiKey string) error

Configure sets up the provider with necessary credentials

func (*AnthropicProvider) GetConfig

func (a *AnthropicProvider) GetConfig() ModelConfig

GetConfig returns the current provider configuration

func (*AnthropicProvider) Name

func (a *AnthropicProvider) Name() string

Name returns the provider name

func (*AnthropicProvider) SendPrompt

func (a *AnthropicProvider) SendPrompt(modelName string, prompt string) (string, error)

SendPrompt sends a prompt to the specified model and returns the response

func (*AnthropicProvider) SendPromptWithFile

func (a *AnthropicProvider) SendPromptWithFile(modelName string, prompt string, file FileInput) (string, error)

SendPromptWithFile sends a prompt along with a file to the specified model and returns the response

func (*AnthropicProvider) SetConfig

func (a *AnthropicProvider) SetConfig(config ModelConfig)

SetConfig updates the provider configuration

func (*AnthropicProvider) SetVerbose

func (a *AnthropicProvider) SetVerbose(verbose bool)

SetVerbose enables or disables verbose mode

func (*AnthropicProvider) SupportsModel

func (a *AnthropicProvider) SupportsModel(modelName string) bool

SupportsModel checks if the given model name is supported by Anthropic

func (*AnthropicProvider) ValidateModel

func (a *AnthropicProvider) ValidateModel(modelName string) bool

ValidateModel checks if the specific Anthropic model variant is valid

type DetectProviderFunc

type DetectProviderFunc func(modelName string) Provider

DetectProviderFunc is the type for the provider detection function

var DetectProvider DetectProviderFunc = defaultDetectProvider

DetectProvider determines the appropriate provider based on the model name

type FileInput

type FileInput struct {
	Path     string
	MimeType string
}

FileInput represents a file to be processed by the model

type GoogleProvider

type GoogleProvider struct {
	// contains filtered or unexported fields
}

GoogleProvider handles Google AI (Gemini) family of models

func NewGoogleProvider

func NewGoogleProvider() *GoogleProvider

NewGoogleProvider creates a new Google provider instance

func (*GoogleProvider) Configure

func (g *GoogleProvider) Configure(apiKey string) error

Configure sets up the provider with necessary credentials

func (*GoogleProvider) Name

func (g *GoogleProvider) Name() string

Name returns the provider name

func (*GoogleProvider) SendPrompt

func (g *GoogleProvider) SendPrompt(modelName string, prompt string) (string, error)

SendPrompt sends a prompt to the specified model and returns the response

func (*GoogleProvider) SendPromptWithFile

func (g *GoogleProvider) SendPromptWithFile(modelName string, prompt string, file FileInput) (string, error)

SendPromptWithFile sends a prompt along with a file to the specified model and returns the response

func (*GoogleProvider) SetVerbose

func (g *GoogleProvider) SetVerbose(verbose bool)

SetVerbose enables or disables verbose mode

func (*GoogleProvider) SupportsModel

func (g *GoogleProvider) SupportsModel(modelName string) bool

SupportsModel checks if the given model name is supported by Google

func (*GoogleProvider) ValidateModel

func (g *GoogleProvider) ValidateModel(modelName string) bool

ValidateModel checks if the specific Google model variant is valid

type ModelConfig

type ModelConfig struct {
	Temperature         float64
	MaxTokens           int
	MaxCompletionTokens int
	TopP                float64
}

ModelConfig represents configuration options for model calls

type OllamaProvider

type OllamaProvider struct {
	// contains filtered or unexported fields
}

OllamaProvider handles Ollama family of models

func NewOllamaProvider

func NewOllamaProvider() *OllamaProvider

NewOllamaProvider creates a new Ollama provider instance

func (*OllamaProvider) Configure

func (o *OllamaProvider) Configure(apiKey string) error

Configure sets up the provider (no API key needed for Ollama)

func (*OllamaProvider) Name

func (o *OllamaProvider) Name() string

Name returns the provider name

func (*OllamaProvider) SendPrompt

func (o *OllamaProvider) SendPrompt(modelName string, prompt string) (string, error)

SendPrompt sends a prompt to the specified model and returns the response

func (*OllamaProvider) SendPromptWithFile

func (o *OllamaProvider) SendPromptWithFile(modelName string, prompt string, file FileInput) (string, error)

SendPromptWithFile sends a prompt along with a file to the specified model and returns the response

func (*OllamaProvider) SetVerbose

func (o *OllamaProvider) SetVerbose(verbose bool)

SetVerbose enables or disables verbose mode

func (*OllamaProvider) SupportsModel

func (o *OllamaProvider) SupportsModel(modelName string) bool

SupportsModel checks if the given model name is supported by Ollama

type OllamaRequest

type OllamaRequest struct {
	Model  string `json:"model"`
	Prompt string `json:"prompt"`
	Stream bool   `json:"stream"`
}

OllamaRequest represents the request structure for Ollama API

type OllamaResponse

type OllamaResponse struct {
	Response string `json:"response"`
	Done     bool   `json:"done"`
}

OllamaResponse represents the response structure from Ollama API

type OpenAIProvider

type OpenAIProvider struct {
	// contains filtered or unexported fields
}

OpenAIProvider handles OpenAI family of models

func NewOpenAIProvider

func NewOpenAIProvider() *OpenAIProvider

NewOpenAIProvider creates a new OpenAI provider instance

func (*OpenAIProvider) Configure

func (o *OpenAIProvider) Configure(apiKey string) error

Configure sets up the provider with necessary credentials

func (*OpenAIProvider) GetConfig

func (o *OpenAIProvider) GetConfig() ModelConfig

GetConfig returns the current provider configuration

func (*OpenAIProvider) Name

func (o *OpenAIProvider) Name() string

Name returns the provider name

func (*OpenAIProvider) SendPrompt

func (o *OpenAIProvider) SendPrompt(modelName string, prompt string) (string, error)

SendPrompt sends a prompt to the specified model and returns the response

func (*OpenAIProvider) SendPromptWithFile

func (o *OpenAIProvider) SendPromptWithFile(modelName string, prompt string, file FileInput) (string, error)

SendPromptWithFile sends a prompt along with a file to the specified model and returns the response

func (*OpenAIProvider) SetConfig

func (o *OpenAIProvider) SetConfig(config ModelConfig)

SetConfig updates the provider configuration

func (*OpenAIProvider) SetVerbose

func (o *OpenAIProvider) SetVerbose(verbose bool)

SetVerbose enables or disables verbose mode

func (*OpenAIProvider) SupportsModel

func (o *OpenAIProvider) SupportsModel(modelName string) bool

SupportsModel checks if the given model name is supported by OpenAI

func (*OpenAIProvider) ValidateModel

func (o *OpenAIProvider) ValidateModel(modelName string) bool

ValidateModel checks if the specific OpenAI model variant is valid

type Provider

type Provider interface {
	Name() string
	SupportsModel(modelName string) bool
	SendPrompt(modelName string, prompt string) (string, error)
	SendPromptWithFile(modelName string, prompt string, file FileInput) (string, error)
	Configure(apiKey string) error
	SetVerbose(verbose bool)
}

Provider represents a model provider (e.g., Anthropic, OpenAI)

type XAIProvider

type XAIProvider struct {
	// contains filtered or unexported fields
}

XAIProvider handles X.AI family of models

func NewXAIProvider

func NewXAIProvider() *XAIProvider

NewXAIProvider creates a new X.AI provider instance

func (*XAIProvider) Configure

func (x *XAIProvider) Configure(apiKey string) error

Configure sets up the provider with necessary credentials

func (*XAIProvider) GetConfig

func (x *XAIProvider) GetConfig() ModelConfig

GetConfig returns the current provider configuration

func (*XAIProvider) Name

func (x *XAIProvider) Name() string

Name returns the provider name

func (*XAIProvider) SendPrompt

func (x *XAIProvider) SendPrompt(modelName string, prompt string) (string, error)

SendPrompt sends a prompt to the specified model and returns the response

func (*XAIProvider) SendPromptWithFile

func (x *XAIProvider) SendPromptWithFile(modelName string, prompt string, file FileInput) (string, error)

SendPromptWithFile sends a prompt along with a file to the specified model and returns the response

func (*XAIProvider) SetConfig

func (x *XAIProvider) SetConfig(config ModelConfig)

SetConfig updates the provider configuration

func (*XAIProvider) SetVerbose

func (x *XAIProvider) SetVerbose(verbose bool)

SetVerbose enables or disables verbose mode

func (*XAIProvider) SupportsModel

func (x *XAIProvider) SupportsModel(modelName string) bool

SupportsModel checks if the given model name is supported by X.AI

func (*XAIProvider) ValidateModel

func (x *XAIProvider) ValidateModel(modelName string) bool

ValidateModel checks if the specific X.AI model variant is valid

Jump to

Keyboard shortcuts

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