Documentation ¶
Index ¶
- Constants
- Variables
- type Configuration
- type GoogleVertexAIClient
- func (g *GoogleVertexAIClient) Configure(config IAIConfig) error
- func (g *GoogleVertexAIClient) GetCompletion(ctx context.Context, messages []llms.MessageContent, ...) (*llms.ContentResponse, error)
- func (g *GoogleVertexAIClient) GetCompletionFromSinglePrompt(ctx context.Context, prompt string) (string, error)
- func (g *GoogleVertexAIClient) GetName() string
- type GroqAIClient
- type IAI
- type IAIConfig
- type OpenAIClient
- func (c *OpenAIClient) Configure(config IAIConfig) error
- func (c *OpenAIClient) GetCompletion(ctx context.Context, messages []llms.MessageContent, ...) (*llms.ContentResponse, error)
- func (c *OpenAIClient) GetCompletionFromSinglePrompt(ctx context.Context, prompt string) (string, error)
- func (c *OpenAIClient) GetName() string
- type ParseError
- type Prompt
- type PromptBuilder
- type Provider
- func (p *Provider) GetBaseURL() string
- func (p *Provider) GetCompartmentId() string
- func (p *Provider) GetEmbeddingModel() string
- func (p *Provider) GetEndpointName() string
- func (p *Provider) GetEngine() string
- func (p *Provider) GetMaxTokens() int
- func (p *Provider) GetModel() string
- func (p *Provider) GetOrganizationId() string
- func (p *Provider) GetPassword() string
- func (p *Provider) GetProviderId() string
- func (p *Provider) GetProviderRegion() string
- func (p *Provider) GetProxyEndpoint() string
- func (p *Provider) GetTemperature() float32
- func (p *Provider) GetTopK() int32
- func (p *Provider) GetTopP() float32
- type StructuredResponse
Constants ¶
View Source
const ( // StructuredResponseCodeTypeJSON is the code type for JSON responses. StructuredResponseCodeTypeJSON = "json" // StructuredResponseCodeTypeYAML is the code type for YAML responses. StructuredResponseCodeTypeYAML = "yaml" )
View Source
const GoogleVertexAIClientName = "googlevertexai"
View Source
const GroqAIClientName = "groq"
View Source
const OpenAIClientName = "openai"
Variables ¶
View Source
var ( Clients = map[string]IAI{ OpenAIClientName: &OpenAIClient{}, GroqAIClientName: &GroqAIClient{}, GoogleVertexAIClientName: &GoogleVertexAIClient{}, } Backends = []string{ OpenAIClientName, GroqAIClientName, GoogleVertexAIClientName, } )
Functions ¶
This section is empty.
Types ¶
type Configuration ¶
type GoogleVertexAIClient ¶
type GoogleVertexAIClient struct {
// contains filtered or unexported fields
}
func (*GoogleVertexAIClient) Configure ¶
func (g *GoogleVertexAIClient) Configure(config IAIConfig) error
func (*GoogleVertexAIClient) GetCompletion ¶
func (g *GoogleVertexAIClient) GetCompletion(ctx context.Context, messages []llms.MessageContent, callOptions ...llms.CallOption) (*llms.ContentResponse, error)
func (*GoogleVertexAIClient) GetCompletionFromSinglePrompt ¶
func (*GoogleVertexAIClient) GetName ¶
func (g *GoogleVertexAIClient) GetName() string
type GroqAIClient ¶
type GroqAIClient struct {
OpenAIClient
}
func (*GroqAIClient) GetName ¶
func (a *GroqAIClient) GetName() string
type IAI ¶
type IAI interface { // Configure sets up client for given configuration Configure(config IAIConfig) error // GetCompletionFromSinglePrompt generates text based on prompt. GetCompletionFromSinglePrompt(ctx context.Context, prompt string) (string, error) // GetCompletion generates text based on complex prompt. GetCompletion(ctx context.Context, messages []llms.MessageContent, callOptions ...llms.CallOption) (*llms.ContentResponse, error) // GetName returns name of the backend/client. GetName() string }
IAI is an interface all clients (representing backends) share.
type IAIConfig ¶
type IAIConfig interface { GetPassword() string GetModel() string GetEmbeddingModel() string GetBaseURL() string GetProxyEndpoint() string GetEndpointName() string GetEngine() string GetTemperature() float32 GetProviderRegion() string GetTopP() float32 GetTopK() int32 GetMaxTokens() int GetProviderId() string GetCompartmentId() string GetOrganizationId() string }
type OpenAIClient ¶
type OpenAIClient struct {
// contains filtered or unexported fields
}
func (*OpenAIClient) Configure ¶
func (c *OpenAIClient) Configure(config IAIConfig) error
func (*OpenAIClient) GetCompletion ¶
func (c *OpenAIClient) GetCompletion(ctx context.Context, messages []llms.MessageContent, callOptions ...llms.CallOption) (*llms.ContentResponse, error)
func (*OpenAIClient) GetCompletionFromSinglePrompt ¶
func (*OpenAIClient) GetName ¶
func (c *OpenAIClient) GetName() string
type ParseError ¶
ParseError is the error type returned by output parsers.
func (ParseError) Error ¶
func (e ParseError) Error() string
type PromptBuilder ¶
type PromptBuilder struct { PromptName string // contains filtered or unexported fields }
func NewPromptBuilder ¶
func NewPromptBuilder(promptName string, vars any) *PromptBuilder
func (*PromptBuilder) BuildPrompt ¶
func (p *PromptBuilder) BuildPrompt() ([]llms.MessageContent, error)
func (*PromptBuilder) GetPromptContent ¶
func (p *PromptBuilder) GetPromptContent() (string, error)
func (*PromptBuilder) RenderPromptContent ¶
func (p *PromptBuilder) RenderPromptContent() (string, error)
type Provider ¶
type Provider struct { Name string `mapstructure:"name" yaml:"name,omitempty" goconf:"name"` Model string `mapstructure:"model" yaml:"model,omitempty" goconf:"model"` EmbeddingModel string `mapstructure:"embedding_model" yaml:"embedding_model,omitempty" goconf:"embedding_model"` Password string `mapstructure:"password" yaml:"password,omitempty" goconf:"password"` BaseURL string `mapstructure:"base_url" yaml:"base_url,omitempty" goconf:"base_url"` ProxyEndpoint string `mapstructure:"proxy_endpoint" yaml:"proxy_endpoint,omitempty" goconf:"proxy_endpoint"` ProxyPort string `mapstructure:"proxy_port" yaml:"proxy_port,omitempty" goconf:"proxy_port"` EndpointName string `mapstructure:"endpoint_name" yaml:"endpoint_name,omitempty" goconf:"endpoint_name"` Engine string `mapstructure:"engine" yaml:"engine,omitempty" goconf:"engine"` Temperature float32 `mapstructure:"temperature" yaml:"temperature,omitempty" goconf:"temperature"` ProviderRegion string `mapstructure:"provider_region" yaml:"provider_region,omitempty" goconf:"provider_region"` ProviderId string `mapstructure:"provider_id" yaml:"provider_id,omitempty" goconf:"provider_id"` CompartmentId string `mapstructure:"compartment_id" yaml:"compartment_id,omitempty" goconf:"compartment_id"` TopP float32 `mapstructure:"topp" yaml:"topp,omitempty" goconf:"topp"` TopK int32 `mapstructure:"topk" yaml:"topk,omitempty" goconf:"topk"` MaxTokens int `mapstructure:"max_tokens" yaml:"max_tokens,omitempty" goconf:"max_tokens"` OrganizationId string `mapstructure:"organization_id" yaml:"organization_id,omitempty" goconf:"organization_id"` }
func (*Provider) GetBaseURL ¶
func (*Provider) GetCompartmentId ¶
func (*Provider) GetEmbeddingModel ¶
func (*Provider) GetEndpointName ¶
func (*Provider) GetMaxTokens ¶
func (*Provider) GetOrganizationId ¶
func (*Provider) GetPassword ¶
func (*Provider) GetProviderId ¶
func (*Provider) GetProviderRegion ¶
func (*Provider) GetProxyEndpoint ¶
func (*Provider) GetTemperature ¶
type StructuredResponse ¶
func NewStructuredResponse ¶
func NewStructuredResponse(text string, codeType string, responseSchemas any) StructuredResponse
func (*StructuredResponse) Parse ¶
func (s *StructuredResponse) Parse() error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.