Metadata-Version: 2.4
Name: oliviadb
Version: 0.1.2
Summary: Client for OliviaDB's network API: agent memory and layer-1 reads
License-Expression: Apache-2.0
Requires-Python: >=3.10
Description-Content-Type: text/markdown

<!-- SPDX-License-Identifier: Apache-2.0 -->
# oliviadb

The Python client of [OliviaDB](https://olivia-db.com/)'s network API: agent memory
(remember, recall), agent state, paths, layer-1 reads and writes of aggregates, change
streams, and the native protocol (`oliviadb.native`: one connection, many requests from
several threads, rows decoded only when a field is read). Standard library only. A list of
node URLs follows the primary of a high-availability pair.

## Install

```sh
pip install oliviadb
```

Python 3.10 or later.

## Example

A server from the core image (`docker run -d -p 8443:8443 -v oliviadb-data:/data
ghcr.io/oliviadb/oliviadb`), its API key in `OLIVIADB_API_KEY` and its certificate in
`oliviadb-ca.pem` (`docker cp <container>:/data/tls/server.pem oliviadb-ca.pem`):

```python
import os

from oliviadb import OliviaDbClient

db = OliviaDbClient("https://localhost:8443", api_key=os.environ["OLIVIADB_API_KEY"], ca_file="oliviadb-ca.pem")
db.remember(
    thread="t1",
    step_id="ann-1",
    text="Ann works at Acme.",
    facts=[{"entity": "Ann", "attr": "employer", "value": "Acme"}],
)
print(db.recall("Where does Ann work?", budget=300)["text"])
print(db.path("ENTITY=Ann")["facts"][0]["value"])  # Acme
```

## Links

* Documentation: <https://docs.olivia-db.com/>
* Repository: <https://github.com/OliviaDB/oliviadb-python> (`oliviadb-client`)

Licence: Apache-2.0.
