weaviate

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2025 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Index added in v0.6.0

func Index(ctx context.Context, docs []*ai.Document, ds *Docstore) error

Helper function to get started with indexing

func Retriever

func Retriever(g *genkit.Genkit, class string) ai.Retriever

Retriever returns the retriever for the given class.

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) (*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.

func (*Weaviate) Init added in v0.3.0

func (w *Weaviate) Init(ctx context.Context, g *genkit.Genkit) (err error)

Init initializes the Weaviate plugin.

func (*Weaviate) Name added in v0.3.0

func (w *Weaviate) Name() string

Name returns the name of the plugin.

Jump to

Keyboard shortcuts

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