LLM abstraction layer for the AIDu ecosystem.
Project description
aidu-ai-llm
Small Python LLM playground from PHBern to help people to understand how to build AI-Tutors
with:
- reusable LLM utilities under
src/aidu/ai/llm - a FastAPI chat backend in
serve/app.py - a minimal Vite frontend in
web/
Quick Example
pip install aidu-ai-llm aidu-support
then run the example app:
aidu-llm-example
Development Prerequisites
The following tools are required to build and run the project:
- make — for running common development and build tasks
- Python (>=3.11) — backend runtime
- uv (latest) — Python package manager and environment runner
- Node.js (>=18, includes npm) — required to build the frontend (TypeScript via Vite)
💡 Notes
uvreplacespip,venv, etc. → state of the art: no manual environment activation needednpmis included with Node.js, so you don’t need to install it separately
Quick Start
Copy .env_example to .env and add your OpenAI Token there.
When you have ensured the prerequisites, this should work. Clean up, install dependencies, build frontend, and run the server:
make clean # clean up python backend and web frontend
make web.install # install web frontend dependencies
make web.build # build web frontend
make install # install python dependencies
make serve # run FastAPI server
Open: http://localhost:8000
Then you can interact with the chat interface.
Project Layout
serve/
app.py FastAPI app (chat/session endpoints + static web mount)
src/aidu/ai/llm/
client.py OpenAI client wrapper
requester.py Base class interacting with ai client
builder.py Prompt template builder
safeformat.py Safe string formatting helpers
tool_registry.py Tool registration/execution helpers
spec.py Plugin spec definitions
evaluator.py Evaluator overloads Requestor
test/
curl_tests.sh Curl-based API smoke checks
web/
index.html Chat page shell
src/main.ts Browser chat logic
HELP.md License/help notes
Useful Commands
make smoke.client # runs smoke test on a individual file
make smoke.requester # runs smoke test on a individual file
make smoke.actor # runs smoke test on a individual file
make serve # run FastAPI server
make curl # run curl tests against above server
cd web && make clean # clean up web frontend
cd web && make install # install frontend deps
cd web && make build # build frontend
Notes
- Requires
OPENAI_API_KEYin your environment (or.env). - The frontend talks to the backend session endpoints under
/sessions/....
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 aidu_ai_llm-0.1.0.tar.gz.
File metadata
- Download URL: aidu_ai_llm-0.1.0.tar.gz
- Upload date:
- Size: 965.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76d360b7a0006385e3f1197508ede4ee4c62d12fb676f1924f00b443be6f58a2
|
|
| MD5 |
ff16487af0f38867ab9ed135595295c2
|
|
| BLAKE2b-256 |
69bf63811c3f17decfd7ea32962ad36a1aea054ddf7b4dac3fab4aab0ac19a09
|
File details
Details for the file aidu_ai_llm-0.1.0-py3-none-any.whl.
File metadata
- Download URL: aidu_ai_llm-0.1.0-py3-none-any.whl
- Upload date:
- Size: 1.0 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.22
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3afa0e379822a7e4c478f9d4081a5d5a3779ef54cff86e09ab8144dbfa831b8a
|
|
| MD5 |
6c52169864068b90ab6d47a8be695b30
|
|
| BLAKE2b-256 |
fc5abcc6daa2ba3018481dd250782ff6e980104733d8caf8fe96a33c561e5a5b
|