llm

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package llm provides the LLM client abstraction that wraps a provider with common functionality and event bus integration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client wraps a provider with common functionality. It provides a higher-level interface for LLM interactions with automatic event bus integration for streaming responses.

func NewClient

func NewClient(p provider.Provider, bus event.EventBus) *Client

NewClient creates a new LLM client with the given provider and event bus.

func (*Client) Chat

Chat sends a non-streaming request to the LLM provider.

func (*Client) Provider

func (c *Client) Provider() provider.Provider

Provider returns the underlying provider.

func (*Client) Stream

func (c *Client) Stream(ctx context.Context, sessionID string, req provider.ChatRequest) (*provider.ChatResponse, error)

Stream sends a streaming request to the LLM and publishes events to the event bus. It returns the full accumulated response when the stream completes.

Event types published:

  • EventMessageDelta: for each text_delta and thinking_delta chunk
  • EventError: if the provider returns an error
  • EventDone: when the stream completes (always published, even on error)

Directories

Path Synopsis
providers
anthropic
Package anthropic implements the LLM provider interface for Anthropic Claude models.
Package anthropic implements the LLM provider interface for Anthropic Claude models.

Jump to

Keyboard shortcuts

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