Documentation ¶
Index ¶
- func DefineIndexerAndRetriever(ctx context.Context, cfg ClassConfig) (ai.Indexer, ai.Retriever, error)
- func Indexer(class string) ai.Indexer
- func Init(ctx context.Context, cfg *ClientConfig) (*weaviate.Client, error)
- func Retriever(class string) ai.Retriever
- type ClassConfig
- type ClientConfig
- type RetrieverOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefineIndexerAndRetriever ¶
func DefineIndexerAndRetriever(ctx context.Context, cfg ClassConfig) (ai.Indexer, ai.Retriever, error)
DefineIndexerAndRetriever defines an ai.Indexer and ai.Retriever that use the same class. The name uniquely identifies the Indexer and Retriever in the registry.
func Init ¶
Init initializes the Weaviate plugin. The cfg argument may be nil to use the defaults. This returns the *weaviate.Client in case it is useful, but many users will be able to use just DefineIndexerAndRetriever.
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 an indexer/retriever pair. Weaviate stores data in collections, and each collection has a class name. Use a separate genkit Indexer/Retriever for each different class.
type ClientConfig ¶
type ClientConfig 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 }
ClientConfig passes configuration options to the plugin.
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.