A Python package for interacting with the Unify API
Project description
Unify
Thin Python SDK wrapping the Orchestra REST API. Provides functional utilities for logging, project management, and assistant operations.
This package is used as a dependency by higher-level frameworks like Unity.
Installation
pip install unifyai
Or add to your project's dependencies pointing to this repo.
Configuration
Set your API key via environment variable:
export UNIFY_KEY=<your-api-key>
Optionally override the API base URL (defaults to https://api.unify.ai/v0):
export UNIFY_BASE_URL=https://api.unify.ai/v0
Core API
Projects
import unify
# Activate a project (creates if doesn't exist)
unify.activate("my-project")
# Or manage projects directly
unify.create_project("my-project")
unify.list_projects()
unify.delete_project("my-project")
Logging
import unify
unify.activate("my-project")
# Log entries
unify.log(question="What is 2+2?", response="4", score=1.0)
# Retrieve logs
logs = unify.get_logs()
Parallel Mapping
import unify
def process(item):
# ... do work ...
unify.log(item=item, result=result)
unify.map(process, items)
Project Structure
unify/
├── __init__.py # Public API exports
├── assistants/ # Assistant management
│ └── management.py
├── logging/ # Logging functionality
│ ├── logs.py # Core Log class
│ └── utils/ # Logging utilities
│ ├── contexts.py # Context management
│ ├── logs.py # Log CRUD operations
│ └── projects.py # Project CRUD operations
├── platform/ # Platform API
│ ├── queries.py # Query logging
│ └── user.py # User info
└── utils/ # Shared utilities
├── http.py # HTTP client
├── storage.py # Object storage
├── map.py # Parallel mapping
├── helpers.py # Misc helpers
└── caching/ # Cache backends
Local Development
This project uses Poetry for dependency management.
Setup
poetry install
Running Tests
poetry run pytest tests/path/to/test.py -v
If you encounter Project _ not found errors during test startup, unset the CI variable:
CI= poetry run pytest tests/path/to/test.py -v
Pre-commit Hooks
Pre-commit hooks run automatically on git commit (Black, isort, autoflake). If a commit fails due to auto-formatting, re-run the commit.
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 unifyai-0.9.191.tar.gz.
File metadata
- Download URL: unifyai-0.9.191.tar.gz
- Upload date:
- Size: 40.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.9.25 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d61aa4531fa18f7508184dcacc702d0c7a85e42df4c1afc0ad1a5e662a037264
|
|
| MD5 |
4e6857db2b11afdfb2c4328062705090
|
|
| BLAKE2b-256 |
8b26d0ba4a3e2e5e8b3f6d09c1a2ff4f12d954c78a7f847a6831ebd51eaa2ef8
|
File details
Details for the file unifyai-0.9.191-py3-none-any.whl.
File metadata
- Download URL: unifyai-0.9.191-py3-none-any.whl
- Upload date:
- Size: 49.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.9.25 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32713388b056a1421a37f2e1ed6379db0e4422efc8fb33b714b566c50f82daa6
|
|
| MD5 |
91e111a8a1ed849366957f0ec031c4b8
|
|
| BLAKE2b-256 |
24f52bc2eb60ebeddc1281fbd9251fcb6b3c18b20d407008ceedf43e351b1798
|