Skip to main content

Persona- and RAG-based intake SDK (prototype)

Project description

ai_intake_bot

Minimal SDK for persona-based and RAG-based conversational intake.

What this repo is: an SDK, not an app. No data persistence, no auth system, no background jobs.

Quickstart (persona mode with FakeLLM)

  • Create a venv and install deps:

    python -m venv .venv source .venv/bin/activate python -m pip install -U pip pip install -e ".[dev]"

  • Example (persona, expert_eval) using the FakeLLM for deterministic results:

from ai_intake_bot.core.engine import IntakeBot
from ai_intake_bot.core.llm import FakeLLM

bot = IntakeBot(
    mode="persona",
    template="expert_eval",
    persona="expert_reviewer",
    problem={"description": "Cannot login", "emotional_state": "frustrated", "goals": ["restore access"]},
    api_key="sk-test",
    qdrant_url=None,
    qdrant_api_key=None,
    files=None,
    selection_probability=0.5,
    enable_alerts=True,
    extra_system_prompt=None,
)
bot.set_llm(FakeLLM())
out = bot.handle("Please evaluate this scenario")
print(out)

Using a real LLM (OpenAI)

  • This SDK supports optional, explicit use of a real LLM. It will only call an LLM when you inject one via IntakeBot.set_llm() (so the default is safe for local development and tests).

  • To use OpenAI's API, set OPENAI_API_KEY in your environment and then:

from ai_intake_bot.core.engine import IntakeBot
from ai_intake_bot.core.llm import OpenAIChatLLM

llm = OpenAIChatLLM(model="gpt-4o")
bot = IntakeBot(...)
bot.set_llm(llm)
response = bot.handle("Ask something")

Security model: the SDK never persists secrets to disk. OpenAIChatLLM expects OPENAI_API_KEY to be set and will not log its value.

RAG with Qdrant (dev-friendly)

  • The RAG engine uses a LocalVectorStore by default; if you provide qdrant_url when constructing IntakeBot, the RAG engine will upload chunks to the configured Qdrant instance (ephemeral collection by default) and ground responses on the retrieved documents.

  • For a full integration with LangChain and Qdrant follow the example in scripts/run_qdrant_integration.sh (this script starts a Qdrant Docker container and runs the Qdrant integration test). The integration requires langchain_qdrant, langchain_openai, and an OpenAI key for embeddings.

Demos

  • scripts/demo_persona_openai.py — Runs an expert_eval persona using OpenAI (requires OPENAI_API_KEY).

  • scripts/demo_rag_qdrant.py — Ingests a PDF using LangChain's PyPDFLoader, splits with RecursiveCharacterTextSplitter, embeds with OpenAIEmbeddings, writes to Qdrant (requires QDRANT_URL and OPENAI_API_KEY), and performs a retrieval + chat.

  • scripts/demo_tts.py — Demonstrates the TTS adapters. Prefers macOS say, falls back to pyttsx3, and ultimately to a no-op adapter.

Run demos (examples):

  • Persona demo (OpenAI):

    export OPENAI_API_KEY=<your_key> python scripts/demo_persona_openai.py

  • RAG demo (Qdrant + LangChain):

    export OPENAI_API_KEY=<your_key> export QDRANT_URL=http://localhost:6333 python scripts/demo_rag_qdrant.py

  • TTS demo (local):

    python scripts/demo_tts.py

Security reminder: never commit real API keys. Use .env files for local testing and set CI secrets for integration runs.

AI_INTake

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ai_intake_bot-0.1.0.tar.gz (22.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ai_intake_bot-0.1.0-py3-none-any.whl (22.0 kB view details)

Uploaded Python 3

File details

Details for the file ai_intake_bot-0.1.0.tar.gz.

File metadata

  • Download URL: ai_intake_bot-0.1.0.tar.gz
  • Upload date:
  • Size: 22.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for ai_intake_bot-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b587e4c1d673bf8158f67008e2c2a4355f00be67752bc9c09feaaee56f9bcfa2
MD5 ed5589d50bdf28ea3967308c1e5f7736
BLAKE2b-256 5cfe9e5a48b61e4a142ac2b4da1fae6b88b899e679cd41ae9360c4da0dfc4882

See more details on using hashes here.

File details

Details for the file ai_intake_bot-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ai_intake_bot-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 22.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for ai_intake_bot-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f17d64867196f61d5177b5a58a55ccfe3ee50aedd343e9cae7525ed5dbc4d0f7
MD5 8c9ff5c93c58ff3a93e2208b3983b4d1
BLAKE2b-256 960e2c9eaab4aee879bf75e866c4e5455c930039c63f106d9c666d7f3f927c17

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page