Documentation ¶
Index ¶
- func DefineEmbedder(name string) ai.Embedder
- func DefineModel(name string, caps *ai.ModelCapabilities) (ai.Model, error)
- func Embedder(name string) ai.Embedder
- func Init(ctx context.Context, cfg *Config) error
- func IsDefinedEmbedder(name string) bool
- func IsDefinedModel(name string) bool
- func Model(name string) ai.Model
- type Config
- type EmbedOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefineEmbedder ¶
DefineEmbedder defines an embedder with a given name.
func DefineModel ¶
DefineModel defines an unknown model with the given name. The second argument describes the capability of the model. Use IsDefinedModel to determine if a model is already defined. After Init is called, only the known models are defined.
func Embedder ¶
Embedder returns the ai.Embedder with the given name. It returns nil if the embedder was not defined.
func Init ¶
Init initializes the plugin and all known models and embedders. After calling Init, you may call DefineModel and DefineEmbedder to create and register any additional generative models and embedders
func IsDefinedEmbedder ¶ added in v0.1.0
IsDefinedEmbedder reports whether the named Embedder is defined by this plugin.
func IsDefinedModel ¶ added in v0.1.0
IsDefinedModel reports whether the named Model is defined by this plugin.
Types ¶
type Config ¶ added in v0.0.2
type Config struct { // The cloud project to use for Vertex AI. // If empty, the values of the environment variables GCLOUD_PROJECT // and GOOGLE_CLOUD_PROJECT will be consulted, in that order. ProjectID string // The location of the Vertex AI service. The default is "us-central1". Location string // Options to the Vertex AI client. ClientOptions []option.ClientOption }
Config is the configuration for the plugin.
type EmbedOptions ¶
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.