weaviate

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package weaviate provides a vector retriever backed by Weaviate's nearText GraphQL API. The server embeds query text internally; callers supply plain-text queries only.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*WeaviateRetriever)

Option configures WeaviateRetriever.

func WithClassName

func WithClassName(className string) Option

WithClassName sets the Weaviate class name.

func WithClient

func WithClient(client *client.Client) Option

WithClient sets the Weaviate client.

func WithContentField

func WithContentField(contentField string) Option

WithContentField sets the Weaviate content field.

func WithHost

func WithHost(host string) Option

WithHost sets the Weaviate host.

func WithLogLevel

func WithLogLevel(logLevel string) Option

WithLogLevel sets the Weaviate log level.

func WithLogger

func WithLogger(logger logger.Logger) Option

WithLogger sets the Weaviate logger.

func WithMinScore

func WithMinScore(minScore float64) Option

WithMinScore sets the Weaviate minimum score.

func WithScheme

func WithScheme(scheme string) Option

WithScheme sets the Weaviate scheme.

func WithSourceField

func WithSourceField(sourceField string) Option

WithSourceField sets the Weaviate source field.

func WithTopK

func WithTopK(topK int) Option

WithTopK sets the maximum number of documents returned per search.

type WeaviateRetriever

type WeaviateRetriever struct {
	// contains filtered or unexported fields
}

WeaviateRetriever searches a Weaviate class via nearText and maps hits to interfaces.Document.

func NewRetriever

func NewRetriever(name string, opts ...Option) (*WeaviateRetriever, error)

NewRetriever builds a WeaviateRetriever. name is the stable identifier returned by [Name] and must be non-empty and unique across all retrievers registered with the same agent. className is required. When WithClient is omitted, host is required and scheme defaults to types.DefaultScheme. Zero-valued topK and minScore default to types.DefaultTopK and types.DefaultMinScore.

func (*WeaviateRetriever) Name

func (r *WeaviateRetriever) Name() string

Name implements interfaces.Retriever.

func (*WeaviateRetriever) Search

func (r *WeaviateRetriever) Search(ctx context.Context, query string) ([]interfaces.Document, error)

Search runs a nearText GraphQL query against the configured class and returns ranked documents.

Jump to

Keyboard shortcuts

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