gemini

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package gemini contains code that is common to both the Google AI and Vertex AI plugins.

Index

Constants

View Source
const (
	GoogleAIProvider = "googleai"
	VertexAIProvider = "vertexai"
)

Variables

View Source
var (
	// BasicText describes model capabilities for text-only Gemini models.
	BasicText = ai.ModelSupports{
		Multiturn:  true,
		Tools:      true,
		ToolChoice: true,
		SystemRole: true,
		Media:      false,
	}

	//  Multimodal describes model capabilities for multimodal Gemini models.
	Multimodal = ai.ModelSupports{
		Multiturn:  true,
		Tools:      true,
		ToolChoice: true,
		SystemRole: true,
		Media:      true,
	}

	GenkitClientHeader = http.Header{
						// contains filtered or unexported fields
	}
)

Functions

func DefineEmbedder added in v0.3.0

func DefineEmbedder(g *genkit.Genkit, client *genai.Client, name string) ai.Embedder

DefineEmbedder defines embeddings for the provided contents and embedder model

func DefineModel added in v0.3.0

func DefineModel(g *genkit.Genkit, client *genai.Client, name string, info ai.ModelInfo) ai.Model

DefineModel defines a model in the registry

func Generate added in v0.3.0

func Generate(
	ctx context.Context,
	client *genai.Client,
	model string,
	input *ai.ModelRequest,
	cb func(context.Context, *ai.ModelResponseChunk) error,
) (*ai.ModelResponse, error)

Generate requests a generate call to the specified model with the provided configuration

Types

type EmbedOptions added in v0.3.0

type EmbedOptions struct {
	// Document title.
	Title string `json:"title,omitempty"`
	// Task type: RETRIEVAL_QUERY, RETRIEVAL_DOCUMENT, and so forth.
	// See the Vertex AI text embedding docs.
	TaskType string `json:"task_type,omitempty"`
}

EmbedOptions are options for the Vertex AI embedder. Set ai.EmbedRequest.Options to a value of type *EmbedOptions.

Jump to

Keyboard shortcuts

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