Documentation ¶
Overview ¶
package vertex implements a langchaingo provider for Google Vertex AI LLMs, including the new Gemini models. See https://cloud.google.com/vertex-ai for more details.
Index ¶
- Constants
- Variables
- type Option
- type Vertex
- func (g *Vertex) Call(ctx context.Context, prompt string, options ...llms.CallOption) (string, error)
- func (g *Vertex) CreateEmbedding(ctx context.Context, texts []string) ([][]float32, error)
- func (g *Vertex) GenerateContent(ctx context.Context, messages []llms.MessageContent, ...) (*llms.ContentResponse, error)
Constants ¶
const ( CITATIONS = "citations" SAFETY = "safety" RoleModel = "model" RoleUser = "user" )
Variables ¶
var ( ErrNoContentInResponse = errors.New("no content in generation response") ErrUnknownPartInResponse = errors.New("unknown part type in generation response") ErrInvalidMimeType = errors.New("invalid mime type on content") ErrSystemRoleNotSupported = errors.New("system role isn't supporeted yet") )
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*options)
func WithCloudLocation ¶
WithCloudLocation passes the GCP cloud location (region) name to the client.
func WithCloudProject ¶
WithCloudProject passes the GCP cloud project name to the client.
func WithDefaultEmbeddingModel ¶
WithDefaultModel passes a default embedding model name to the client. This model name is used if not explicitly provided in specific client invocations.
func WithDefaultModel ¶
WithDefaultModel passes a default content model name to the client. This model name is used if not explicitly provided in specific client invocations.
type Vertex ¶
Vertex is a type that represents a Vertex AI API client.
Right now, the Vertex Gemini SDK doesn't support embeddings; therefore, for embeddings we also hold a palmclient.
func (*Vertex) Call ¶
func (g *Vertex) Call(ctx context.Context, prompt string, options ...llms.CallOption) (string, error)
Call implements the llms.Model interface.
func (*Vertex) CreateEmbedding ¶
CreateEmbedding creates embeddings from texts.
func (*Vertex) GenerateContent ¶
func (g *Vertex) GenerateContent(ctx context.Context, messages []llms.MessageContent, options ...llms.CallOption) (*llms.ContentResponse, error)
GenerateContent implements the llms.Model interface.