vertexai

package
v1.0.18 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: MIT Imports: 21 Imported by: 2

Documentation

Index

Constants

View Source
const EmbedDimensions = 768
View Source
const Provider = "VertexAI"
View Source
const TypeClassification embed.Type = "CLASSIFICATION"
View Source
const TypeClustering embed.Type = "CLUSTERING"
View Source
const TypeCodeRetrieval embed.Type = "CODE_RETRIEVAL_QUERY"
View Source
const TypeDocument embed.Type = "RETRIEVAL_DOCUMENT"
View Source
const TypeFactVerification embed.Type = "FACT_VERIFICATION"
View Source
const TypeQuery embed.Type = "RETRIEVAL_QUERY"
View Source
const TypeQuestionAnswer embed.Type = "QUESTION_ANSWERING"
View Source
const TypeSemanticSimilarity embed.Type = "SEMANTIC_SIMILARITY"

Variables

View Source
var EmbedMode_multilang_002 = embed.Model{
	Provider:         Provider,
	Name:             "text-multilingual-embedding-002",
	Description:      "see https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/text-embeddings-api",
	InputMaxTokens:   2048,
	OutputDimensions: 768,
}
View Source
var EmbedModel_gemini_001 = embed.Model{
	Provider:         Provider,
	Name:             "gemini-embedding-001",
	Description:      "State-of-the-art performance across English, multilingual and code tasks. It unifies the previously specialized models like text-embedding-005 and text-multilingual-embedding-002 and achieves better performance in their respective domains.",
	InputMaxTokens:   2048,
	OutputDimensions: 3072,
}
View Source
var EmbedModel_text_004 = embed.Model{
	Provider:         Provider,
	Name:             "text-embedding-004",
	Description:      "see https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/text-embeddings-api",
	InputMaxTokens:   2048,
	OutputDimensions: 768,
}
View Source
var EmbedModel_text_005 = embed.Model{
	Provider:         Provider,
	Name:             "text-embedding-005",
	Description:      "see https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/text-embeddings-api",
	InputMaxTokens:   2048,
	OutputDimensions: 768,
}
View Source
var EmbedModel_text_gecko_003 = embed.Model{
	Provider:         Provider,
	Name:             "textembedding-gecko@003",
	Description:      "see https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/text-embeddings-api",
	InputMaxTokens:   2048,
	OutputDimensions: 768,
}

var EmbedModel_text_gecko_001 = embed.Model{ // deprecated?

	Provider:         Provider,
	Name:             "textembedding-gecko@001",
	Description:      "see https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/text-embeddings-api",
	InputMaxTokens:   2048,
	OutputDimensions: 768,
}
View Source
var EmbedModel_text_gecko_multilang_001 = embed.Model{
	Provider:         Provider,
	Name:             "textembedding-gecko-multilingual@001",
	Description:      "see https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/text-embeddings-api",
	InputMaxTokens:   2048,
	OutputDimensions: 768,
}
View Source
var GenModel_gemini_2_5_flash_latest = gen.Model{
	Provider:       Provider,
	Name:           "gemini-2.5-flash",
	InputMaxToken:  1_048_576,
	OutputMaxToken: 65_536,
}
View Source
var GenModel_gemini_2_5_flash_lite_latest = gen.Model{
	Provider:       Provider,
	Name:           "gemini-2.5-flash-lite",
	InputMaxToken:  1_048_576,
	OutputMaxToken: 65_536,
}
View Source
var GenModel_gemini_2_5_pro_latest = gen.Model{
	Provider:       Provider,
	Name:           "gemini-2.5-pro",
	InputMaxToken:  1_048_576,
	OutputMaxToken: 65_536,
}
View Source
var GenModel_gemini_3_1_flash_lite_preview = gen.Model{
	Provider:       Provider,
	Name:           "gemini-3.1-flash-lite-preview",
	InputMaxToken:  1_048_576,
	OutputMaxToken: 65_536,
}
View Source
var GenModel_gemini_3_1_pro_preview = gen.Model{
	Provider:       Provider,
	Name:           "gemini-3.1-pro-preview",
	InputMaxToken:  1_048_576,
	OutputMaxToken: 65_536,
}
View Source
var GenModel_gemini_3_flash_preview = gen.Model{
	Provider:       Provider,
	Name:           "gemini-3-flash-preview",
	InputMaxToken:  1_048_576,
	OutputMaxToken: 65_536,
}
View Source
var GenModel_gemini_3_pro_preview = gen.Model{
	Provider:       Provider,
	Name:           "gemini-3-pro-preview",
	InputMaxToken:  1_048_576,
	OutputMaxToken: 65_536,
}

Functions

This section is empty.

Types

type Google

type Google struct {
	Log *slog.Logger `json:"-"`
	// contains filtered or unexported fields
}

func New

func New(config GoogleConfig) (*Google, error)

func (*Google) Embed

func (g *Google) Embed(request *embed.Request) (*embed.Response, error)

func (*Google) EmbedDocument added in v1.0.0

func (g *Google) EmbedDocument(request *embed.DocumentRequest) (*embed.DocumentResponse, error)

func (*Google) Generator

func (g *Google) Generator(options ...gen.Option) *gen.Generator

func (*Google) Provider added in v0.7.0

func (g *Google) Provider() string

func (*Google) SetLogger

func (g *Google) SetLogger(logger *slog.Logger) *Google

type GoogleConfig

type GoogleConfig struct {
	Project    string
	Region     string
	Credential string
}

type GoogleEmbedRequest

type GoogleEmbedRequest struct {
	Instances []googleEmbedRequestInstance `json:"instances"`
}

type GoogleEmbedResponse

type GoogleEmbedResponse struct {
	Predictions []struct {
		Embeddings struct {
			Statistics struct {
				Truncated  bool `json:"truncated"`
				TokenCount int  `json:"token_count"`
			} `json:"statistics"`
			Values []float64 `json:"values"`
		} `json:"embeddings"`
	} `json:"predictions"`
}

type JSONSchema added in v0.8.0

type JSONSchema struct {
	Ref  string                 `json:"ref,omitempty"`  // #/defs/... etc, overrides everything else
	Defs map[string]*JSONSchema `json:"defs,omitempty"` // for ref
	// Optional. The type of the data.
	Type Type `json:"type,omitempty"`
	// Optional. The format of the data.
	// Supported formats:
	//
	//	for STRING type: "date", "date-time", "duration", "time", etc
	Format string `json:"format,omitempty"`
	// Optional. The title of the Schema.
	Title string `json:"title,omitempty"`
	// Optional. The description of the data.
	Description string `json:"description,omitempty"`
	// Optional. Indicates if the value may be null.
	Nullable bool `json:"nullable,omitempty"`
	// Optional. SCHEMA FIELDS FOR TYPE ARRAY
	// Schema of the elements of Type.ARRAY.
	Items *JSONSchema `json:"items,omitempty"`
	// Optional. Minimum number of the elements for Type.ARRAY.
	MinItems int `json:"minItems,omitempty"`
	// Optional. Maximum number of the elements for Type.ARRAY.
	MaxItems int `json:"maxItems,omitempty"`
	// Optional. Possible values of the element of Type.STRING with enum format.
	// For example we can define an Enum Direction as :
	// {type:STRING, format:enum, enum:["EAST", NORTH", "SOUTH", "WEST"]}
	Enum []string `json:"enum,omitempty"`
	// Optional. SCHEMA FIELDS FOR TYPE OBJECT
	// Properties of Type.OBJECT.
	Properties map[string]*JSONSchema `json:"properties,omitempty"`
	// Optional. Required properties of Type.OBJECT.
	Required []string `json:"required,omitempty"`
	// Optional. SCHEMA FIELDS FOR TYPE INTEGER and NUMBER
	// Minimum value of the Type.INTEGER and Type.NUMBER
	Minimum float64 `json:"minimum,omitempty"`
	// Optional. Maximum value of the Type.INTEGER and Type.NUMBER
	Maximum float64 `json:"maximum,omitempty"`
}

JSONSchema is used to define the format of input/output data. Represents a select subset of an [OpenAPI 3.0 schema object](https://spec.openapis.org/oas/v3.0.3#schema). More fields may be added in the future as needed.

type Type added in v0.8.0

type Type string
const (
	Object  Type = "OBJECT"
	Number  Type = "NUMBER"
	Integer Type = "INTEGER"
	String  Type = "STRING"
	Array   Type = "ARRAY"
	Boolean Type = "BOOLEAN"
)

Jump to

Keyboard shortcuts

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