-
Notifications
You must be signed in to change notification settings - Fork 5
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
Changes from all commits
8edc91d
1c80dc2
0b15c25
65a032d
4785d9c
0559ba5
4395644
d228c4b
e650b10
cb0366b
6f06b39
0badc0d
b96dcfb
0ff307e
6f90fcd
54c54e6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # Chat Functions - More information | ||
|
|
||
| Chat functions are the microservices that Lambda Feedback calls to provide the underlying functionality of a chatbot. Students can chat with the chatbots and ask for help or further explanations regarding the Question that they are working on. Each chatbot 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 raw markdown content of the question the student is on currently, including: | ||
| - the question name, number and content | ||
| - the final answer, structured tutorial, and worked solutions of the question | ||
| - the guidance (blurb and time estimate) form the teacher for the question | ||
| - the set name, number and description | ||
| - all parts with their number, content and done status (current part emphasised) | ||
| - all response areas and their respective expected answers | ||
| - the progress of the student on all parts of the Question, including: | ||
| - the total number of responses and the number of wrong responses the student has made for each response area | ||
| - the last responses the student has made for each response area and the received feedback | ||
| - the time duration the student has spent on the respective question and current part on that day | ||
|
|
||
| --- | ||
|
|
||
| ## Available Chat functions | ||
|
|
||
| Currently the students have access to the following chat functions that host their own specific chatbot. Many others are in development. | ||
|
|
||
| Click on the links below for information on each chatbot: | ||
|
|
||
| [1. Informational Chatbot](https://github.com/lambda-feedback/informationalChatFunction/blob/main/docs/user.md) | ||
|
|
||
|
|
||
| [2. Concise Chatbot](https://github.com/lambda-feedback/conciseChatFunction/blob/main/docs/user.md) | ||
|
|
||
|
|
||
| [3. Reflective Chatbot](https://github.com/lambda-feedback/reflectiveChatFunction/blob/main/docs/user.md) | ||
|
|
||
|
|
||
| ## Chat Function Development | ||
|
|
||
| Are you interested in developing your own chatbot? Then check out the [Quickstart guide](quickstart.md) to develop and deploy your own AI chat function for Lambda Feedback. |
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -1,27 +1,27 @@ | ||||
| # 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: | ||||
| A chat function is a function which calls Large Language Models (LLMs) to respond to the messages of students given contextual data: | ||||
|
|
||||
| - question data | ||||
| - user data such as past responses to the problem | ||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. link to the info page with a full listing? |
||||
| Chatbot Agents capture and automate the process of assisting students during their learning process when outside of classroom. | ||||
|
|
||||
| Chat functions host a chatbot. Chatbots 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_, you can either edit the `src/agents/base_agent` or copy it and rename it based on the name of your chatbot. | ||||
| 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/). | ||||
| 1. **`src/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/). | ||||
|
|
||||
| - the agent expects the following inputs when it being called: | ||||
| - the chat function expects the following arguments when it being called: | ||||
|
|
||||
| Body with necessary Params: | ||||
|
|
||||
|
|
@@ -52,19 +52,44 @@ 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. | ||||
| 2. **`src/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. _If you edited the chatbot agent file name_, make sure to add your chatbot `invoke()` function to the `module.py` file. | ||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If agent is the right word, fine (because that's how it's coded), but it's still confusing
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes it has got confusing. I have noted down that once I go back to modelling the boilerplate for chat functions with Marcus, then I will update all those instructions. |
||||
|
|
||||
| 3. Make sure to add your agent `invoke()` function to the `module.py` file. | ||||
| 4. Update the `config.json` file with the name of the chat function. | ||||
|
|
||||
| 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 chatbot. | ||||
|
|
||||
| 4. Changes can be tested locally by running the pipeline tests using: | ||||
| ```bash | ||||
| pytest src/module_test.py | ||||
| ``` | ||||
| [Running and Testing Agents Locally](local.md){ .md-button } | ||||
| [Running and Testing Chat Functions 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 available to any http requests. 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://<***>.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" | ||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you expose the real URL, then people will call it and hence use our API key. So you need to remove that part of the URL (e.g. use
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that was a dummy url. It does not exist in our infrastructure. So no need for worry. But I removed the urls and put ***s
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, this is similar to how evaluation functions are presented
@peterbjohnson should I replace the url here as well? (for evaluation functions the url is now invalid)
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good idea. Original eval functions didn't imply such high costs (no LLM calls) but that may change. |
||||
| curl --location 'https://<***>.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" | ||||
| } | ||||
| ] | ||||
| } | ||||
| }' | ||||
|
|
||||
| 7. Once the `dev` chat function 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 chat function. Please contact the ADMIN to provide you the URLS for the `staging` and `prod` versions of your chat function. | ||||
|
|
||||
| 8. In order to make your new chat function available on any of the environments of the Lambda Feedback platform, you will have to get in contact with the ADMINS on the platform. | ||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there an issue with the commit here? I'm reviewing in GH on the browser, not sure how this will appear when rendered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it emphasises that the body needs to be stringified