Help us shape the future of Go! Take the 2026 Go Developer Survey

llm

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnthropicProvider

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

AnthropicProvider implements types.LLMProvider for Anthropic Claude.

func NewAnthropicProvider

func NewAnthropicProvider(config *types.LLMConfig) (*AnthropicProvider, error)

NewAnthropicProvider creates a new Anthropic Claude provider.

func (*AnthropicProvider) ExtractGraph

func (p *AnthropicProvider) ExtractGraph(ctx context.Context, text string, schema string) (*types.ExtractionResult, error)

ExtractGraph sends text to Claude and parses the structured extraction.

func (*AnthropicProvider) Health

func (p *AnthropicProvider) Health(ctx context.Context) error

Health performs a lightweight check against the Anthropic API.

func (*AnthropicProvider) Name

func (p *AnthropicProvider) Name() string

Name returns the provider identifier.

type Client

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

Client manages LLM provider selection and extraction

func NewClient

func NewClient(config *types.LLMConfig) (*Client, error)

NewClient creates a new LLM client with the specified provider

func (*Client) ExtractGraph

func (c *Client) ExtractGraph(ctx context.Context, text string, schema string) (*types.ExtractionResult, error)

ExtractGraph implements types.LLMProvider. The schema parameter is forwarded to the underlying provider; if empty, the default schema is used.

func (*Client) Health

func (c *Client) Health(ctx context.Context) error

Health implements types.LLMProvider.

func (*Client) Name

func (c *Client) Name() string

Name implements types.LLMProvider.

func (*Client) Provider

func (c *Client) Provider() string

Provider returns the underlying provider name (alias for Name).

type LocalProvider

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

LocalProvider implements types.LLMProvider for Ollama / llama.cpp.

func NewLocalProvider

func NewLocalProvider(config *types.LLMConfig) (*LocalProvider, error)

NewLocalProvider creates a new local LLM provider.

func (*LocalProvider) ExtractGraph

func (p *LocalProvider) ExtractGraph(ctx context.Context, text string, schema string) (*types.ExtractionResult, error)

ExtractGraph sends text to Ollama and parses the structured extraction result.

func (*LocalProvider) Health

func (p *LocalProvider) Health(ctx context.Context) error

Health checks if the Ollama endpoint is reachable.

func (*LocalProvider) Name

func (p *LocalProvider) Name() string

Name returns the provider identifier.

type OpenAIProvider

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

OpenAIProvider implements types.LLMProvider for OpenAI-compatible APIs.

func NewOpenAIProvider

func NewOpenAIProvider(config *types.LLMConfig) (*OpenAIProvider, error)

NewOpenAIProvider creates a new OpenAI provider.

func (*OpenAIProvider) ExtractGraph

func (p *OpenAIProvider) ExtractGraph(ctx context.Context, text string, schema string) (*types.ExtractionResult, error)

ExtractGraph sends text to the OpenAI chat completions endpoint with JSON schema enforcement and parses the structured extraction result.

func (*OpenAIProvider) Health

func (p *OpenAIProvider) Health(ctx context.Context) error

Health checks if the OpenAI-compatible endpoint is reachable.

func (*OpenAIProvider) Name

func (p *OpenAIProvider) Name() string

Name returns the provider identifier.

Jump to

Keyboard shortcuts

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