Metadata-Version: 2.4
Name: langchain-omega
Version: 0.1.0
Summary: LangChain integration with OmegaEngine governance - callbacks, tools, and safety chains
Project-URL: Homepage, https://omegaengine.ai
Project-URL: Documentation, https://omegaengine.ai/docs
Project-URL: Repository, https://github.com/TheArkhitect/Omegaengine/tree/main/open-source-repos/langchain-omega
Author-email: OmegaEngine <team@omegaengine.ai>
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: ai-safety,audit,callback,compliance,governance,langchain,llm,omegaengine
Requires-Python: >=3.8
Requires-Dist: httpx>=0.24.0
Requires-Dist: langchain-core>=0.1.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Provides-Extra: openai
Requires-Dist: langchain-openai>=0.0.5; extra == 'openai'
Description-Content-Type: text/markdown

<p align="center">
  <img src="logo.png" alt="OmegaEngine Logo" width="200" height="200">
</p>

<h1 align="center">langchain-omega</h1>

<p align="center">
  <strong>LangChain Integration for OmegaEngine</strong>
</p>

<p align="center">
  <a href="https://pypi.org/project/langchain-omega/"><img src="https://img.shields.io/pypi/v/langchain-omega?color=blue&label=PyPI" alt="PyPI"></a>
  <a href="https://github.com/TheArkhitect/Omegaengine/actions"><img src="https://img.shields.io/github/actions/workflow/status/TheArkhitect/Omegaengine/ci.yml?branch=main" alt="CI"></a>
  <a href="https://github.com/TheArkhitect/Omegaengine/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-Apache%202.0-blue" alt="License"></a>
</p>

<p align="center">
  <a href="https://omegaengine.ai/docs">Documentation</a> •
  <a href="https://omegaengine.ai/playground">Playground</a> •
  <a href="https://github.com/TheArkhitect/Omegaengine/issues">Issues</a>
</p>

---

## ✨ 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

```bash
pip install langchain-omega
```

---

## 🚀 Quick Start

### Callback Handler

```python
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

```python
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

```python
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](LICENSE).

---

<p align="center">
  Built with ❤️ by the <a href="https://omegaengine.ai">OmegaEngine</a> team
</p>
