providers

package
v0.0.0-...-2ca5d0e Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

internal/providers/anthropic.go

internal/providers/copilot.go

internal/providers/factory.go

internal/providers/groq.go

internal/providers/ollama.go

internal/providers/provider.go

internal/providers/stream.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProcessRequest

func ProcessRequest(ctx context.Context, provider Provider, prompt string, stream bool) error

Types

type AnthropicProvider

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

func NewAnthropicProvider

func NewAnthropicProvider(apiKey, model string) *AnthropicProvider

NewAnthropicProvider creates a new Anthropic provider model should be one of: claude-3-opus-20240229, claude-3-sonnet-20240229, claude-3-haiku-20240307

func (*AnthropicProvider) Complete

func (p *AnthropicProvider) Complete(ctx context.Context, prompt string, stream bool) (io.ReadCloser, error)

func (*AnthropicProvider) Name

func (p *AnthropicProvider) Name() string

type Client

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

func NewClient

func NewClient(apiKey string, baseURL string) *Client

func (*Client) Post

func (c *Client) Post(ctx context.Context, path string, body interface{}) (*http.Response, error)

type CopilotProvider

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

func NewCopilotProvider

func NewCopilotProvider(token string, model string) (*CopilotProvider, error)

func (*CopilotProvider) Complete

func (p *CopilotProvider) Complete(ctx context.Context, prompt string, stream bool) (io.ReadCloser, error)

func (*CopilotProvider) Name

func (p *CopilotProvider) Name() string

type GeminiProvider

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

func NewGeminiProvider

func NewGeminiProvider(apiKey, model string) (*GeminiProvider, error)

func (*GeminiProvider) Complete

func (p *GeminiProvider) Complete(ctx context.Context, prompt string, stream bool) (io.ReadCloser, error)

func (*GeminiProvider) Name

func (p *GeminiProvider) Name() string

type GroqProvider

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

func NewGroqProvider

func NewGroqProvider(apiKey, model string) *GroqProvider

func (*GroqProvider) Complete

func (p *GroqProvider) Complete(ctx context.Context, prompt string, stream bool) (io.ReadCloser, error)

func (*GroqProvider) Name

func (p *GroqProvider) Name() string

type OllamaProvider

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

func NewOllamaProvider

func NewOllamaProvider(host, model string) *OllamaProvider

func (*OllamaProvider) Complete

func (p *OllamaProvider) Complete(ctx context.Context, prompt string, stream bool) (io.ReadCloser, error)

func (*OllamaProvider) Name

func (p *OllamaProvider) Name() string

type OpenAIProvider

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

func NewOpenAIProvider

func NewOpenAIProvider(apiKey string, model string) (*OpenAIProvider, error)

func (*OpenAIProvider) Complete

func (p *OpenAIProvider) Complete(ctx context.Context, prompt string, stream bool) (io.ReadCloser, error)

func (*OpenAIProvider) Name

func (p *OpenAIProvider) Name() string

type Provider

type Provider interface {
	Complete(ctx context.Context, prompt string, stream bool) (io.ReadCloser, error)
	Name() string
}

func InitializeProvider

func InitializeProvider(modelID string) (Provider, error)

Jump to

Keyboard shortcuts

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