openai-omega
OpenAI Integration with OmegaEngine Governance
Documentation • Playground • Issues
✨ Features
- 🤖 Drop-in Replacement — Same API as official OpenAI SDK
- 🛡️ Pre-flight Validation — Block unsafe prompts before sending
- 📊 Response Governance — Filter outputs against policies
- 📈 Full Audit Trail — Log every GPT-4/GPT-5 interaction
- ⚡ Streaming Support — Governed streaming responses
- 🔧 Function Call Validation — Validate tool calls before execution
- 🎯 Assistants API — Govern OpenAI Assistants
📦 Installation
Python
pip install openai-omega
🚀 Quick Start (Python)
from openai_omega import OpenAI
# Drop-in replacement for OpenAI client
client = OpenAI(
openai_api_key="your-openai-key",
omega_api_key="your-omega-key",
policy_id="gpt_policy",
)
# Same API, but governed
response = client.chat.completions.create(
model="gpt-4-turbo",
messages=[
{"role": "user", "content": "Help me with marketing"}
]
)
print(response.choices[0].message.content)
# Access governance metadata
print(response.omega_decision) # "ALLOW" | "BLOCK" | "ESCALATE"
print(response.omega_audit_id) # "aud_abc123"
print(response.omega_risk_score) # 15
🛡️ Pre-flight Validation
Block unsafe prompts before they reach OpenAI:
client = OpenAI(
openai_api_key="...",
omega_api_key="...",
preflight_check=True,
block_on_deny=True,
)
try:
response = client.chat.completions.create(
model="gpt-4-turbo",
messages=[{"role": "user", "content": "...jailbreak attempt..."}]
)
except OmegaBlockedError as e:
print(f"Blocked: {e.reason}")
print(f"Risk score: {e.risk_score}")
🔧 Function Call Governance
Validate function/tool calls before execution:
response = client.chat.completions.create(
model="gpt-4-turbo",
messages=[...],
tools=[...],
omega_validate_tools=True, # Validate tool calls
)
for tool_call in response.choices[0].message.tool_calls:
if tool_call.omega_approved:
execute_tool(tool_call)
else:
print(f"Tool blocked: {tool_call.omega_reason}")
📡 Governed Streaming
with client.chat.completions.create(
model="gpt-4-turbo",
messages=[{"role": "user", "content": "Write a story"}],
stream=True,
) as stream:
for chunk in stream:
print(chunk.choices[0].delta.content, end="")
print(f"\nDecision: {stream.omega_decision}")
🤖 Assistants API Support
# Governed Assistants
assistant = client.beta.assistants.create(
name="Analyst",
model="gpt-4-turbo",
omega_policy_id="assistant_policy",
)
# All threads are governed
thread = client.beta.threads.create()
message = client.beta.threads.messages.create(
thread_id=thread.id,
role="user",
content="Analyze this data..."
)
run = client.beta.threads.runs.create(
thread_id=thread.id,
assistant_id=assistant.id,
)
# Access governance metadata
print(run.omega_audit_id)
📊 What Gets Logged
| Field | Logged |
|---|---|
| Input messages | ✅ |
| Output response | ✅ |
| Token usage | ✅ |
| Model used | ✅ |
| Latency | ✅ |
| Policy evaluation | ✅ |
| Risk score | ✅ |
| Function calls | ✅ |
| Audit trail ID | ✅ |
📄 License
Licensed under the Apache License 2.0.
Built with ❤️ by the OmegaEngine team
Metadata
Release files for openai-omega 0.3.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 |
|---|---|---|---|---|
| openai_omega-0.3.0.tar.gz | 15.2 kB | Without provenance | Details for openai_omega-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| openai_omega-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for openai_omega-0.3.0-py3-none-any.whl |
Total release size: 28.9 kB
Release files / openai_omega-0.3.0.tar.gz
| Download URL | openai_omega-0.3.0.tar.gz |
|---|---|
| Size | 15.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a4ec8e6b982ccdaa1b266c3abf550f2eac5affa8e769b3e3a8a5aeb67eda4335
|
|
BLAKE2b-256 checksum How to use checksums |
6141328929bea2a39ea6fb059e035ae558c5454f80d0d4cbe56d18cd7bbb8e36
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / openai_omega-0.3.0-py3-none-any.whl
| Download URL | openai_omega-0.3.0-py3-none-any.whl |
|---|---|
| Size | 13.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7f8e28b6a789b96b46bdb5148a9c9068176ed9a0a22f296e2e17d3629a143a73
|
|
BLAKE2b-256 checksum How to use checksums |
b11614eda49ca132c433cd2abbb0b54d560bdda463d6038349325ee76346b7eb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Security for openai-omega 0.3.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.