langchain-omega
LangChain Integration for OmegaEngine
Documentation • Playground • Issues
✨ Features
- 🔗 Callback Handler — Log all LLM decisions to OmegaEngine
- 🤖 Agent Wrapper — Enforce policies on LangChain agents
- 📊 Decision Logging — Automatic audit trail for all interactions
- 🛡️ Safety Guards — Pre/post-processing safety filters
- ⚡ Async Support — Full async/await compatibility
📦 Installation
pip install langchain-omega
🚀 Quick Start
Callback Handler
from langchain_openai import ChatOpenAI
from langchain_omega import OmegaCallbackHandler
# Create callback handler
omega_handler = OmegaCallbackHandler(
api_key="your-omega-api-key",
policy_id="pol_abc123",
)
# Use with any LangChain LLM
llm = ChatOpenAI(callbacks=[omega_handler])
# All invocations are now logged to OmegaEngine
response = llm.invoke("What is the capital of France?")
Decision Tool
from langchain.agents import create_openai_functions_agent
from langchain_omega import OmegaDecisionTool
# Add decision tool to your agent
decision_tool = OmegaDecisionTool(
api_key="your-omega-api-key",
domain="finance",
)
tools = [decision_tool, ...other_tools]
agent = create_openai_functions_agent(llm, tools, prompt)
# Agent can now make governed decisions
result = agent.invoke({
"input": "Should we approve this loan application?"
})
Safety Guard Chain
from langchain_omega import GovernedLLMChain
# Wrap any chain with safety guards
safe_chain = GovernedLLMChain(
chain=your_chain,
api_key="your-omega-api-key",
policy_id="safety_policy",
block_on_deny=True,
)
# Chain will block unsafe outputs
result = safe_chain.invoke({"input": "..."})
📊 What Gets Logged
Every LLM interaction logs:
- ✅ Input prompt
- ✅ Output response
- ✅ Token usage
- ✅ Latency
- ✅ Model name
- ✅ Policy evaluation result
- ✅ Risk assessment
- ✅ Audit trail ID
📄 License
Licensed under the Apache License 2.0.
Built with ❤️ by the OmegaEngine team
Release files for langchain-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 | |
|---|---|---|---|
| langchain_omega-0.3.0.tar.gz | 565.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| langchain_omega-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 581.9 kB
Release files / langchain_omega-0.3.0.tar.gz
| Download URL | langchain_omega-0.3.0.tar.gz |
|---|---|
| Size | 565.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2f5e43ee317105766b6209c18fd5242658e7f468cd4d8b67a36f634917834834
|
|
BLAKE2b-256 checksum How to use checksums |
3047e15a516463612eae9060df846c0bd26dd1987cd162ea546ad9cab77b03d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / langchain_omega-0.3.0-py3-none-any.whl
| Download URL | langchain_omega-0.3.0-py3-none-any.whl |
|---|---|
| Size | 16.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
57fda7e0e26bd4b9a5c829a387aef43fa422e7257baa98cc006b0fc7765abe69
|
|
BLAKE2b-256 checksum How to use checksums |
efd6a5036db9ac3bed0d7df70f9c6e75caca8928e1b094746b68ca530a946980
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|