registry

package
v1.210.0-test.21 Latest Latest
Warning

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

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

Documentation

Overview

Package registry provides the AI provider registry for client creation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsProviderRegistered

func IsProviderRegistered(name string) bool

IsProviderRegistered returns true if the provider is registered.

func ListProviders

func ListProviders() string

ListProviders returns a sorted list of registered provider names.

func ProviderCount

func ProviderCount() int

ProviderCount returns the number of registered providers.

func Register

func Register(name string, factory ClientFactory)

Register registers an AI provider with the given name. This should be called from provider package init() functions.

Types

type Client

type Client interface {
	// SendMessage sends a message to the AI and returns the response.
	SendMessage(ctx context.Context, message string) (string, error)

	// SendMessageWithTools sends a message with available tools and handles tool calls.
	SendMessageWithTools(ctx context.Context, message string, availableTools []tools.Tool) (*types.Response, error)

	// SendMessageWithHistory sends messages with full conversation history.
	SendMessageWithHistory(ctx context.Context, messages []types.Message) (string, error)

	// SendMessageWithToolsAndHistory sends messages with full conversation history and available tools.
	SendMessageWithToolsAndHistory(ctx context.Context, messages []types.Message, availableTools []tools.Tool) (*types.Response, error)

	// SendMessageWithSystemPromptAndTools sends messages with system prompt, conversation history, and available tools.
	SendMessageWithSystemPromptAndTools(
		ctx context.Context,
		systemPrompt string,
		atmosMemory string,
		messages []types.Message,
		availableTools []tools.Tool,
	) (*types.Response, error)

	// GetModel returns the configured model name.
	GetModel() string

	// GetMaxTokens returns the configured max tokens.
	GetMaxTokens() int
}

Client defines the interface for AI clients. This is defined here to avoid import cycles between pkg/ai and pkg/ai/agent/*.

type ClientFactory

type ClientFactory func(ctx context.Context, atmosConfig *schema.AtmosConfiguration) (Client, error)

ClientFactory is a function that creates a new AI client.

func GetFactory

func GetFactory(name string) (ClientFactory, error)

GetFactory returns the factory for the given provider name.

Jump to

Keyboard shortcuts

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