Documentation
¶
Index ¶
- type Client
- func (c *Client) CountDocuments(ctx context.Context, collectionName string) (int, error)
- func (c *Client) CreateCollection(ctx context.Context, collectionName, embeddingModel string, ...) error
- func (c *Client) CreateCollectionFromSchema(ctx context.Context, schema *CollectionSchema) error
- func (c *Client) CreateCollectionWithSchema(ctx context.Context, collectionName, embeddingModel string, ...) error
- func (c *Client) CreateDocument(ctx context.Context, collectionName string, doc Document) error
- func (c *Client) DeleteAllDocuments(ctx context.Context, collectionName string) error
- func (c *Client) DeleteCollection(ctx context.Context, collectionName string) error
- func (c *Client) DeleteCollectionSchema(ctx context.Context, collectionName string) error
- func (c *Client) DeleteDocument(ctx context.Context, collectionName, documentID string) error
- func (c *Client) DeleteDocumentsBulk(ctx context.Context, collectionName string, documentIDs []string) (int, error)
- func (c *Client) DeleteDocumentsByMetadata(ctx context.Context, collectionName string, metadataFilters []string) (int, error)
- func (c *Client) GetCollectionSchema(ctx context.Context, collectionName string) ([]string, error)
- func (c *Client) GetDocument(ctx context.Context, collectionName, documentID string) (*Document, error)
- func (c *Client) GetDocumentsByMetadata(ctx context.Context, collectionName string, metadataFilters []string) ([]Document, error)
- func (c *Client) GetFullCollectionSchema(ctx context.Context, collectionName string) (*CollectionSchema, error)
- func (c *Client) Health(ctx context.Context) error
- func (c *Client) ListCollections(ctx context.Context) ([]string, error)
- func (c *Client) ListDocuments(ctx context.Context, collectionName string, limit int) ([]Document, error)
- func (c *Client) Query(ctx context.Context, collectionName, queryText string, options QueryOptions) ([]QueryResult, error)
- func (c *Client) QueryWithFilters(ctx context.Context, collectionName, queryText string, options QueryOptions, ...) ([]QueryResult, error)
- func (c *Client) UpdateDocument(ctx context.Context, collectionName, documentID, content string, ...) error
- type CollectionSchema
- type Config
- type Document
- type FieldDefinition
- type ObjectInfo
- type QueryOptions
- type QueryResult
- type SchemaProperty
- type SchemaType
- type WeaveClient
- func (wc *WeaveClient) CountDocuments(ctx context.Context, collectionName string) (int, error)
- func (wc *WeaveClient) CreateCollection(ctx context.Context, collectionName, embeddingModel string, ...) error
- func (wc *WeaveClient) CreateCollectionWithSchema(ctx context.Context, collectionName, embeddingModel string, ...) error
- func (wc *WeaveClient) CreateDocument(ctx context.Context, collectionName string, document Document) error
- func (wc *WeaveClient) DeleteAllDocuments(ctx context.Context, collectionName string) error
- func (wc *WeaveClient) DeleteCollection(ctx context.Context, collectionName string) error
- func (wc *WeaveClient) DeleteCollectionSchema(ctx context.Context, collectionName string) error
- func (wc *WeaveClient) DeleteDocument(ctx context.Context, collectionName, documentID string) error
- func (wc *WeaveClient) DeleteDocumentsBulk(ctx context.Context, collectionName string, documentIDs []string) (int, error)
- func (wc *WeaveClient) DeleteDocumentsByMetadata(ctx context.Context, collectionName string, metadataFilters []string) (int, error)
- func (wc *WeaveClient) GetCollectionSchema(ctx context.Context, collectionName string) ([]string, error)
- func (wc *WeaveClient) GetDocument(ctx context.Context, collectionName, documentID string) (*Document, error)
- func (wc *WeaveClient) GetDocumentsByMetadata(ctx context.Context, collectionName string, metadataFilters []string) ([]Document, error)
- func (wc *WeaveClient) Health(ctx context.Context) error
- func (wc *WeaveClient) ListCollections(ctx context.Context) ([]string, error)
- func (wc *WeaveClient) ListDocuments(ctx context.Context, collectionName string, limit int) ([]Document, error)
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 (*Client) CountDocuments ¶ added in v0.0.9
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) CreateCollectionFromSchema ¶ added in v0.2.4
func (c *Client) CreateCollectionFromSchema(ctx context.Context, schema *CollectionSchema) error
CreateCollectionFromSchema creates a collection from a CollectionSchema object
func (*Client) CreateCollectionWithSchema ¶ added in v0.1.10
func (c *Client) CreateCollectionWithSchema(ctx context.Context, collectionName, embeddingModel string, customFields []FieldDefinition, schemaType string) error
CreateCollectionWithSchema creates a new collection with the specified schema type
func (*Client) CreateDocument ¶ added in v0.1.10
CreateDocument creates a new document in the specified collection
func (*Client) DeleteAllDocuments ¶ added in v0.2.3
DeleteAllDocuments deletes all documents in a collection
func (*Client) DeleteCollection ¶
DeleteCollection deletes all objects from a collection
func (*Client) DeleteCollectionSchema ¶ added in v0.0.9
DeleteCollectionSchema deletes the collection schema completely
func (*Client) DeleteDocument ¶
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 ¶
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) GetFullCollectionSchema ¶ added in v0.2.4
func (c *Client) GetFullCollectionSchema(ctx context.Context, collectionName string) (*CollectionSchema, error)
GetFullCollectionSchema returns the full schema for a collection
func (*Client) ListCollections ¶
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.
func (*Client) Query ¶ added in v0.2.8
func (c *Client) Query(ctx context.Context, collectionName, queryText string, options QueryOptions) ([]QueryResult, error)
Query performs semantic search on a collection using nearText
func (*Client) QueryWithFilters ¶ added in v0.2.8
func (c *Client) QueryWithFilters(ctx context.Context, collectionName, queryText string, options QueryOptions, filters map[string]interface{}) ([]QueryResult, error)
QueryWithFilters performs semantic search with additional metadata filters
type CollectionSchema ¶ added in v0.2.4
type CollectionSchema struct {
Class string `json:"class"`
Vectorizer string `json:"vectorizer,omitempty"`
Properties []SchemaProperty `json:"properties"`
}
CollectionSchema represents a collection schema
type Document ¶
type Document struct {
ID string `json:"id"`
Text string `json:"text"`
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
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 QueryOptions ¶ added in v0.2.8
type QueryOptions struct {
TopK int `json:"top_k"`
Distance float64 `json:"distance"`
SearchMetadata bool `json:"search_metadata"`
NoTruncate bool `json:"no_truncate"`
UseBM25 bool `json:"use_bm25"`
}
QueryOptions holds options for semantic search queries
type QueryResult ¶ added in v0.2.8
type QueryResult struct {
ID string `json:"id"`
Content string `json:"content"`
Metadata map[string]interface{} `json:"metadata"`
Score float64 `json:"score"`
}
QueryResult represents the result of a semantic search query
type SchemaProperty ¶ added in v0.2.4
type SchemaProperty struct {
Name string `json:"name" yaml:"name"`
DataType []string `json:"dataType" yaml:"datatype"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
NestedProperties []SchemaProperty `json:"nestedProperties,omitempty" yaml:"nestedproperties,omitempty"`
JSONSchema map[string]interface{} `json:"json_schema,omitempty" yaml:"json_schema,omitempty"`
}
SchemaProperty represents a property in a collection schema
type SchemaType ¶ added in v0.1.10
type SchemaType string
SchemaType represents the type of collection schema
const ( SchemaTypeText SchemaType = "text" SchemaTypeImage SchemaType = "image" )
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
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) CreateCollectionWithSchema ¶ added in v0.1.10
func (wc *WeaveClient) CreateCollectionWithSchema(ctx context.Context, collectionName, embeddingModel string, customFields []FieldDefinition, schemaType string) error
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) DeleteAllDocuments ¶ added in v0.2.3
func (wc *WeaveClient) DeleteAllDocuments(ctx context.Context, collectionName string) error
DeleteAllDocuments deletes all documents in a 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