https://github.com/mahmoudajawad/conversational_kb
A PoC to created console-based chat interface to knowledge based using OpenAI gpt-3.5-turbe model
https://github.com/mahmoudajawad/conversational_kb
ai chatbot chatgpt conversational conversational-ai gpt-3
Last synced: 11 months ago
JSON representation
A PoC to created console-based chat interface to knowledge based using OpenAI gpt-3.5-turbe model
- Host: GitHub
- URL: https://github.com/mahmoudajawad/conversational_kb
- Owner: mahmoudajawad
- License: agpl-3.0
- Created: 2023-03-22T09:34:46.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2023-03-25T05:01:09.000Z (over 3 years ago)
- Last Synced: 2025-07-06T12:08:39.363Z (about 1 year ago)
- Topics: ai, chatbot, chatgpt, conversational, conversational-ai, gpt-3
- Language: Python
- Homepage:
- Size: 427 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Conversation KB
A PoC to created console-based chat interface to knowledge based using OpenAI `gpt-3.5-turbe` model.
Knowledge is provided as titled paragraphs in plain text format in `articles` directory, that is then vectorised into embeddings and saved to `embeddings` directory. With every question asked, the question is also vectorised and its embeddings are matched against the paragraphs embeddings to find three top most matches that are then appended to a `system` prompt for `gpt-3.5-turbo` model. If the question isn't the first, last top match is also appended to `system` prompt to enable follow-up questions.
## How to Run
- Add your own articles paragraphs to `articles` directory, or use provided samples from `samples` directory:
- Title every paragraph.
- Use mid-size paragraphs only.
- embeddings are calculated when no embeddings matching file exist, which means if you modify a file in `articles` directory that its embeddings are already calculated, you will have to manually remove the matching `embeddings` directory file to force re-calculation.
- Create a `venv`: `python -m venv venv`.
- Install dependencie: `python -m pip install -r requirements.txt`.
- Run: `python .`
The project is set to emit all kind of logs, as this is a PoC that is meant to understand how such a simple approach to conversation knowledge-base would play, however, you can manually set logging level in first line of `main` function.