Documentation ¶
Index ¶
- Variables
- type Chat
- func (o *Chat) Call(ctx context.Context, messages []schema.ChatMessage, options ...llms.CallOption) (*schema.AIChatMessage, error)
- func (o *Chat) CreateEmbedding(ctx context.Context, inputTexts []string) ([][]float64, error)
- func (o *Chat) Generate(ctx context.Context, messageSets [][]schema.ChatMessage, ...) ([]*llms.Generation, error)
- func (o *Chat) GeneratePrompt(ctx context.Context, promptValues []schema.PromptValue, ...) (llms.LLMResult, error)
- func (o *Chat) GetNumTokens(text string) int
- type ChatMessage
- type LLM
- func (o *LLM) Call(ctx context.Context, prompt string, options ...llms.CallOption) (string, error)
- func (o *LLM) CreateEmbedding(ctx context.Context, inputTexts []string) ([][]float64, error)
- func (o *LLM) Generate(ctx context.Context, prompts []string, options ...llms.CallOption) ([]*llms.Generation, error)
- func (o *LLM) GeneratePrompt(ctx context.Context, promptValues []schema.PromptValue, ...) (llms.LLMResult, error)
- func (o *LLM) GetNumTokens(text string) int
- type Option
Constants ¶
This section is empty.
Variables ¶
var ( ErrEmptyResponse = errors.New("no response") ErrMissingProjectID = errors.New("missing the GCP Project ID, set it in the GOOGLE_CLOUD_PROJECT environment variable") //nolint:lll ErrUnexpectedResponseLength = errors.New("unexpected length of response") ErrNotImplemented = errors.New("not implemented") )
Functions ¶
This section is empty.
Types ¶
type Chat ¶
type Chat struct {
// contains filtered or unexported fields
}
func (*Chat) Call ¶
func (o *Chat) Call(ctx context.Context, messages []schema.ChatMessage, options ...llms.CallOption) (*schema.AIChatMessage, error)
Chat requests a chat response for the given messages.
func (*Chat) CreateEmbedding ¶
CreateEmbedding creates embeddings for the given input texts.
func (*Chat) Generate ¶
func (o *Chat) Generate(ctx context.Context, messageSets [][]schema.ChatMessage, options ...llms.CallOption) ([]*llms.Generation, error)
Generate requests a chat response for each of the sets of messages.
func (*Chat) GeneratePrompt ¶
func (o *Chat) GeneratePrompt(ctx context.Context, promptValues []schema.PromptValue, options ...llms.CallOption) (llms.LLMResult, error)
func (*Chat) GetNumTokens ¶
type ChatMessage ¶
type ChatMessage = vertexaiclient.ChatMessage
type LLM ¶
func (*LLM) CreateEmbedding ¶
CreateEmbedding creates embeddings for the given input texts.
func (*LLM) Generate ¶
func (o *LLM) Generate(ctx context.Context, prompts []string, options ...llms.CallOption) ([]*llms.Generation, error)
func (*LLM) GeneratePrompt ¶
func (o *LLM) GeneratePrompt(ctx context.Context, promptValues []schema.PromptValue, options ...llms.CallOption) (llms.LLMResult, error)
func (*LLM) GetNumTokens ¶
type Option ¶
type Option func(*options)
Option is a function that can be passed to NewClient to configure options.
func WithAPIKey ¶
WithAPIKey returns a ClientOption that specifies an API key to be used as the basis for authentication.
func WithCredentialsFile ¶
WithCredentialsFile returns a ClientOption that authenticates API calls with the given service account or refresh token JSON credentials file.
func WithCredentialsJSON ¶
WithCredentialsJSON returns a ClientOption that authenticates API calls with the given service account or refresh token JSON credentials.
func WithProjectID ¶
WithProjectID passes the Google Cloud project ID to the client. If not set, the project is read from the GOOGLE_CLOUD_PROJECT environment variable.