Documentation
¶
Overview ¶
Package weaviate provides an adapter for generating embeddings via Zerfoo's OpenAI-compatible HTTP API and inserting them into a Weaviate vector database client.
The adapter does not import the Weaviate Go client directly. It produces []float32 embedding vectors from text using Zerfoo's /v1/embeddings endpoint. Callers can then pass those vectors to Weaviate's batch import or search API.
Usage:
emb := weaviate.NewAdapter("http://localhost:8080", "nomic-embed-text")
vecs, err := emb.EmbedDocuments(ctx, []string{"doc one", "doc two"})
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct {
// BatchSize controls how many texts are sent per API request. Default 32.
BatchSize int
// contains filtered or unexported fields
}
Adapter wraps Zerfoo's /v1/embeddings endpoint and produces float32 vectors suitable for insertion into Weaviate.
func NewAdapter ¶
func NewAdapter(baseURL, model string, opts ...AdapterOption) *Adapter
NewAdapter creates an Adapter pointing at a running Zerfoo serve instance.
baseURL is the server root (e.g. "http://localhost:8080"). model is the embedding model identifier forwarded in the request body.
func (*Adapter) EmbedDocuments ¶
EmbedDocuments embeds multiple texts and returns one vector per text. Texts are sent in batches of BatchSize to avoid oversized requests. This mirrors the LangChain-Go schema.Embedder.EmbedDocuments signature.
type AdapterOption ¶
type AdapterOption func(*Adapter)
AdapterOption configures an Adapter.
func WithBatchSize ¶
func WithBatchSize(n int) AdapterOption
WithBatchSize sets the number of texts to embed in a single request.
func WithHTTPClient ¶
func WithHTTPClient(c *http.Client) AdapterOption
WithHTTPClient replaces the default HTTP client.