Official Python SDK for Nebula API
Project description
Nebula Python SDK
Persistent memory layer for AI applications. Store, search, and retrieve information with semantic understanding.
Requirements
- Python 3.10 or higher
Installation
pip install nebula-client
Quick Start
from nebula import Nebula
# Initialize client
client = Nebula(api_key="your-api-key")
# Create a collection
collection = client.create_cluster(name="my_notes")
# Store a memory
memory_id = client.store_memory({
"collection_id": collection.id,
"content": "Machine learning is transforming healthcare",
"metadata": {"topic": "AI", "importance": "high"}
})
# Search memories
results = client.search(
query="machine learning healthcare",
collection_ids=[collection.id],
)
for result in results:
print(f"Score: {result.score:.2f}")
print(f"Content: {result.content}")
Core Operations
Collections
# Create
collection = client.create_cluster(name="my_collection", description="Optional description")
# List
collections = client.list_clusters()
# Get by ID or name
collection = client.get_cluster(collection_id)
collection = client.get_cluster_by_name("my_collection")
# Update
client.update_cluster(collection_id, name="new_name")
# Delete
client.delete_cluster(collection_id)
Store Memories
# Single memory
from nebula import Memory
memory = Memory(
collection_id=collection.id,
content="Your content here",
metadata={"category": "example"}
)
memory_id = client.store_memory(memory)
# Batch storage
memories = [
Memory(collection_id=collection.id, content="First memory"),
Memory(collection_id=collection.id, content="Second memory")
]
ids = client.store_memories(memories)
Retrieve Memories
# List memories
memories = client.list_memories(collection_ids=[collection.id], limit=10)
# Filter with metadata
memories = client.list_memories(
collection_ids=[collection.id],
metadata_filters={"metadata.category": {"$eq": "example"}}
)
# Get specific memory
memory = client.get_memory("memory_id")
Search
# Semantic search
results = client.search(
query="your search query",
collection_ids=[collection.id],
)
Delete
# Single deletion
deleted = client.delete("memory_id") # Returns True
# Batch deletion
result = client.delete(["id1", "id2", "id3"]) # Returns detailed results
Conversations
# Store conversation messages
user_msg = Memory(
collection_id=collection.id,
content="What is machine learning?",
role="user",
metadata={"content_type": "conversation"},
)
conv_id = client.store_memory(user_msg)
assistant_msg = Memory(
collection_id=collection.id,
content="Machine learning is a subset of AI...",
role="assistant",
parent_id=conv_id,
metadata={"content_type": "conversation"},
)
client.store_memory(assistant_msg)
# List conversation memories (filtering by metadata set above)
conversations = client.list_memories(
collection_ids=[collection.id],
metadata_filters={"metadata.content_type": {"$eq": "conversation"}},
)
# Get messages from a conversation memory
conversation = client.get_memory(conv_id)
messages = conversation.chunks or []
Async Client
from nebula import AsyncNebula, Memory
async with AsyncNebula(api_key="your-api-key") as client:
# All methods available with await
collection = await client.create_cluster(name="async_collection")
memory_id = await client.store_memory(Memory(
collection_id=collection.id,
content="Async memory"
))
results = await client.search("query", collection_ids=[collection.id])
Documentation
Support
Email support@trynebula.ai
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nebula_client-2.2.2.tar.gz.
File metadata
- Download URL: nebula_client-2.2.2.tar.gz
- Upload date:
- Size: 48.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed22a29b69ce369a7769a8c70f5a75c00e2ee122cd943810d341e7df3bc839ef
|
|
| MD5 |
d8d49267d0c409f2f18b1bb6099475fb
|
|
| BLAKE2b-256 |
b4c479c478b9d769f13cf91db03d22fd95042ac4167383a136fbc5c9a48b67bb
|
Provenance
The following attestation bundles were made for nebula_client-2.2.2.tar.gz:
Publisher:
python-ci.yml on nebula-agi/nebula-sdks
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nebula_client-2.2.2.tar.gz -
Subject digest:
ed22a29b69ce369a7769a8c70f5a75c00e2ee122cd943810d341e7df3bc839ef - Sigstore transparency entry: 1114585281
- Sigstore integration time:
-
Permalink:
nebula-agi/nebula-sdks@6253eacb3a2f73a1841bf59a423c2d31b8858308 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/nebula-agi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-ci.yml@6253eacb3a2f73a1841bf59a423c2d31b8858308 -
Trigger Event:
push
-
Statement type:
File details
Details for the file nebula_client-2.2.2-py3-none-any.whl.
File metadata
- Download URL: nebula_client-2.2.2-py3-none-any.whl
- Upload date:
- Size: 32.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe11b571b18cea2c6de0692a12874bf8b7669e1d585e7799e2c64cf509cd037c
|
|
| MD5 |
bd7af5a2ee7a16ee852b8cdad519a01c
|
|
| BLAKE2b-256 |
9342b52bfba76a0e5728bc5eaad1f1262bde5f41ce8ff75d732d09f64ed191a5
|
Provenance
The following attestation bundles were made for nebula_client-2.2.2-py3-none-any.whl:
Publisher:
python-ci.yml on nebula-agi/nebula-sdks
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nebula_client-2.2.2-py3-none-any.whl -
Subject digest:
fe11b571b18cea2c6de0692a12874bf8b7669e1d585e7799e2c64cf509cd037c - Sigstore transparency entry: 1114585301
- Sigstore integration time:
-
Permalink:
nebula-agi/nebula-sdks@6253eacb3a2f73a1841bf59a423c2d31b8858308 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/nebula-agi
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-ci.yml@6253eacb3a2f73a1841bf59a423c2d31b8858308 -
Trigger Event:
push
-
Statement type: