llm

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OpenAIClient

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

OpenAIClient implements OpenAI-compatible LLM interactions. It can be used for OpenAI, DeepSeek, Groq, etc.

func NewOpenAIClient

func NewOpenAIClient(apiKey, endpoint, model string, logger *slog.Logger) *OpenAIClient

NewOpenAIClient creates a new OpenAI compatible client.

func (*OpenAIClient) Analyze

func (c *OpenAIClient) Analyze(ctx context.Context, prompt string, target any) error

Analyze requests JSON formatted output from the model. It uses "ResponseFormat: {Type: JSON_OBJECT}" to ensure model compatibility for structured reasoning.

func (*OpenAIClient) Chat

func (c *OpenAIClient) Chat(ctx context.Context, prompt string) (string, error)

Chat generates a simple plain text completion.

Jump to

Keyboard shortcuts

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