An open API service indexing awesome lists of open source software.

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

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.