weaviate

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2025 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client wraps the Weaviate client with additional functionality

func NewClient

func NewClient(config *Config) (*Client, error)

NewClient creates a new Weaviate client

func (*Client) CountDocuments added in v0.0.9

func (c *Client) CountDocuments(ctx context.Context, collectionName string) (int, error)

CountDocuments efficiently counts documents in a collection without fetching content This is much faster than ListDocuments for large collections with heavy data

func (*Client) CreateCollection added in v0.0.9

func (c *Client) CreateCollection(ctx context.Context, collectionName, embeddingModel string, customFields []FieldDefinition) error

CreateCollection creates a new collection with the specified schema

func (*Client) DeleteCollection

func (c *Client) DeleteCollection(ctx context.Context, collectionName string) error

DeleteCollection deletes all objects from a collection

func (*Client) DeleteCollectionSchema added in v0.0.9

func (c *Client) DeleteCollectionSchema(ctx context.Context, collectionName string) error

DeleteCollectionSchema deletes the collection schema completely

func (*Client) DeleteDocument

func (c *Client) DeleteDocument(ctx context.Context, collectionName, documentID string) error

DeleteDocument deletes a specific document by ID

func (*Client) DeleteDocumentsBulk added in v0.0.11

func (c *Client) DeleteDocumentsBulk(ctx context.Context, collectionName string, documentIDs []string) (int, error)

DeleteDocumentsBulk deletes multiple documents using concurrent individual requests for better performance

func (*Client) DeleteDocumentsByMetadata added in v0.0.4

func (c *Client) DeleteDocumentsByMetadata(ctx context.Context, collectionName string, metadataFilters []string) (int, error)

DeleteDocumentsByMetadata deletes documents matching metadata filters using REST API

func (*Client) GetCollectionSchema

func (c *Client) GetCollectionSchema(ctx context.Context, collectionName string) ([]string, error)

GetCollectionSchema returns the schema for a collection

func (*Client) GetDocument

func (c *Client) GetDocument(ctx context.Context, collectionName, documentID string) (*Document, error)

GetDocument retrieves a specific document by ID

func (*Client) GetDocumentsByMetadata added in v0.0.4

func (c *Client) GetDocumentsByMetadata(ctx context.Context, collectionName string, metadataFilters []string) ([]Document, error)

GetDocumentsByMetadata gets documents matching metadata filters

func (*Client) Health

func (c *Client) Health(ctx context.Context) error

Health checks the health of the Weaviate instance

func (*Client) ListCollections

func (c *Client) ListCollections(ctx context.Context) ([]string, error)

ListCollections returns a list of all collections

func (*Client) ListDocuments

func (c *Client) ListDocuments(ctx context.Context, collectionName string, limit int) ([]Document, error)

ListDocuments returns a list of documents in a collection Note: Currently shows document IDs only. To show actual document content/metadata, we would need to implement dynamic schema discovery for each collection.

type Config

type Config struct {
	URL          string
	APIKey       string
	OpenAIAPIKey string
}

Config holds Weaviate client configuration

type Document

type Document struct {
	ID        string                 `json:"id"`
	Content   string                 `json:"content"`
	Image     string                 `json:"image"`
	ImageData string                 `json:"image_data"`
	URL       string                 `json:"url"`
	Metadata  map[string]interface{} `json:"metadata"`
}

Document represents a document in Weaviate

type FieldDefinition added in v0.0.9

type FieldDefinition struct {
	Name string
	Type string
}

FieldDefinition represents a field in a collection

type ObjectInfo added in v0.0.9

type ObjectInfo struct {
	ID string
}

ObjectInfo represents basic object information

type WeaveClient added in v0.0.4

type WeaveClient struct {
	*Client
	// contains filtered or unexported fields
}

WeaveClient wraps the official Weaviate client with additional functionality

func NewWeaveClient added in v0.0.4

func NewWeaveClient(config *Config) (*WeaveClient, error)

NewWeaveClient creates a new Weave client with enhanced functionality

func (*WeaveClient) CountDocuments added in v0.0.9

func (wc *WeaveClient) CountDocuments(ctx context.Context, collectionName string) (int, error)

CountDocuments delegates to the official client

func (*WeaveClient) CreateCollection added in v0.0.9

func (wc *WeaveClient) CreateCollection(ctx context.Context, collectionName, embeddingModel string, customFields []FieldDefinition) error

CreateCollection delegates to the official client

func (*WeaveClient) CreateDocument added in v0.0.9

func (wc *WeaveClient) CreateDocument(ctx context.Context, collectionName string, document Document) error

CreateDocument creates a new document in the specified collection

func (*WeaveClient) DeleteCollection added in v0.0.4

func (wc *WeaveClient) DeleteCollection(ctx context.Context, collectionName string) error

DeleteCollection deletes all objects from a collection

func (*WeaveClient) DeleteCollectionSchema added in v0.0.9

func (wc *WeaveClient) DeleteCollectionSchema(ctx context.Context, collectionName string) error

DeleteCollectionSchema deletes the collection schema completely

func (*WeaveClient) DeleteDocument added in v0.0.4

func (wc *WeaveClient) DeleteDocument(ctx context.Context, collectionName, documentID string) error

DeleteDocument deletes a specific document by ID using REST API

func (*WeaveClient) DeleteDocumentsBulk added in v0.0.11

func (wc *WeaveClient) DeleteDocumentsBulk(ctx context.Context, collectionName string, documentIDs []string) (int, error)

DeleteDocumentsBulk deletes multiple documents in a single batch operation

func (*WeaveClient) DeleteDocumentsByMetadata added in v0.0.4

func (wc *WeaveClient) DeleteDocumentsByMetadata(ctx context.Context, collectionName string, metadataFilters []string) (int, error)

DeleteDocumentsByMetadata deletes documents matching metadata filters using REST API

func (*WeaveClient) GetCollectionSchema added in v0.0.4

func (wc *WeaveClient) GetCollectionSchema(ctx context.Context, collectionName string) ([]string, error)

GetCollectionSchema delegates to the official client

func (*WeaveClient) GetDocument added in v0.0.4

func (wc *WeaveClient) GetDocument(ctx context.Context, collectionName, documentID string) (*Document, error)

GetDocument delegates to the official client

func (*WeaveClient) GetDocumentsByMetadata added in v0.0.4

func (wc *WeaveClient) GetDocumentsByMetadata(ctx context.Context, collectionName string, metadataFilters []string) ([]Document, error)

GetDocumentsByMetadata gets documents matching metadata filters

func (*WeaveClient) Health added in v0.0.4

func (wc *WeaveClient) Health(ctx context.Context) error

Health delegates to the official client

func (*WeaveClient) ListCollections added in v0.0.4

func (wc *WeaveClient) ListCollections(ctx context.Context) ([]string, error)

ListCollections delegates to the official client

func (*WeaveClient) ListDocuments added in v0.0.4

func (wc *WeaveClient) ListDocuments(ctx context.Context, collectionName string, limit int) ([]Document, error)

ListDocuments delegates to the official client

Jump to

Keyboard shortcuts

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