generic

package
v0.0.0-...-9dee9fb Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package generic provides an AIProvider implementation for any OpenAI-compatible API. This can be used with providers like Ollama, Together AI, Fireworks, vLLM, or any other service that implements the OpenAI chat completions API format.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Name is the unique provider name (e.g., "ollama", "together", "fireworks").
	Name string

	// BaseURL is the base URL for the API (e.g., "http://localhost:11434/v1").
	BaseURL string

	// APIKey is the bearer token for authentication (optional for local providers).
	APIKey string

	// Models lists the models available from this provider.
	Models []ai.ModelInfo

	// Headers adds extra HTTP headers to every request.
	Headers map[string]string

	// SupportsTools indicates whether this provider supports function/tool calling.
	SupportsTools bool
}

Config holds configuration for a generic OpenAI-compatible provider.

type Provider

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

Provider implements ai.AIProvider for any OpenAI-compatible API.

func New

func New(cfg Config) (*Provider, error)

New creates a new generic OpenAI-compatible provider.

func (*Provider) Complete

func (*Provider) CompleteStream

func (p *Provider) CompleteStream(_ context.Context, _ ai.CompletionRequest) (<-chan ai.StreamChunk, error)

func (*Provider) Models

func (p *Provider) Models() []ai.ModelInfo

func (*Provider) Name

func (p *Provider) Name() string

func (*Provider) SupportsToolUse

func (p *Provider) SupportsToolUse() bool

func (*Provider) ToolComplete

Jump to

Keyboard shortcuts

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