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-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.3.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.3-py3-none-any.whl (1.1 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aidu_ai_llm-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 0367b80c0a7280ed3ecdf1b138a9c4c716a5901ff0317cffd368a82a0931429f
MD5 2a39368a4b56e8e8b300bb636a73c49d
BLAKE2b-256 5561e722f750f1a352ae12c491059c71be26f9f925c0a5b4194849199482fbd4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for aidu_ai_llm-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f42d0b63b815604c12f3a2d3a828858ed0bebeaa01be1db99a570ff5833217f9
MD5 c84202c49c00dd17f7e0ea65458272cf
BLAKE2b-256 2700de6205af7cde9d9425165480bfa628f2b58c9dd6a7185791344573086c0f

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