Skip to main content

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-ai-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

  • uv replaces pip, venv, etc. → state of the art: no manual environment activation needed
  • npm is 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.

Chat interface screenshot

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_KEY in your environment (or .env).
  • The frontend talks to the backend session endpoints under /sessions/....

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

aidu_ai_llm-0.1.6.tar.gz (1.0 MB view details)

Uploaded Source

Built Distribution

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

aidu_ai_llm-0.1.6-py3-none-any.whl (1.1 MB view details)

Uploaded Python 3

File details

Details for the file aidu_ai_llm-0.1.6.tar.gz.

File metadata

  • Download URL: aidu_ai_llm-0.1.6.tar.gz
  • Upload date:
  • Size: 1.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.22

File hashes

Hashes for aidu_ai_llm-0.1.6.tar.gz
Algorithm Hash digest
SHA256 eb9ef5fa588a5187ce70fbd1f9c8455a404aee3e4315601a096d18798ec648d9
MD5 955c6d395ffc2fef5f8702e438dc813c
BLAKE2b-256 03c12b14d166889881d462e2757704b2030cc0c7bb5f5acb997576b395569bcd

See more details on using hashes here.

File details

Details for the file aidu_ai_llm-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for aidu_ai_llm-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 c1d28c0e0db59bb5c1adb21b2cfc27f5c0505a90e5b6a18736feb72edb194342
MD5 001bf4a4c21adf83ff332903324b2a0c
BLAKE2b-256 af57e4a580135128607de479d96dc410e3e10e93dbff90356fd3a9d7445077cb

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