llm

package
v0.0.0-...-21debc6 Latest Latest
Warning

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

Go to latest
Published: May 28, 2025 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GeminiLLMProvider

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

func NewGeminiLLMProvider

func NewGeminiLLMProvider(ctx context.Context, cfg LLMConfig, logger *slog.Logger) (*GeminiLLMProvider, error)

func (*GeminiLLMProvider) APIType

func (g *GeminiLLMProvider) APIType() string

func (*GeminiLLMProvider) Chat

func (g *GeminiLLMProvider) Chat(ctx context.Context,
	prompt Prompt, model string, tools []mcp.Tool,
	toolCaller tools.ToolCaller) (string, error)

type LLMConfig

type LLMConfig struct {
	Name    string
	APIType string // openai | gemini
	APIKey  string
	Host    string
	Model   string
}

type LLMProvider

type LLMProvider interface {
	APIType() string // openaichat, openairesponse, gemini

	Chat(ctx context.Context, prompt Prompt, model string, tools []mcp.Tool, toolCaller tools.ToolCaller) (string, error)
}

func BuildLLMProvider

func BuildLLMProvider(ctx context.Context, cfg LLMConfig, logger *slog.Logger) (LLMProvider, error)

type OpenaiChatLLMProvider

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

func NewOpenaiChatLLMProvider

func NewOpenaiChatLLMProvider(cfg LLMConfig, logger *slog.Logger) (*OpenaiChatLLMProvider, error)

func (*OpenaiChatLLMProvider) APIType

func (o *OpenaiChatLLMProvider) APIType() string

func (*OpenaiChatLLMProvider) Chat

func (o *OpenaiChatLLMProvider) Chat(
	ctx context.Context, prompt Prompt, model string, tools []mcp.Tool, toolCaller tools.ToolCaller) (string, error)

Chat-loop using the official SDK + tool calling.

type OpenaiResponseLLMProvider

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

func NewOpenaiResponseLLMProvider

func NewOpenaiResponseLLMProvider(cfg LLMConfig, logger *slog.Logger) (*OpenaiResponseLLMProvider, error)

func (*OpenaiResponseLLMProvider) APIType

func (o *OpenaiResponseLLMProvider) APIType() string

func (*OpenaiResponseLLMProvider) Chat

func (o *OpenaiResponseLLMProvider) Chat(
	ctx context.Context,
	prompt Prompt,
	model string,
	toolsDesc []mcp.Tool,
	toolCaller tools.ToolCaller,
) (string, error)

Chat performs conversation with per-session conversationID passed in and returned

type Prompt

type Prompt struct {
	System    string
	Developer string
	User      string
}

Jump to

Keyboard shortcuts

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