Metadata-Version: 2.4
Name: palqee-prisma-ai
Version: 0.5.0
Summary: LLM/ML Observability and Evaluation
Project-URL: Homepage, https://www.palqee.com/
Project-URL: Documentation, https://docs.palqee.com/docs/overview
Project-URL: Changelog, https://github.com/Palqee/prisma-ai/blob/main/CHANGELOG.md
Author-email: Hartley Jean-Aime <hartley@palqee.com>
License-Expression: MIT
Keywords: ai-evaluation,ai-monitoring,ai-observability,ai-validation,compliance,conduct-risk,financial-services,hallucination-detection,high-precision-instrumentation,human-in-the-loop,llm-evaluation,llm-observability,opentelemetry,oversight-intelligence,palqee,policy-adherence,prisma,regulatory-evidence,review-automation,risk-management,tracing
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27
Requires-Dist: opentelemetry-api>=1.20.0
Requires-Dist: opentelemetry-exporter-otlp>=1.20.0
Requires-Dist: opentelemetry-sdk>=1.20.0
Requires-Dist: palqee-prisma-client
Requires-Dist: palqee-prisma-otel
Requires-Dist: pydantic>=2.0.0
Provides-Extra: dev
Requires-Dist: build>=1.0.3; extra == 'dev'
Requires-Dist: commitizen>=3.10.0; extra == 'dev'
Requires-Dist: mypy>=1.0.0; extra == 'dev'
Requires-Dist: pre-commit>=3.6.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Requires-Dist: respx>=0.21; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Requires-Dist: twine>=4.0.2; extra == 'dev'
Description-Content-Type: text/markdown

<div align="center">
  <img width="2560" height="640" alt="palqee_prisma_banner_dark" src="https://github.com/user-attachments/assets/403f4b0a-d43c-4891-8cee-0f0d5c4a58ff"  alt="Palqee Prisma" />


  <p>The official Python SDK for <a href="https://www.palqee.com/">Palqee Prisma</a> — oversight intelligence built for regulated industries.</p>

  <p>
    <a href="https://pypi.org/project/palqee-prisma-ai/"><img src="https://img.shields.io/pypi/v/palqee-prisma-ai.svg" alt="PyPI version" /></a>
    <a href="https://pypi.org/project/palqee-prisma-ai/"><img src="https://img.shields.io/pypi/pyversions/palqee-prisma-ai.svg" alt="Python versions" /></a>
    <a href="https://pypi.org/project/palqee-prisma-ai/"><img src="https://img.shields.io/pypi/l/palqee-prisma-ai.svg" alt="License" /></a>
    <a href="https://docs.palqee.com/docs/overview"><img src="https://img.shields.io/badge/docs-palqee.com-blue.svg" alt="Documentation" /></a>
  </p>
</div>

---

## What is Prisma?

Prisma is Palqee's oversight intelligence platform: automated review and validation that **replaces manual evaluations** across human and AI workflows. It detects ambiguity, nuance, and violations — from AI hallucinations to failed policy steps — at full-population scale, and produces regulatory-grade evidence for stakeholders.

`palqee-prisma-ai` is the Python SDK that wires your application into Prisma. Instrument once, ship traces and evaluations to the platform, and inspect runs, scores, and routed cases in the dashboard.

### Built for regulated workflows

- **Customer complaints**, **financial crimes**, **disputes**, **conduct risk**, **credit risk**, **underwriting**, and **onboarding / customer risk**.
- Aligned with **CFPB**, **OCC**, **Federal Reserve**, **SEC**, **FINRA**, and equivalent regulators.
- **Self-hosted** — deployed on-premises or in your own VPC. No multi-tenant SaaS.

### Why teams pick Prisma

- **Cut review costs by up to 80%** — automated triage instead of full manual sampling.
- **100% coverage at runtime** — every interaction evaluated, not a 2% sample.
- **Custom validations for every risk** — define evaluators that match your policy, not a generic rubric.
- **Regulatory-grade evidence** — structured JSON / CSV output for audits and BI.
- **Human-in-the-loop** — high-risk cases routed to reviewers; feedback retrains the system.

## Installation

```bash
pip install palqee-prisma-ai
```

The package installs as `palqee-prisma-ai` on PyPI and imports as `palqee_prisma_ai`:

```python
import palqee_prisma_ai
```

Requires Python 3.10+.

## Quickstart

`palqee-prisma-ai` connects to a Prisma deployment in your own environment. Issue an API key from your Prisma instance and point the SDK at it — see the [setup guide](https://docs.palqee.com/docs/overview) for deployment, key issuance, and full configuration.

```python
import os
import palqee_prisma_ai

palqee_prisma_ai.init(
    "complaints-review",
    evaluators=["correctness", "hallucination", "policy_adherence"],
    api_key=os.environ["PALQEE_PRISMA_API_KEY"],
    base_url=os.environ["PALQEE_PRISMA_BASE_URL"],  # your Prisma deployment URL
)

# Your existing LLM / agent code — tracing and evaluation are now active.
from openai import OpenAI

client = OpenAI()
response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[{"role": "user", "content": "Summarize this complaint..."}],
)
print(response.choices[0].message.content)
```

Spans flow to Prisma with `run_id` and `project_id` attached, evaluators score every interaction server-side, and high-risk cases route to your reviewers.

## Configuration

| Parameter | Environment variable | Description |
|-----------|---------------------|-------------|
| `api_key` | `PALQEE_PRISMA_API_KEY` | Prisma API key (`pq_prisma_sk_...`) issued from your deployment |
| `base_url` | `PALQEE_PRISMA_BASE_URL` | Base URL of your Prisma deployment |
| `otel_endpoint` | `PALQEE_PRISMA_OTEL_ENDPOINT` | OTLP endpoint (auto-derived from `base_url` if omitted) |

Full configuration reference: [docs.palqee.com/docs/overview](https://docs.palqee.com/docs/overview).

With env vars set, `init()` collapses to one line:

```python
palqee_prisma_ai.init("complaints-review", evaluators=["correctness", "policy_adherence"])
```

## What gets traced

Prisma reads any OpenTelemetry span emitted by your process — including spans from popular LLM instrumentation libraries:

| Provider / framework | Instrumentation |
|----------------------|-----------------|
| OpenAI, Anthropic Claude, Meta Llama, Bedrock, Gemini | [OpenInference](https://github.com/Arize-ai/openinference) or [OpenLLMetry](https://github.com/traceloop/openllmetry) |
| LangChain, LangGraph | OpenInference / OpenLLMetry |
| LlamaIndex | OpenInference |
| CrewAI, AutoGen, Haystack | OpenLLMetry |
| Custom code | `opentelemetry-api` spans |

Install your instrumentation of choice alongside `palqee-prisma-ai` — it works out of the box.

## Evaluators

Pass evaluator names to `init()` and Prisma scores every interaction server-side:

```python
palqee_prisma_ai.init(
    "complaints-review",
    evaluators=["correctness", "hallucination", "toxicity", "policy_adherence"],
)
```

Custom thresholds and input mapping for domain-specific reviews:

```python
from palqee_prisma_ai import EvaluatorConfig, InputMapping

palqee_prisma_ai.init(
    "underwriting-agent",
    evaluators=[
        EvaluatorConfig(name="policy_adherence", threshold=0.9),
        EvaluatorConfig(name="hallucination", threshold=0.95),
    ],
    input_mapping=InputMapping(input="prompt", output="completion"),
)
```

See the [docs](https://docs.palqee.com/docs/overview) for the full evaluator catalog and bespoke evaluators for regulated workflows.

## Session API

`init()` returns a `PrismaSession` for inspecting or extending the active run:

```python
session = palqee_prisma_ai.init("complaints-review")

print(session.project.id, session.run.id)

session.end()  # otherwise auto-ended at process exit
```

Access the active session from anywhere in your process:

```python
from palqee_prisma_ai import get_session

session = get_session()
```

## Downstream integrations

Prisma exports structured results to the tools your risk, compliance, and analytics teams already use:

**BI & analytics** — Power BI · Tableau · Looker · Sisense
**Collaboration** — Slack · Microsoft Teams · Google Chat
**Models** — OpenAI · Anthropic Claude · Meta Llama

## Links

- **Documentation:** [docs.palqee.com/docs/overview](https://docs.palqee.com/docs/overview)
- **Website:** [palqee.com](https://www.palqee.com/)
- **Support:** [support@palqee.com](mailto:support@palqee.com)

## License

[MIT](./LICENSE) © Palqee
