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: README.md
+45-12Lines changed: 45 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -95,13 +95,20 @@ You agent can be based on an LLM hosted anywhere, you have available currently O
95
95
main.yml # deploys the STAGING function to Lambda Feedback
96
96
test-report.yml # gathers Pytest Report of function tests
97
97
98
+
docs/ # docs for devs and users
99
+
98
100
src/module.py # chat_module function implementation
99
101
src/module_test.py # chat_module function tests
100
102
src/agents/ # find all agents developed for the chat functionality
101
103
src/agents/utils/test_prompts.py # allows testing of any LLM agent on a couple of example inputs containing Lambda Feedback Questions and synthetic student conversations
102
104
```
103
105
104
-
## Run the Chat Script
106
+
107
+
## Testing the Chat Function
108
+
109
+
To test your function, you can either call the code directly through a python script. Or you can build the respective chat function docker container locally and call it through an API request. Below you can find details on those processes.
110
+
111
+
### Run the Chat Script
105
112
106
113
You can run the Python function itself. Make sure to have a main function in either `src/module.py` or `index.py`.
107
114
@@ -114,25 +121,25 @@ You can also use the `testbench_agents.py` script to test the agents with exampl
114
121
python src/agents/utils/testbench_agents.py
115
122
```
116
123
117
-
### Building the Docker Image
124
+
### Calling the Docker Image Locally
118
125
119
126
To build the Docker image, run the following command:
120
127
121
128
```bash
122
129
docker build -t llm_chat .
123
130
```
124
131
125
-
### Running the Docker Image
132
+
####Running the Docker Image
126
133
127
134
To run the Docker image, use the following command:
128
135
129
-
#### Without .env file:
136
+
##### A. Without .env file:
130
137
131
138
```bash
132
139
docker run -e OPENAI_API_KEY={your key} -e OPENAI_MODEL={your LLM chosen model name} -p 8080:8080 llm_chat
133
140
```
134
141
135
-
#### With container name (for interaction, e.g. copying file from inside the docker container):
142
+
##### B. With container name (for interaction, e.g. copying file from inside the docker container):
136
143
137
144
```bash
138
145
docker run --env-file .env -it --name my-lambda-container -p 8080:8080 llm_chat
@@ -143,18 +150,23 @@ This will start the chat function and expose it on port `8080` and it will be op
In the `src/agents/utils` folder you can find the `requests_testscript.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.
160
+
161
+
##### B. Call Docker Container through API request
In the `src/agents/utils` folder you can find the `requests_test.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.
182
-
183
191
### Deploy to Lambda Feedback
184
192
185
193
Deploying the chat function to Lambda Feedback is simple and straightforward, as long as the repository is within the [Lambda Feedback organization](https://github.com/lambda-feedback).
@@ -206,3 +214,28 @@ Make sure that all run-time dependencies are installed in the Docker image.
206
214
- System packages: If you need to install system packages, add the installation command to the Dockerfile.
207
215
- ML models: If your chat function depends on ML models, make sure to include them in the Docker image.
208
216
- Data files: If your chat function depends on data files, make sure to include them in the Docker image.
217
+
218
+
### Pull Changes from the Template Repository
219
+
220
+
If you want to pull changes from the template repository to your repository, follow these steps:
*Brief description of what this chat function does, from the developer perspective*
3
+
4
+
## Inputs
5
+
*Specific input parameters which can be supplied when the calling this chat function.*
6
+
7
+
## Outputs
8
+
*Output schema/values for this function*
9
+
10
+
## Examples
11
+
*List of example inputs and outputs for this function, each under a different sub-heading*
12
+
13
+
## Testing the Chat Function
14
+
15
+
To test your function, you can either call the code directly through a python script. Or you can build the respective chat function docker container locally and call it through an API request. Below you can find details on those processes.
16
+
17
+
### Run the Chat Script
18
+
19
+
You can run the Python function itself. Make sure to have a main function in either `src/module.py` or `index.py`.
20
+
21
+
```bash
22
+
python src/module.py
23
+
```
24
+
25
+
You can also use the `testbench_agents.py` script to test the agents with example inputs from Lambda Feedback questions and synthetic conversations.
26
+
```bash
27
+
python src/agents/utils/testbench_agents.py
28
+
```
29
+
30
+
### Calling the Docker Image Locally
31
+
32
+
To build the Docker image, run the following command:
33
+
34
+
```bash
35
+
docker build -t llm_chat .
36
+
```
37
+
38
+
#### Running the Docker Image
39
+
40
+
To run the Docker image, use the following command:
41
+
42
+
##### A. Without .env file:
43
+
44
+
```bash
45
+
docker run -e OPENAI_API_KEY={your key} -e OPENAI_MODEL={your LLM chosen model name} -p 8080:8080 llm_chat
46
+
```
47
+
48
+
##### B. With container name (for interaction, e.g. copying file from inside the docker container):
49
+
50
+
```bash
51
+
docker run --env-file .env -it --name my-lambda-container -p 8080:8080 llm_chat
52
+
```
53
+
54
+
This will start the chat function and expose it on port `8080` and it will be open to be curl:
In the `src/agents/utils` folder you can find the `requests_testscript.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.
66
+
67
+
##### B. Call Docker Container through API request
0 commit comments