llm

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var OPENAI_GPT41_Mini = Model{
	Name:        "gpt-4.1-mini",
	ContextSize: 1000000,
}
View Source
var OPENAI_GPT4o = Model{
	Name:        "gpt-4o",
	ContextSize: 128000,
}

Functions

func AnalyzeCommands

func AnalyzeCommands(results map[string]string, provider Provider) string

func GenerateSchema

func GenerateSchema[T any]() interface{}

Types

type AzureConfig

type AzureConfig struct {
	Endpoint       string
	APIVersion     string
	APIKey         string // optional, fallback to token
	DeploymentName string // azure deployment name
}

type Model

type Model struct {
	Name        string
	ContextSize int // in tokens
	Options     map[string]string
}

type OpenAIProvider

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

func NewAzureOpenAIProvider

func NewAzureOpenAIProvider(cfg AzureConfig, systemPrompt string, model Model) (*OpenAIProvider, error)

func NewNativeOpenAIProvider

func NewNativeOpenAIProvider(c OpenAIProviderConfig) *OpenAIProvider

func NewOpenAIProvider

func NewOpenAIProvider(conf OpenAIProviderConfig) *OpenAIProvider

func (*OpenAIProvider) RequestCompletion

func (p *OpenAIProvider) RequestCompletion(prompt string) (string, error)

func (*OpenAIProvider) RequestCompletionWithJSONSchema

func (p *OpenAIProvider) RequestCompletionWithJSONSchema(prompt string, schema any) (string, error)

type OpenAIProviderConfig

type OpenAIProviderConfig struct {
	APIKey       string
	SystemPrompt string
	Model        Model
	BaseUrl      string
	AzureConfig  *AzureConfig // Optional, for Azure OpenAI
}

type Provider

type Provider interface {
	RequestCompletion(string) (string, error)
	RequestCompletionWithJSONSchema(string, interface{}) (string, error)
}

Define the interface

Jump to

Keyboard shortcuts

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