provider

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package provider provides functionality for initializing and registering LLM providers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterProviders

func RegisterProviders(providerFactory *factory.ProviderFactory)

RegisterProviders registers all available providers with the provider factory

Types

type Factory

type Factory interface {
	CreateProvider(name string, config map[string]interface{}) (Provider, error)
	GetSupportedProviders() []string
	GetProviderInfo(name string) (*ProviderInfo, error)
	RegisterProvider(name string, creator ProviderCreator) error
}

Factory interface for creating provider instances

type Provider

type Provider interface {
	GetName() string
	GetVersion() string
	IsConfigured() bool
	Configure(config map[string]interface{}) error
	Execute(ctx context.Context, request *Request) (*Response, error)
	Validate() error
	Close() error
}

Provider interface for LLM providers

type ProviderCreator

type ProviderCreator func(config map[string]interface{}) (Provider, error)

ProviderCreator is a function that creates a provider instance

type ProviderInfo

type ProviderInfo struct {
	Name         string            `json:"name"`
	Version      string            `json:"version"`
	Description  string            `json:"description"`
	Capabilities []string          `json:"capabilities"`
	ConfigSchema map[string]string `json:"config_schema"`
}

ProviderInfo contains information about a provider

type Request

type Request struct {
	Method     string                 `json:"method"`
	Endpoint   string                 `json:"endpoint"`
	Headers    map[string]string      `json:"headers,omitempty"`
	Parameters map[string]interface{} `json:"parameters,omitempty"`
	Body       interface{}            `json:"body,omitempty"`
	Timeout    int                    `json:"timeout,omitempty"`
}

Request represents a request to a provider

type Response

type Response struct {
	StatusCode int                    `json:"status_code"`
	Headers    map[string]string      `json:"headers,omitempty"`
	Body       interface{}            `json:"body,omitempty"`
	Error      string                 `json:"error,omitempty"`
	Metadata   map[string]interface{} `json:"metadata,omitempty"`
}

Response represents a response from a provider

Directories

Path Synopsis
Package anthropic provides an implementation of the Provider interface for Anthropic.
Package anthropic provides an implementation of the Provider interface for Anthropic.
Package cache provides caching functionality for the Multi-Provider LLM Integration Framework.
Package cache provides caching functionality for the Multi-Provider LLM Integration Framework.
Package config provides functionality for managing provider configurations.
Package config provides functionality for managing provider configurations.
Package core provides the core interfaces and types for the Multi-Provider LLM Integration Framework.
Package core provides the core interfaces and types for the Multi-Provider LLM Integration Framework.
Package factory provides functionality for creating provider instances.
Package factory provides functionality for creating provider instances.
Package middleware provides middleware components for the Multi-Provider LLM Integration Framework.
Package middleware provides middleware components for the Multi-Provider LLM Integration Framework.
Package openai provides an implementation of the Provider interface for OpenAI.
Package openai provides an implementation of the Provider interface for OpenAI.
Package plugin provides functionality for dynamically loading provider plugins.
Package plugin provides functionality for dynamically loading provider plugins.
Package registry provides functionality for registering and retrieving providers.
Package registry provides functionality for registering and retrieving providers.

Jump to

Keyboard shortcuts

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