ai

package
v0.0.0-...-09fdd9a Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetClientOptions

func SetClientOptions(options ClientOptions)

SetClientOptions allows customization of the HTTP client

Types

type BaseProvider

type BaseProvider struct {
	APIKey string
	Model  string
	URL    string
}

func (*BaseProvider) GetEnvOrDefault

func (p *BaseProvider) GetEnvOrDefault(key, defaultValue string) string

type ClaudeAIProvider

type ClaudeAIProvider struct {
	BaseProvider
}

func NewClaudeAIProvider

func NewClaudeAIProvider() (*ClaudeAIProvider, error)

func (*ClaudeAIProvider) GenerateResponse

func (p *ClaudeAIProvider) GenerateResponse(ctx context.Context, prompt string) (string, error)

func (*ClaudeAIProvider) Name

func (p *ClaudeAIProvider) Name() string

type ClientOptions

type ClientOptions struct {
	Timeout       time.Duration
	RetryAttempts int
	RetryDelay    time.Duration
}

ClientOptions holds options for customizing the HTTP client

type GeminiAIProvider

type GeminiAIProvider struct {
	BaseProvider
	// contains filtered or unexported fields
}

func NewGeminiAIProvider

func NewGeminiAIProvider() (*GeminiAIProvider, error)

func (*GeminiAIProvider) GenerateResponse

func (p *GeminiAIProvider) GenerateResponse(ctx context.Context, prompt string) (string, error)

func (*GeminiAIProvider) Name

func (p *GeminiAIProvider) Name() string

type OpenAIProvider

type OpenAIProvider struct {
	BaseProvider
}

func NewOpenAIProvider

func NewOpenAIProvider() (*OpenAIProvider, error)

func (*OpenAIProvider) GenerateResponse

func (p *OpenAIProvider) GenerateResponse(ctx context.Context, prompt string) (string, error)

func (*OpenAIProvider) Name

func (p *OpenAIProvider) Name() string

type Provider

type Provider interface {
	GenerateResponse(ctx context.Context, prompt string) (string, error)
	Name() string
}

func NewProvider

func NewProvider(name string) (Provider, error)

type RequestDetails

type RequestDetails struct {
	URL               string
	APIKey            string
	RequestBody       interface{}
	AdditionalHeaders map[string]string
}

RequestDetails holds the details for an HTTP request

Jump to

Keyboard shortcuts

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