llm

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package llm provides interfaces and implementations for LLM interactions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	Role    string // "system", "user", "assistant"
	Content string
}

Message represents a single message in a conversation with an LLM.

type Provider

type Provider interface {
	// Complete sends a conversation to the LLM and returns its response.
	Complete(ctx context.Context, messages []Message) (*Response, error)
}

Provider is the interface for completing LLM conversations.

type Response

type Response struct {
	Content string
}

Response represents the LLM's response.

type StubProvider

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

StubProvider returns configurable responses for testing.

func NewStubProvider

func NewStubProvider(responses ...string) *StubProvider

NewStubProvider creates a stub provider that cycles through the given responses. If no responses are provided, it returns an empty string.

func (*StubProvider) CallCount

func (s *StubProvider) CallCount() int

CallCount returns the number of times Complete was called.

func (*StubProvider) Complete

func (s *StubProvider) Complete(_ context.Context, _ []Message) (*Response, error)

Complete returns the next configured response.

Jump to

Keyboard shortcuts

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