llm

package
v0.0.0-debug-20260702 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MockServer   = ""
	OllamaServer = "ollama"

	MockEchoModel = "echo"

	LLMRoleSystem = "system"
	LLMRoleUser   = "user"
	LLMRoleAI     = "ai"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LLMClient

type LLMClient interface {
	ChatMsg(ctx context.Context, messages []Message) (string, error)
	Chat(ctx context.Context, prompt string) (string, error)
	CreateEmbedding(ctx context.Context, text string) ([]float32, error)
}

func NewLLMClient

func NewLLMClient(server string, addr string, model string, options string) (LLMClient, error)

type Message

type Message struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

type MockClient

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

func NewMockClient

func NewMockClient(model string, options string) (*MockClient, error)

func (*MockClient) Chat

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

func (*MockClient) ChatMsg

func (c *MockClient) ChatMsg(ctx context.Context, messages []Message) (string, error)

func (*MockClient) CreateEmbedding

func (c *MockClient) CreateEmbedding(ctx context.Context, text string) ([]float32, error)

type OllamaClient

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

func NewOllamaClient

func NewOllamaClient(addr string, model string, options string) (*OllamaClient, error)

func (*OllamaClient) Chat

func (o *OllamaClient) Chat(ctx context.Context, prompt string) (string, error)

func (*OllamaClient) ChatMsg

func (o *OllamaClient) ChatMsg(ctx context.Context, messages []Message) (string, error)

func (*OllamaClient) CreateEmbedding

func (o *OllamaClient) CreateEmbedding(ctx context.Context, text string) ([]float32, error)

Jump to

Keyboard shortcuts

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