Skip to main content

A Python client for the SyzgyDB vector database

Project description

Syzgy Python Client

This is the official Python client for interacting with the SyzgyDB vector database REST API. SyzgyDB is a high-performance, embeddable vector database designed for efficient handling of large datasets.

Installation

You can install the SyzgyDB Python client using pip:

pip install syzgy

Quick Start

Here's a quick example of how to use the SyzgyDB Python client:

from syzgy import SyzgyClient, Document

# Initialize the client
client = SyzgyClient("http://localhost:8080")

# Create a collection
collection = client.create_collection(
    name="my_collection",
    vector_size=5,
    quantization=64,
    distance_function="cosine"
)

# Insert documents
documents = [
    Document(id=1, vector=[0.1, 0.2, 0.3, 0.4, 0.5], metadata={"key": "value1"}),
    Document(id=2, vector=[1, 2, 3, 4, 5], metadata={"key": "value2"})
]
collection.insert_documents(documents)

# Search
results = collection.search(
    vector=[0,0,0,0,0.1],
    k=5
)

for result in results:
    print(f"ID: {result.id}, Distance: {result.distance}, Metadata: {result.metadata}")

# Delete the collection
client.delete_collection("my_collection")

This example demonstrates:

  1. Initializing the SyzgyClient
  2. Creating a collection
  3. Inserting documents into the collection
  4. Performing a search on the collection
  5. Deleting the collection

Note that document insertion, searching, and other collection-specific operations are performed on the Collection object, while collection management (creation, deletion) is done through the SyzgyClient.

Features

  • Create and manage collections
  • Insert, update, and delete documents
  • Perform vector similarity searches
  • Support for text-to-vector conversion (when using with Ollama server)
  • Flexible search options including k-nearest neighbors and radius search
  • Metadata filtering

API Reference

SyzgyClient

The main class for interacting with SyzgyDB.

__init__(base_url: str)

Initialize the client with the base URL of your Syzgy instance.

create_collection(name: str, vector_size: int, quantization: int, distance_function: str) -> Collection

Create a new collection.

get_collections() -> List[Collection]

Get a list of all collections.

get_collection(name: str) -> Collection

Get details of a specific collection.

delete_collection(name: str) -> Dict

Delete a collection.

Collection

Represents a collection in SyzgyDB.

insert_documents(documents: List[Document]) -> Dict

Insert documents into the collection.

update_document_metadata(document_id: int, metadata: Dict) -> Dict

Update the metadata of a document.

delete_document(document_id: int) -> Dict

Delete a document from the collection.

search(**kwargs) -> List[SearchResult]

Perform a search in the collection. Supports various search parameters:

  • vector: Optional[List[float]]
  • text: Optional[str]
  • k: Optional[int]
  • radius: Optional[float]
  • limit: Optional[int]
  • offset: Optional[int]
  • precision: Optional[str]
  • filter: Optional[str]

get_document_ids() -> List[int]

Get all document IDs in the collection.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

syzgy-0.1.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

syzgy-0.1.0-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file syzgy-0.1.0.tar.gz.

File metadata

  • Download URL: syzgy-0.1.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for syzgy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4a27419b179cbfa879c09a26e1dca966f37b1967e85c571a1380d6a7afaa4909
MD5 5c2767a05f1382c800eeea003be80fdf
BLAKE2b-256 e604fbf299cb32cb5aa9d162a0c7991b1430c1b0258fb99b657cbc4faa6f6b32

See more details on using hashes here.

File details

Details for the file syzgy-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: syzgy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for syzgy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ebe4d6b967b78124d4c6d803ba4d17fa34e8988dbd034cdd7a5cab9f9a9a94a5
MD5 a67a58058ae6bd7d1147b5239ebbae51
BLAKE2b-256 3755c547e9c123afda927cca3b4c98fcfcecee3e4d971a5fcf017c341ec33258

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page