llm

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: May 18, 2025 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Config() Config

	GenerateEmbedding(ctx context.Context, task string, text string) ([]float32, error)
	GenerateChannelSuggestions(ctx context.Context, messages [][]string) (string, error)
	GenerateDocumentationResponse(ctx context.Context, question string, documents []string) (string, error)
	GenerateDocumentationUpdate(ctx context.Context, doc string, msgs string) (string, error)
	GenerateRunbook(ctx context.Context, service string, alert string, msgs []string) (*RunbookResponse, error)
	RunJSONModePrompt(ctx context.Context, prompt string, schema *jsonschema.Schema) (string, string, error)
	ClassifyCommand(ctx context.Context, text string, sampleMessages map[string][]string) (string, error)
}

func New

func New(ctx context.Context, cfg Config, db *pgxpool.Pool) (Client, error)

type Config

type Config struct {
	APIKey         string `envconfig:"API_KEY"`
	URL            string `default:"http://localhost:11434/v1/"`
	Model          string `default:"qwen2.5:7b"`
	EmbeddingModel string `split_words:"true" default:"nomic-embed-text"`
}

func DefaultConfig

func DefaultConfig() Config

type RunbookResponse added in v0.0.3

type RunbookResponse struct {
	AlertOverview        string   `json:"alert_overview"`
	HistoricalRootCauses []string `json:"historical_root_causes"`
	ResolutionSteps      []string `json:"resolution_steps"`
	LexicalSearchQuery   string   `json:"lexical_search_query"`
	SemanticSearchQuery  string   `json:"semantic_search_query"`
}

Jump to

Keyboard shortcuts

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