vertexai

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2025 License: MIT Imports: 18 Imported by: 2

Documentation

Index

Constants

View Source
const EmbedDimensions = 768
View Source
const Provider = "VertexAI"

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_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_1_5_flash = gen.Model{
	Provider:                Provider,
	Name:                    "gemini-1.5-flash",
	Description:             "Fast and versatile performance across a diverse variety of tasks",
	InputContentTypes:       nil,
	InputMaxToken:           0,
	OutputMaxToken:          0,
	SupportTools:            false,
	SupportStructuredOutput: false,
}
View Source
var GenModel_gemini_1_5_flash_001 = gen.Model{
	Provider:                Provider,
	Name:                    "gemini-1.5-flash-002",
	Description:             "Fast and versatile performance across a diverse variety of tasks",
	InputContentTypes:       nil,
	InputMaxToken:           0,
	OutputMaxToken:          0,
	SupportTools:            false,
	SupportStructuredOutput: false,
}
View Source
var GenModel_gemini_1_5_flash_002 = gen.Model{
	Provider:                Provider,
	Name:                    "gemini-1.5-flash-001",
	Description:             "Fast and versatile performance across a diverse variety of tasks",
	InputContentTypes:       nil,
	InputMaxToken:           0,
	OutputMaxToken:          0,
	SupportTools:            false,
	SupportStructuredOutput: false,
}
View Source
var GenModel_gemini_1_5_pro = gen.Model{
	Provider:                Provider,
	Name:                    "gemini-1.5-pro",
	Description:             "Complex reasoning tasks requiring more intelligence",
	InputContentTypes:       nil,
	InputMaxToken:           0,
	OutputMaxToken:          0,
	SupportTools:            false,
	SupportStructuredOutput: false,
}
View Source
var GenModel_gemini_1_5_pro_001 = gen.Model{
	Provider:                Provider,
	Name:                    "gemini-1.5-pro-001",
	Description:             "Complex reasoning tasks requiring more intelligence",
	InputContentTypes:       nil,
	InputMaxToken:           0,
	OutputMaxToken:          0,
	SupportTools:            false,
	SupportStructuredOutput: false,
}
View Source
var GenModel_gemini_1_5_pro_002 = gen.Model{
	Provider:                Provider,
	Name:                    "gemini-1.5-pro-002",
	Description:             "Complex reasoning tasks requiring more intelligence",
	InputContentTypes:       nil,
	InputMaxToken:           0,
	OutputMaxToken:          0,
	SupportTools:            false,
	SupportStructuredOutput: false,
}
View Source
var GenModel_gemini_2_0_flash = gen.Model{
	Provider:                Provider,
	Name:                    "gemini-2.0-flash-exp",
	Description:             "Fast and versatile performance across a diverse variety of tasks",
	InputContentTypes:       nil,
	InputMaxToken:           0,
	OutputMaxToken:          0,
	SupportTools:            false,
	SupportStructuredOutput: false,
}

Functions

This section is empty.

Types

type EmbedType

type EmbedType string
const EmbedTypeClassification EmbedType = "CLASSIFICATION"
const EmbedTypeClustring EmbedType = "CLUSTERING"
const EmbedTypeCode EmbedType = "CODE_RETRIEVAL_QUERY"
const EmbedTypeDocument EmbedType = "RETRIEVAL_DOCUMENT"
const EmbedTypeQA EmbedType = "QUESTION_ANSWERING"
const EmbedTypeQuery EmbedType = "RETRIEVAL_QUERY"
const EmbedTypeSimilarity EmbedType = "SEMANTIC_SIMILARITY"
const EmbedTypeVerification EmbedType = "FACT_VERIFICATION"

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) 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 []struct {
		//TaskType string `json:"task_type"`
		//Title    string `json:"title"`
		Content string `json:"content"`
	} `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 {
	// Optional. The type of the data.
	Type Type `json:"type,omitempty"`
	// Optional. The format of the data.
	// Supported formats:
	//
	//	for NUMBER type: "float", "double"
	//	for INTEGER type: "int32", "int64"
	//	for STRING type: "email", "byte", 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:"min_items,omitempty"`
	// Optional. Maximum number of the elements for Type.ARRAY.
	MaxItems int `json:"max_items,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. Minimum number of the properties for Type.OBJECT.
	MinProperties int `json:"min_properties,omitempty"`
	// Optional. Maximum number of the properties for Type.OBJECT.
	MaxProperties int `json:"max_properties,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"`
	// Optional. SCHEMA FIELDS FOR TYPE STRING
	// Minimum length of the Type.STRING
	MinLength int `json:"min_length,omitempty"`
	// Optional. Maximum length of the Type.STRING
	MaxLength int `json:"max_length,omitempty"`
	// Optional. Pattern of the Type.STRING to restrict a string to a regular
	// expression.
	Pattern string `json:"pattern,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