Documentation
¶
Index ¶
- func CreateCompletion(ctx context.Context, client *Client, prompt string, options *CreateOptions) (string, error)
- func CreateList[T any](ctx context.Context, client *Client, prompt string, options *CreateOptions) ([]*T, error)
- func CreateStructured[T any](ctx context.Context, client *Client, prompt string, options *CreateOptions) (*T, error)
- type Client
- type ClientConfig
- type CreateOptions
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateCompletion ¶
func CreateCompletion(ctx context.Context, client *Client, prompt string, options *CreateOptions) (string, error)
CreateCompletion creates a simple text completion
func CreateList ¶
func CreateList[T any](ctx context.Context, client *Client, prompt string, options *CreateOptions) ([]*T, error)
CreateList creates a list of structured responses of type T
func CreateStructured ¶
func CreateStructured[T any](ctx context.Context, client *Client, prompt string, options *CreateOptions) (*T, error)
CreateStructured creates a structured response of type T
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides high-level LLM operations with validation
func NewClient ¶
func NewClient(prov provider.Provider, config ClientConfig) *Client
NewClient creates a new LLM client
func NewClientWithProvider ¶
func NewClientWithProvider(providerName string, config ClientConfig) (*Client, error)
Helper function to create a client with a provider name
type ClientConfig ¶
type ClientConfig struct {
// DefaultModel to use if not specified in requests
DefaultModel string
// DefaultTemperature to use if not specified
DefaultTemperature float64
// MaxRetries for validation failures (default: 3)
MaxRetries int
// StrictValidation enables strict mode (no type coercion)
StrictValidation bool
}
ClientConfig configures the LLM client
type CreateOptions ¶
type CreateOptions struct {
// Model to use (overrides default)
Model string
// Temperature (overrides default)
Temperature float64
// MaxTokens limits response length
MaxTokens int
// SystemPrompt sets the system message
SystemPrompt string
// Schema is the JSON Schema for the response (optional - will be generated from type if not provided)
Schema json.RawMessage
// ValidationMode can be "strict" or "lax"
ValidationMode string
}
CreateOptions contains options for creation requests
Click to show internal directories.
Click to hide internal directories.