ai

package
v0.4.11-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AzureProvider       = "azureopenai"
	HuggingFaceProvider = "huggingface"
	OpenAIProvider      = "openai"
)

Variables

View Source
var ServicePromptMap = map[string]string{
	"default": default_prompt,
	"search":  search_prompt,
}

Functions

This section is empty.

Types

type AIConfig

type AIConfig struct {
	Name        string
	AuthToken   string
	BaseURL     string
	Model       string
	Temperature float32
	TopP        float32
}

AIConfig represents the configuration settings for an AI client.

func ConvertToAIConfig

func ConvertToAIConfig(c registry.ExtraConfig) AIConfig

type AIProvider

type AIProvider interface {
	// Configure sets up the AI service with the provided configuration.
	Configure(config AIConfig) error
	// Generate generates a response from the AI service based on
	// the provided prompt and service type.
	Generate(ctx context.Context, prompt string, serviceType string) (string, error)
}

AIProvider is an interface all AI clients.

func NewClient

func NewClient(name string) AIProvider

NewClient returns a new AIProvider object

type AzureAIClient

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

func (*AzureAIClient) Configure

func (c *AzureAIClient) Configure(cfg AIConfig) error

func (*AzureAIClient) Generate

func (c *AzureAIClient) Generate(ctx context.Context, prompt string, serviceType string) (string, error)

type HuggingfaceClient

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

func (*HuggingfaceClient) Configure

func (c *HuggingfaceClient) Configure(cfg AIConfig) error

func (*HuggingfaceClient) Generate

func (c *HuggingfaceClient) Generate(ctx context.Context, prompt string, serviceType string) (string, error)

type OpenAIClient

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

func (*OpenAIClient) Configure

func (c *OpenAIClient) Configure(cfg AIConfig) error

func (*OpenAIClient) Generate

func (c *OpenAIClient) Generate(ctx context.Context, prompt string, serviceType string) (string, error)

Jump to

Keyboard shortcuts

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