Enable AI
Natural language to REST API translation using LLM tool calling.
Zero hardcoding - works with any OpenAPI spec. Parent module provides all configuration.
Installation
pip install enable-ai
# For Anthropic/Claude support:
pip install enable-ai[anthropic]
Quick Start
from enable_ai_v2 import Orchestrator, Config, JWTAuth
config = Config(
openapi_schema="path/to/openapi.json", # or dict
base_url="https://api.example.com",
# llm_provider="openai", # default
# llm_provider="anthropic", # optional
)
ai = Orchestrator(
config=config,
auth=JWTAuth(token="your-jwt-token"),
)
result = ai.process("show all pending orders")
print(result.message)
Features
- LLM tool calling - OpenAPI spec converted to LLM tools (OpenAI default, Anthropic optional)
- Server-side scoping - doesn't inject user filters; server's
get_queryset()handles permissions - Resource hints - status values, enums from your API for better accuracy
- Status synonyms - map natural language ("pending") to actual values ("DRAFT")
- Query caching - exact match + pattern match for fast repeat queries
- Progress tracking - real-time callbacks for UI updates
Configuration
Parent module provides everything:
from enable_ai_v2 import (
Config,
ResourceHint,
UserContext,
build_resource_hints_from_api,
build_status_synonyms,
)
# Fetch from your APIs (parent module's responsibility)
openapi_schema = your_api.get_schema()
statuses = your_api.get_service_order_statuses()
priorities = your_api.get_service_order_priorities()
config = Config(
# Required
openapi_schema=openapi_schema,
base_url="https://api.example.com",
# Recommended (for accuracy)
resource_hints=build_resource_hints_from_api(
openapi_schema,
statuses,
priorities,
),
status_synonyms=build_status_synonyms(statuses),
# Optional
# Optional
model="gpt-4o", # default; or "claude-sonnet-4-20250514" with llm_provider="anthropic"
temperature=0.0,
cache_enabled=True,
include_trace=False, # True for debugging
)
User Context
Parent module provides user context (doesn't fetch from APIs):
from enable_ai_v2 import UserContext
user_ctx = UserContext(
user_id=123,
username="john.doe",
role="Technician",
company_id=456,
is_admin=False,
)
result = ai.process("show my orders", user_context=user_ctx)
Authentication
from enable_ai_v2 import JWTAuth, APIKeyAuth, BasicAuth, NoAuth
# JWT (most common)
auth = JWTAuth(token="your-jwt-token")
# API Key
auth = APIKeyAuth(api_key="your-api-key", header_name="X-API-Key")
# Basic Auth
auth = BasicAuth(username="user", password="pass")
# No auth
auth = NoAuth()
ai = Orchestrator(config=config, auth=auth)
Progress Tracking
def on_progress(message: str, progress: float):
print(f"[{int(progress*100)}%] {message}")
config = Config(
openapi_schema=schema,
base_url="https://api.example.com",
progress_callback=on_progress,
)
Response
result = ai.process("show pending orders")
result.message # Natural language response
result.data # Raw API data
result.success # True/False
result.trace # Debug info (if include_trace=True)
Key Principle
Server handles data scoping. The system prompt instructs Claude:
Do NOT add user ID filters (like technician=, customer=, created_by=) unless the user explicitly asks to filter by a specific person.
Your backend's get_queryset() permissions handle which data each user sees.
Requirements
- Python 3.9+
OPENAI_API_KEYenvironment variable (default provider)- Or
ANTHROPIC_API_KEYif usingllm_provider="anthropic"
License
MIT
Metadata
Release files for enable-ai 1.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| enable_ai-1.4.0.tar.gz | 65.5 kB | Without provenance | Details for enable_ai-1.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| enable_ai-1.4.0-py3-none-any.whl | Python 3 | none | any | Details for enable_ai-1.4.0-py3-none-any.whl |
Total release size: 140.9 kB
Release files / enable_ai-1.4.0.tar.gz
| Download URL | enable_ai-1.4.0.tar.gz |
|---|---|
| Size | 65.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
da401b272d4a886127438fb4fe72005d6c7bb34b622004cff8d6ceea33e28424
|
|
BLAKE2b-256 checksum How to use checksums |
7004d81755b0028d72907d40f9a69d988770d832eb05ad5c7948a7c0c59e4d8e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.13
|
Release files / enable_ai-1.4.0-py3-none-any.whl
| Download URL | enable_ai-1.4.0-py3-none-any.whl |
|---|---|
| Size | 75.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
222fba39c4db09d9c67b58333ddd110ee693ca5c478a535e987db89956cf1353
|
|
BLAKE2b-256 checksum How to use checksums |
e32a5a98846acbe7de1955adee4171bf3676d7192d4b4fb54bdb3d280a548827
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.13
|
Security for enable-ai 1.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.