Skip to main content

omnismart-personas

License: AGPL v3 Role-based, data-scoped LLM persona templates + router for production analytics copilots. The pattern behind IntelAI's 9-persona RAG copilot, extracted as a tiny, zero-dependency, pure-Python library.

A persona pairs a system prompt with a data-access scope (which business domains it may see) and a sampling temperature — so the same retrieval system can answer through different role-conditioned prompts and data filters ("persona-routed RAG").

Install

pip install omnismart-personas

Use

from omnismart_personas import persona_for_role, scope_records, build_rag_prompt

persona = persona_for_role("cfo")          # → CFO persona (scope: Finance, Growth)
persona.can_access("People")               # False — out of scope

rows = [
    {"category": "Finance", "metric": "gross_margin", "value": 0.42},
    {"category": "People",  "metric": "headcount",    "value": 220},
]
visible = scope_records(persona, rows)     # drops the People row

prompt = build_rag_prompt(
    persona,
    "What drove the Q1 gross-margin change?",
    [f"{r['metric']}={r['value']}" for r in visible],
    language="en",
)
# → send `prompt` to any LLM

API

  • list_personas() → the 9 persona keys
  • get_persona(name) / persona_for_role(role) → a Persona
  • Persona(name, display_name, system_prompt, allowed_tools, data_access, temperature) — immutable; .can_access(domain)
  • scope_records(persona, records, domain_key="category") → records in scope
  • build_system_prompt(persona, *, language="en", extra=None)
  • build_rag_prompt(persona, query, snippets, *, language="en")

Personas: ceo, cfo, cto, coo, chro, esg, risk, analyst, general.

LangChain

Use the personas in any LangChain RAG chain — pip install "omnismart-personas[langchain]":

from omnismart_personas import persona_for_role
from omnismart_personas.langchain import persona_chat_prompt, persona_retriever_filter
from langchain_openai import ChatOpenAI
from langchain_core.output_parsers import StrOutputParser

persona = persona_for_role("cfo")
prompt = persona_chat_prompt(persona)               # system = scope; {context} + {question}
chain = prompt | ChatOpenAI(model="gpt-4o-mini") | StrOutputParser()

docs = persona_retriever_filter(persona, retriever.invoke(q))   # RBAC on retrieved docs
answer = chain.invoke({"context": "\n".join(d.page_content for d in docs), "question": q})

persona_retriever_filter drops Documents whose metadata["category"] is outside the persona's data_access scope — the same role boundaries, enforced in your LangChain pipeline.

Test

pip install -e ".[test]" && pytest

AGPL-3.0 licensed. Part of the IntelAI project.

⚖️ License & Enterprise Use (Dual-License)

This project is open-source under the AGPL-3.0 License. It is completely free for researchers, students, and open-source hobbyists.

Commercial Use: The AGPLv3 license requires that any proprietary network service (SaaS, internal corporate tools) that uses or modifies this code must also open-source its entire backend.

If you wish to use this framework in a closed-source commercial environment, or require Enterprise features (SSO, Active Directory, Custom VPC Deployment, Strict RBAC), you must obtain a Commercial License. Please reach out to discuss commercial licensing and integration consulting.

📡 Anonymous Telemetry

This project collects anonymous, GDPR-compliant startup pings to help the author understand usage volume and prioritize development.

  • What is collected: Only the project name and a "startup" event timestamp. No PII, no API keys, no user data.
  • How to disable: We respect your privacy. To opt-out, simply set TELEMETRY_OPT_OUT=true in your .env file.

Licensing

This project is licensed under the AGPL-3.0 License.

Commercial Use: If you wish to use this software commercially without releasing your own source code, please see COMMERCIAL.md to obtain a commercial license.

Metadata

Release files for omnismart-personas 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for omnismart-personas 0.1.6
File Size Uploaded
omnismart_personas-0.1.6.tar.gz 21.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for omnismart-personas 0.1.6
File Interpreter ABI Platform
omnismart_personas-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 42.6 kB

Release files / omnismart_personas-0.1.6.tar.gz

Download URL omnismart_personas-0.1.6.tar.gz
Size 21.1 kB
Tags Source
SHA-256 checksum
How to use checksums
be4ce515dd6c9a52b75ef1e1c9bb932b3e7b7e05910a5e6fc81984e0d6f5991e
BLAKE2b-256 checksum
How to use checksums
70b0f06f1265f7fc4059b42bfcd7b749fe2996a49c1eecf9fd1ed50db2ebbc49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / omnismart_personas-0.1.6-py3-none-any.whl

Download URL omnismart_personas-0.1.6-py3-none-any.whl
Size 21.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f6a92c0650501c0f6f27b8a38ff9cbdb1f7bb64419a258c47be2318d7d17d5a8
BLAKE2b-256 checksum
How to use checksums
6d121318e7c120dd57456ef07a51787a0c4422572c4dff6e359e91e06c852a2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

0.1.7

2 release files

This release

0.1.6 This release

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page