π Satori Python SDK
This library allows you to easily and efficiently interact with the Satori database via WebSockets, supporting CRUD operations, real-time notifications, and advanced queries.β¨ Main Features
- Ultra-fast CRUD operations β‘
- Advanced queries using
field_array
π - Real-time notifications π’
- Graph-like relations (vertices and references) πΈοΈ
- Data encryption and decryption π
π Installation
π Basic Usage
ποΈ CRUD Operations
Create Data
Read Data
Modify a Field
Delete Data
π§© Advanced Queries with field_array
π
You can perform operations on multiple objects that meet certain conditions using the field_array
field:
field_array
is an array of conditions{ field, value }
.- You can combine it with
one: True
to get only the first matching result.
π Real-time Notifications
Receive automatic updates when an object changes:πΈοΈ Relations and Graphs
You can create relationships between objects (vertices):π Encryption and Security
Easily encrypt and decrypt data:π¦ Array Manipulation Methods
Below are the available methods to manipulate arrays in the Satori database using the Python client:πΉ push
Adds a value to an existing array in an object.- key: Object key.
- array: Name of the array.
- value: Value to add.
πΉ pop
Removes the last element from an array in an object.- key: Object key.
- array: Name of the array.
πΉ splice
Modifies an array in an object (for example, to cut or replace elements).- key: Object key.
- array: Name of the array.
πΉ remove
Removes a specific value from an array in an object.- key: Object key.
- array: Name of the array.
- value: Value to remove.
π€ AI Methods
Satori has AI features integrated that boost developers productivity. By example you can train an embedding model with your data and use it wherever you want to. You can train your embedding model manually whenever you want to but Satori will automatically fine-tune your model with any new updates and use this updated model for all emebedding operations.πΉ train
Train an embedding model with your data. The model is accessible onlocalhost:5000/model
The model will be at the root of your db in the satori_semantic_model
folder.
πΉ ann
Perform an Aproximate Nearest Neighbors search- key: Source object key.
- top_k: Number of nearest neighbors to return
πΉ query
Make querys in natural language- query: Your query in natural language.
- ref: The LLM backend. Must be
openai:model-name
orollama:model-name
, if not specifiedopenai:gpt-4o-mini
will be used as default. If youβre using OpenAI as your backend you must specify theOPENAI_API_KEY
env variable.
πΉ ask
Ask question about your data in natural language- question: Your question in natural language.
- ref: The LLM backend. Must be
openai:model-name
orollama:model-name
, if not specifiedopenai:gpt-4o-mini
will be used as default. If youβre using OpenAI as your backend you must specify theOPENAI_API_KEY
env variable.
Schema Class (Data Model)
You can use theSchema
class to model your data in an object-oriented way:
-
set
,delete
,encrypt
,decrypt
,set_vertex
,get_vertex
,delete_vertex
,dfs
-
Array methods:
push
,pop
,splice
,remove
π Complete Example
π§ Key Concepts
- key: Unique identifier of the object.
- type: Object type (e.g., βuserβ).
- field_array: Advanced filters for bulk operations.
- notifications: Subscription to real-time changes.
- vertices: Graph-like relationships between objects.