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) ([][]float32, error)
- func (o *Chat) Generate(ctx context.Context, messageSets [][]schema.ChatMessage, ...) ([]*llms.Generation, error)
- 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) ([][]float32, error)
- func (o *LLM) Generate(ctx context.Context, prompts []string, options ...llms.CallOption) ([]*llms.Generation, error)
- 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.
type ChatMessage ¶
type ChatMessage = vertexaiclient.ChatMessage
type LLM ¶
func (*LLM) CreateEmbedding ¶
CreateEmbedding creates embeddings for the given input texts.
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 WithGRPCDialOption ¶
func WithGRPCDialOption(opt grpc.DialOption) Option
func WithHTTPClient ¶
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.