Use this file to discover all available pages before exploring further.
Get started with CyborgDB in minutes.
1
Get an API Key
To use CyborgDB, you need an API key. The quickest way to get started is with a demo key:
import cyborgdb_core as cyborgdb# Get a demo API key for evaluationapi_key = cyborgdb.get_demo_api_key()
For production use, get a full API key from the CyborgDB Admin Dashboard. For more info, follow this guide.Make sure to keep your API key secure and do not share it publicly.
2
Install CyborgDB
Install CyborgDB on your machine:
# Install CyborgDB:pip install cyborgdb-core# For automatic embedding generation, install with:pip install cyborgdb-core[embeddings]# For LangChain integration, install with:pip install cyborgdb-core[langchain]# Or with all extras:pip install cyborgdb-core[all]
You will need to replace <token> with your token provided by Cyborg.
3
Create a Client
Create a CyborgDB client:
import cyborgdb_core as cyborgdbimport secrets# Using `rocksdb` for simple persistent local storage# `redis`, `postgres`, `memory`, and `threadsafememory` are also supportedindex_location = cyborgdb.DBConfig("rocksdb") # Where encrypted index is stored (for queries)config_location = cyborgdb.DBConfig("rocksdb") # Where encrypted index config is stored (for config/loading)items_location = cyborgdb.DBConfig("rocksdb") # Where item contents are stored (for upsert/get)# Get your API key (use get_demo_api_key() for evaluation, or your own key)api_key = cyborgdb.get_demo_api_key()# Create a clientclient = cyborgdb.Client( api_key=api_key, index_location=index_location, config_location=config_location, items_location=items_location)
# ... Continuing from the previous step# Generate an encryption key for the indexindex_key = secrets.token_bytes(32)# Create an encrypted indexindex = client.create_index( index_name="my_index", index_key=index_key)
# ... Continuing from the previous step# Query the encrypted indexquery_vectors = [0.1, 0.2, 0.3, 0.4]results = index.query(query_vectors=query_vectors)# Print the resultsfor result in results: print(f"ID: {result['id']}, Distance: {result['distance']}")