Skip to content

Chat: quickstart and chatbots info for students #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions docs/advanced/chatbot_agents/info.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# AI Chatbots - More information

Chatbot agents are AI Assistants that students can chat with to ask for help or further explanations regarding the Question that they are working on. Each Agent has its own personality and approach to assisting the students.

The Chatbots have at their basis a [Large Language Model (LLM)](https://en.wikipedia.org/wiki/Large_language_model) which received information regarding:

- the details of the Question the student is on currently,
- the answer and worked solutions for each Response Area of the Question,
- the student's progress on all parts of the Question,
- the students's current previewed part,
- the guidance time and tips form the lecturer.

---

## Available Chatbots

Currently the students have access to the following AI Chatbots. Many others are in development.

1. Informational Chatbot

This chatbot aims to complete all the relevant tasks the student requests based on the current Question they are working on. The Chatbot is aware of the Question details, answer, worked solution and guidance from the lecturer.

Some technical details:
<pre style="white-space: pre-wrap;">
<code>LLM model: GPT 4o mini [from OpenAI]
response time (on average): 10 seconds

Helping approach: encourages self-discovery of the answer, but will reveal the solution if requested
</code>
</pre>

## AI Chatbot Development

Are you interested in developing your own chatbot? Then please check out the [Quickstart guide](quickstart.md) to develop and deploy your own AI chat agent for Lambda Feedback.
12 changes: 4 additions & 8 deletions docs/advanced/chatbot_agents/local.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ docker run --env-file .env -it --name my-lambda-container -p 8080:8080 llm_chat
This will start the evaluation function and expose it on port `8080` and it will be open to be curl:

```bash
curl --location 'http://localhost:8080/2015-03-31/functions/function/invocations' --header 'Content-Type: application/json' --data '{"message":"hi","params":{"conversation_id":"12345Test","conversation_history": [{"type":"user","content":"hi"}]}}'
curl --location 'http://localhost:8080/2015-03-31/functions/function/invocations' \
--header 'Content-Type: application/json' \
--data '{"body":"{\"message\": \"hi\", \"params\": {\"conversation_id\": \"12345Test\", \"conversation_history\": [{\"type\": \"user\", \"content\": \"hi\"}]}}"}'
```

### Call Docker Container From Postman
Expand All @@ -56,13 +58,7 @@ http://localhost:8080/2015-03-31/functions/function/invocations
Body:

```JSON
{
"message":"hi",
"params":{
"conversation_id":"12345Test",
"conversation_history": [{"type":"user","content":"hi"}]
}
}
{"body":"{\"message\": \"hi\", \"params\": {\"conversation_id\": \"12345Test\", \"conversation_history\": [{\"type\": \"user\", \"content\": \"hi\"}]}}"}
```

Body with optional Params:
Expand Down
49 changes: 37 additions & 12 deletions docs/advanced/chatbot_agents/quickstart.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# Developing Chat Agents: Getting Started
# Developing Chat Functions: Getting Started

## What is a Chat Agent?
## What is a Chat Function?

It's a function which calls Large Language Models (LLMs) to respond to the student's messages given contxtual data:
It's a function which calls Large Language Models (LLMs) to respond to the student's messages given contextual data:

- question data
- user data such as past responses to the problem
Chatbot Agents capture and automate the process of assisting students during their learning process when outside of classroom.

Chat functions host a chatbot agent. Chatbot Agents capture and automate the process of assisting students during their learning process when outside of classroom.

## Getting Setup for Development

1. Get the code on your local machine (Using github desktop or the `git` cli)

- For new functions: clone the main repo for [lambda-chat](https://github.com/lambda-feedback/lambda-chat) and create a new branch. Then go under `scr/agents` and copy the `base_agent` folder.

- For new functions: clone the template repo for [chat-function-boilerplate](https://github.com/lambda-feedback/chat-function-boilerplate). **Make sure the new repository is set to public (it needs access to organisation secrets)**.
- For existing functions: please make your changes on a new separate branch

2. _If you are creating a new chatbot agent_, you'll need to set it's name as the folder name in `scr/agents` and its corresponding files.
3. You are now ready to start making changes and implementing features by editing each of the three main function-logic files:
2. _If you are creating a new chatbot agent_, can either edit the `scr/agents/base_agent` or copy it and rename it based on your agent's name.
3. You are now ready to start making changes and implementing features by editing each of the main function-logic files:

1. **`scr/agents/{base_agent}/{base}_agent.py`**: This file contains the main LLM pipeline using [LangGraph](https://langchain-ai.github.io/langgraph/) and [LangChain](https://python.langchain.com/docs/introduction/).

Expand Down Expand Up @@ -54,9 +54,11 @@ It's a function which calls Large Language Models (LLMs) to respond to the stude

2. **`scr/agents/{base_agent}/{base}_prompts.py`**: This is where you can write the system prompts that describe how your AI Assistant should behave and respond to the user.

3. Make sure to add your agent `invoke()` function to the `module.py` file.
3. _If you edited the agent file name_, make sure to add your agent `invoke()` function to the `module.py` file.

4. Update the `config.json` file with the chatbot's name.

4. Please add a `README.md` file to describe the use and behaviour of your agent.
5. Please add a `README.md` file to describe the use and behaviour of your agent.

4. Changes can be tested locally by running the pipeline tests using:
```bash
Expand All @@ -65,6 +67,29 @@ It's a function which calls Large Language Models (LLMs) to respond to the stude
[Running and Testing Agents Locally](local.md){ .md-button }


5. Merge commits into any branch (except main) will trigger the `dev.yml` workflow, which will build the docker image, push it to a shared `dev` ECR repository to make the function available from the `dev` and `localhost` client app.
5. Merge commits into dev branch will trigger the `dev.yml` workflow, which will build the docker image, push it to a shared `dev` ECR repository and deploy an AWS Lambda function for the `dev` client app to call. In order to make your new chatbot available on the `dev` environment of the Lambda Feedback platform, you will have to get in contact with the ADMINS on the platform.

6. You can now test the deployed chat function using your preferred request client (such as [Insomnia](https://insomnia.rest/) or [Postman](https://www.postman.com/) or simply `curl` from a terminal). `DEV` Functions are made available at:
```url
https://57glfwwf7d.execute-api.eu-west-2.amazonaws.com/default/chat/<function name as defined in config.json>
```

6. In order to make your new chatbot available on the LambdaFeedback platform, you will have to get in contact with the ADMINS on the platform.
!!! example "Example Request to chatFunctionBoilerplate-dev"
curl --location 'https://57glfwwf7d.execute-api.eu-west-2.amazonaws.com/default/chat/chatFunctionBoilerplate-dev' \
--header 'Content-Type: application/json' \
--data '{
"message": "hi",
"params": {
"conversation_id": "12345Test",
"conversation_history": [
{
"type": "user",
"content": "hi"
}
]
}
}'

6. Once the `dev` chatbot is fully tested, you can merge the code to the default branch (`main`). This will trigger the `main.yml` workflow, which will deploy the `staging` and `prod` versions of your chatbot. Please contact the ADMIN to provide the URLS for the `staging` and `prod` versions of your agent.

6. In order to make your new chatbot available on any of the environments of the Lambda Feedback platform, you will have to get in contact with the ADMINS on the platform.
15 changes: 10 additions & 5 deletions docs/student/getting_started_student.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,20 @@ See the [Answering Questions](answering_questions.md) page for more help with an

### Using the Workspace

The Workspace provides you with various functionalities to assist you during your learning process:
1. #### Canvas:
The Workspace provides you with various functionalities to assist you during your learning process. Your edits and progress in the Workspace are saved per each Question you preview. So, you will be able to view your old edits for the Question you are currently on.

Here are the various functionalities:

#### Canvas:
A pane where you can write down your thought process and notes for the previewed question (handwriting, sticky notes & text).

![Canvas Interface](images/canvas_interface.png)

2. #### Chat:
A chat interface connecting you with helpful AI Chatbots to discuss any questions you have on the current topic you are working on.
#### Chat:
A chat interface connecting you with helpful Chatbots. Chatbot agents are AI Assistants that you can chat with to ask for help or further explanations regarding the Question that you are working on.

![Chat Interface](images/chat_interface.png)

Your edits and progress in the Workspace are saved per each Question you preview. So, you will be able to view your old edits for the Question you are currently on.
For more information on what the chatbot knows about you and how you can use it to its full potential:

[Chatbot Agents - More Info](../advanced/chatbot_agents/info.md){ .md-button .md-button--primary}
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ nav:
- Chat agents:
- Quickstart: "advanced/chatbot_agents/quickstart.md"
- Testing Functions Locally: "advanced/chatbot_agents/local.md"
- Chat Agents Information: "advanced/chatbot_agents/info.md"

# Configuration
theme:
Expand Down