llm

package
v0.0.0-...-e18e3fe Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromVal

func FromVal[T any](o *llmoptions.LlmOpt, v T) error

func GetVal

func GetVal[T any](o *llmoptions.LlmOpt) (T, error)

Types

type ClaudeClient

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

ClaudeClient is a wrapper around the go-anthropic API client.

func NewClaudeClient

func NewClaudeClient(apiKey string, logger *logrus.Logger, model string) *ClaudeClient

NewClaudeClient initializes a Claude client with API key, logger, model, capabilities, and tools.

func (*ClaudeClient) SubmitTask

func (c *ClaudeClient) SubmitTask(ctx context.Context, task string, _ ...*llmoptions.LlmOpt) (string, error)

SubmitTask sends a task (prompt) to the Claude API and returns the response.

type GPT

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

func NewGPT

func NewGPT(config openai.ClientConfig, logger *logrus.Logger, model, role string) *GPT

NewGPT creates a new instance of GPT with the given OpenAI client configuration, a logger, model, and role.

func (*GPT) SubmitTask

func (c *GPT) SubmitTask(ctx context.Context, task string, opts ...*llmoptions.LlmOpt) (string, error)

SubmitTask sends a task (prompt) to the OpenAI ChatGPT API and returns all responses as a slice of strings.

type Llm

type Llm interface {
	// SubmitTask TODO: task need to be changed to proto eventually
	SubmitTask(ctx context.Context, task string, opts ...*llmoptions.LlmOpt) (response string, err error)
}

type OllamaClient

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

OllamaClient is a wrapper around the langchain Ollama API client.

func NewOllama

func NewOllama(url string, logger *logrus.Logger, model, role string) *OllamaClient

NewOllama creates a new instance of OllamaClient with the given configuration, logger, model, and role.

func (*OllamaClient) SubmitTask

func (c *OllamaClient) SubmitTask(ctx context.Context, task string, opts ...*llmoptions.LlmOpt) (string, error)

SubmitTask sends a task (prompt) to the Ollama API and returns all responses as a concatenated string.

Jump to

Keyboard shortcuts

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