You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AGENTS.md
+22-16Lines changed: 22 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,13 +4,13 @@ This file provides guidance to AI agents when working with code in this reposito
4
4
5
5
## Project Overview
6
6
7
-
This is a boilerplate for creating AI educational chatbots that integrate with the **Lambda-Feedback** educational platform. It deploys as an AWS Lambda function (containerized via Docker) that receives student chat messages with educational context and returns LLM-powered chatbot responses. Incoming requests follow the [muEd API](https://mued.org/) schema (`context`, `user`, `messages`).
7
+
This is a boilerplate for creating AI educational chatbots that integrate with the **Lambda-Feedback** educational platform. It's containerized via Docker and deployed behind [shimmy](https://github.com/lambda-feedback/shimmy), a shim that spawns this function as a persistent JSON-RPC worker process and exposes it as the muEd `/chat` / `/chat/health` HTTP API (both locally and as an AWS Lambda container). It receives student chat messages with educational context and returns LLM-powered chatbot responses. Incoming requests follow the [muEd API](https://mued.org/) schema (`context`, `user`, `messages`).
8
8
9
9
## Commands
10
10
11
11
**Testing:**
12
12
```bash
13
-
pytest # Run all unit tests
13
+
PYTHONPATH=. pytest # Run all unit tests (CI sets PYTHONPATH=. too)
14
14
python tests/manual_agent_run.py # Test agent locally with example inputs
15
15
python tests/manual_agent_requests.py # Test running Docker container
Copy file name to clipboardExpand all lines: CLAUDE.md
+22-16Lines changed: 22 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,13 +4,13 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
4
4
5
5
## Project Overview
6
6
7
-
This is a boilerplate for creating AI educational chatbots that integrate with the **Lambda-Feedback** educational platform. It deploys as an AWS Lambda function (containerized via Docker) that receives student chat messages with educational context and returns LLM-powered chatbot responses. Incoming requests follow the [muEd API](https://mued.org/) schema (`context`, `user`, `messages`).
7
+
This is a boilerplate for creating AI educational chatbots that integrate with the **Lambda-Feedback** educational platform. It's containerized via Docker and deployed behind [shimmy](https://github.com/lambda-feedback/shimmy), a shim that spawns this function as a persistent JSON-RPC worker process and exposes it as the muEd `/chat` / `/chat/health` HTTP API (both locally and as an AWS Lambda container). It receives student chat messages with educational context and returns LLM-powered chatbot responses. Incoming requests follow the [muEd API](https://mued.org/) schema (`context`, `user`, `messages`).
8
8
9
9
## Commands
10
10
11
11
**Testing:**
12
12
```bash
13
-
pytest # Run all unit tests
13
+
PYTHONPATH=. pytest # Run all unit tests (CI sets PYTHONPATH=. too)
14
14
python tests/manual_agent_run.py # Test agent locally with example inputs
15
15
python tests/manual_agent_requests.py # Test running Docker container
Copy file name to clipboardExpand all lines: README.md
+20-13Lines changed: 20 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -113,7 +113,6 @@ The agent uses **two separate LLM instances** — `self.llm` for chat responses
113
113
├── manual_agent_run.py # allows testing of any LLM agent on a couple of example inputs
114
114
├── utils.py # shared test helpers
115
115
├── test_example_inputs.py # pytests for the example input files
116
-
├── test_index.py # pytests
117
116
└── test_module.py # pytests
118
117
```
119
118
@@ -124,18 +123,18 @@ To test your function, you can run the unit tests, call the code directly throug
124
123
125
124
### Run Unit Tests
126
125
127
-
You can run the unit tests using `pytest`.
126
+
You can run the unit tests using `pytest`. Run it from the repository root with `PYTHONPATH=.` set (as CI does) so the `tests` and `src` packages resolve correctly:
128
127
129
128
```bash
130
-
pytest
129
+
PYTHONPATH=. pytest
131
130
```
132
131
133
132
### Run the Chat Script
134
133
135
-
You can run the Python function itself. Make sure to have a main function in either `src/module.py`or `index.py`.
134
+
You can run the Python function itself directly — `index.py` wires `chat_module`/`chat_health_module` into `lf_toolkit`'s RPC server, the same way shimmy invokes it inside the container. This requires the `EVAL_IO`/`EVAL_RPC_TRANSPORT` environment variables shimmy would normally set (see `lf_toolkit`'s docs), so prefer the Docker or `manual_agent_run.py` routes below for everyday testing.
136
135
137
136
```bash
138
-
python src/module.py
137
+
python index.py
139
138
```
140
139
141
140
You can also use the `manual_agent_run.py` script to test the agents with example inputs from Lambda Feedback questions and synthetic conversations.
@@ -167,33 +166,41 @@ docker run -e OPENAI_API_KEY={your key} -e OPENAI_MODEL={your LLM model name} -p
167
166
docker run --env-file .env -it --name my-lambda-container -p 8080:8080 llm_chat
168
167
```
169
168
170
-
This will start the chat function and expose it on port `8080`and it will be open to be curl:
169
+
This starts shimmy (the [Lambda Feedback shim](https://github.com/lambda-feedback/shimmy)) as the container's entrypoint, which spawns this function as a worker subprocess and exposes it on port `8080`as the muEd chat API:
In the `tests/` folder you can find the `manual_agent_requests.py` script that calls the POST URL of the running docker container. It reads any kind of input files with the expected schema. You can use this to test your curl calls of the chatbot.
188
+
In the `tests/` folder you can find the `manual_agent_requests.py` script that calls the `/chat` and `/chat/health` routes of the running docker container. It reads any kind of input files with the expected schema. You can use this to test your curl calls of the chatbot.
182
189
183
190
##### B. Call Docker Container through API request
Per the [muEd `ChatRequest` schema](https://mued.org/), only `messages` is required; `conversationId`, `user`, `context`, and `configuration` are all optional.
198
+
Per the [muEd `ChatRequest` schema](https://mued.org/), only `messages` is required; `conversationId`, `user`, `context`, and `configuration` are all optional. Requests may include an `X-Api-Version: 0.1.0` header.
192
199
193
-
**Minimal request — only required components** (stringified within `body` for the AWS Lambda Runtime Interface Emulator):
Copy file name to clipboardExpand all lines: docs/dev.md
+17-9Lines changed: 17 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,10 +16,10 @@ To test your function, you can run the unit tests, call the code directly throug
16
16
17
17
### Run Unit Tests
18
18
19
-
You can run the unit tests using `pytest`.
19
+
You can run the unit tests using `pytest`. Run it from the repository root with `PYTHONPATH=.` set (as CI does) so the `tests` and `src` packages resolve correctly:
20
20
21
21
```bash
22
-
pytest
22
+
PYTHONPATH=. pytest
23
23
```
24
24
25
25
### Run the Chat Script
@@ -53,31 +53,39 @@ docker run -e OPENAI_API_KEY={your key} -e OPENAI_MODEL={your LLM chosen model n
53
53
docker run --env-file .env -it --name my-lambda-container -p 8080:8080 llm_chat
54
54
```
55
55
56
-
This will start the chat function and expose it on port `8080`and it will be open to be curl:
56
+
This starts shimmy (the [Lambda Feedback shim](https://github.com/lambda-feedback/shimmy)) as the container's entrypoint, which spawns this function as a worker subprocess and exposes it on port `8080`as the muEd chat API:
In the `tests/` folder you can find the `manual_agent_requests.py` script that calls the POST URL of the running docker container. It reads any kind of input files with the expected schema. You can use this to test your curl calls of the chatbot.
75
+
In the `tests/` folder you can find the `manual_agent_requests.py` script that calls the `/chat` and `/chat/health` routes of the running docker container. It reads any kind of input files with the expected schema. You can use this to test your curl calls of the chatbot.
68
76
69
77
##### B. Call Docker Container through API request
0 commit comments