Skip to Content
Quick Start

Quick Start

Follow the steps below to install the VectorX SDK and set up your environment.

Requirements

  • Python ≥ 3.8
  • pip (Python package manager)
  • Works on Linux, macOS, and Windows

Installation

To install the SDK:

pip install vecx

Set Up VectorX DB and Create Index

Following snippet can be followed to initialize vectorx and index creation.

from vecx.vectorx import VectorX # Initialize client with your API token vx = VectorX(token="your-token-here") # Create a new index vx.create_index( name="my_index", dimension=768, # Your vector dimension space_type="cosine" # Distance metric (cosine, l2, ip) ) # Get index reference index = vx.get_index(name="my_index") # Insert vectors index.upsert([ { "id": "doc1", "vector": [0.1, 0.2, 0.3, ...], # Your vector data with specified dimension "meta": {"text": "Example document"}, "filter":{"category": "reference"} # Optional filter } ]) # Query similar vectors results = index.query( vector=[0.2, 0.3, 0.4, ...], # Query vector with specified dimenension top_k=10, filter=[{"category": {"$eq":"reference"}}] # Optional filter ) # Process results for item in results: print(f"ID: {item['id']}, Similarity: {item['similarity']}") print(f"Metadata: {item['meta']}")
Last updated on