Async GPT helpers and the Fast Streaming Agent runtime used across AFASAsk projects.
Project description
pitchai-gpt (lib_agents)
Reusable GPT helpers and the Fast Streaming Agent runtime that power AFASAsk deployments. The package bundles two major pieces of functionality:
lib_agents.gpt/lib_agents.gpt_root: async GPT helpers with smart prompt loading, Gemini/OpenRouter/Groq/Azure routing, and streaming support.lib_agents.fast_streaming_agent_root: the Fast Streaming Agent runtime for dataframe-aware copilots, including dataframe loading, semantic-layer hooks, and templated UI helpers.
Both modules are designed to be shared between repositories (e.g. AFASAsk and AI Price Crawler) so they can evolve in one place and be installed through PyPI. The distribution on PyPI is called pitchai-gpt, but it exposes the lib_agents Python package to avoid breaking existing imports.
Installation
uv pip install pitchai-gpt
# or
pip install pitchai-gpt
Environment variables
The GPT helpers expect API keys/endpoints to be provided through environment variables (or by passing api_key= directly when instantiating GPT). The most commonly used variables are:
| Provider | Variables |
|---|---|
| Azure OpenAI | AZURE_OPENAI_API_KEY, AZURE_OPENAI_GPT4O_ENDPOINT, AZURE_OPENAI_GPT4O_MINI_ENDPOINT, AZURE_OPENAI_O3_ENDPOINT, AZURE_OPENAI_GPT5_MINI_ENDPOINT, AZURE_OPENAI_API_VERSION |
| Gemini | GEMINI_API_KEY_GENERAL or GEMINI_API_KEY, optional GEMINI_API_BASE_URL |
| Groq | GROQ_API_KEY |
| OpenRouter | OPENROUTER_API_KEY |
The streaming agent runtime reads configuration from YAML/JSON prompt files, optionally loads .env files via python-dotenv, and integrates with Pandas/Polars. Make sure your application provides any referenced config modules (e.g. configs.server_config, libs.lib_utils).
Usage
from lib_agents.gpt.gpt import GPT
gpt = GPT(
sys_msg="You are a concise assistant.",
user_msg="Say READY",
model="gemini-2.0-flash",
)
response, *_ = asyncio.run(gpt.run())
print(response)
For streaming agents see lib_agents.fast_streaming_agent_root.main.FastStreamingAgent and the demos under apps/web_app.
Development
This project uses Hatch via uv for building and publishing. See docs/uv_pypi_publish.md in the monorepo for a step-by-step release checklist.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pitchai_gpt-0.2.0.tar.gz.
File metadata
- Download URL: pitchai_gpt-0.2.0.tar.gz
- Upload date:
- Size: 104.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73661e0f6364915ef2ee5ffecc9dc361827418f7d7ede22664677991eaf06853
|
|
| MD5 |
8478a5bbe86c8c1ff47ce3fc66a881bb
|
|
| BLAKE2b-256 |
a6d3bd61b406a9c439183ad9e1a44359e285713730965b8abee136510102aafa
|
File details
Details for the file pitchai_gpt-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pitchai_gpt-0.2.0-py3-none-any.whl
- Upload date:
- Size: 126.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ffdbffc5f6c488a7954788da899c4e70d698c9b17a55950b8566ca39814db6e
|
|
| MD5 |
0dfc7f600c144c35f0931576fa95afa4
|
|
| BLAKE2b-256 |
105de0b5f3020c460008157f6b7ca3d356795f3d8fa859e7b35ac3b3ca7534f6
|