Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClassConfig ¶
type ClassConfig struct {
// The weaviate class name. May not be the empty string.
Class string
// The Embedder and options to use to embed documents.
// Embedder may not be nil.
Embedder ai.Embedder
EmbedderOptions any
}
ClassConfig holds configuration options for a retriever. Weaviate stores data in collections, and each collection has a class name. Use a separate genkit Retriever for each different class.
type Docstore ¶ added in v0.6.0
type Docstore struct {
Client *weaviate.Client
Class string
Embedder ai.Embedder
EmbedderOptions any
}
Docstore defines a Retriever.
func DefineRetriever ¶ added in v0.6.0
func DefineRetriever(ctx context.Context, g *genkit.Genkit, cfg ClassConfig, opts *ai.RetrieverOptions) (*Docstore, ai.Retriever, error)
DefineRetriever defines ai.Retriever that use the same class. The name uniquely identifies the Retriever in the registry.
func (*Docstore) Retrieve ¶ added in v0.6.0
func (ds *Docstore) Retrieve(ctx context.Context, req *ai.RetrieverRequest) (*ai.RetrieverResponse, error)
Retrieve implements the genkit Retriever.Retrieve method.
type RetrieverOptions ¶
type RetrieverOptions struct {
// Maximum number of values to retrieve.
Count int `json:"count,omitempty"`
// Keys to retrieve from document metadata.
// There doesn't seem to be a way to ask for all of the metadata.
MetadataKeys []string
}
RetrieverOptions may be passed in the Options field ai.RetrieverRequest to pass options to Weaviate. The options field should be either nil or a value of type *RetrieverOptions.
type Weaviate ¶ added in v0.3.0
type Weaviate struct {
// The hostname:port to use to contact the Weaviate database.
// If not set, the default is read from the WEAVIATE_URL environment variable.
Addr string
// The scheme to use to contact the Weaviate database.
// Typically http or https.
// If not set, the default is https.
Scheme string
// The API key to use with the Weaviate database.
// If not set, the default is read from the WEAVIATE_API_KEY environment variable.
APIKey string
// contains filtered or unexported fields
}
Weaviate passes configuration options to the plugin.
Click to show internal directories.
Click to hide internal directories.