Loading repository dataβ¦
Loading repository dataβ¦
hanit-com / repository
π€ An intelligent, context-aware chatbot that can be utilized to answer questions about your own documented data.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
An intelligent, conversational, context-aware chatbot that can be utilized to answer questions about your own documented data.
This repository utilizes Meta's in-memory vector index Faiss, as well as LangChain Python library, and Azure OpenAI's Embedding and Completion services.
You should have an Azure account with a running instance of OpenAI.
Creating a Vector Index (dashed arrows flow)
Generating a Completion (solid arrows flow)
Clone the repository:
git clone https://github.com/hanit-com/azure-openai-custom-chatgpt.git
Create a Python environment:
python -m venv .venv
Activate the environment:
source .venv/bin/activate
Install the dependencies:
pip install -r requirements.txt
Create a '.env' file with the following variables.
Complete the API key and the Azure resource endpoint base from your azure account.
Select an instance on the Cognitive Services Hub and go to "Keys and Endpoints".
Use either "KEY 1" or "KEY 2" and the "Endpoint" field.
OPENAI_API_KEY=
OPENAI_API_BASE=
OPENAI_API_VERSION=2023-05-15
Add your data files to the 'context_data/data' directory.
Uncomment insert_data_to_store() in order to create a vector index at the first run.
After running the program once, re-comment the function.
Run:
python azure_openai.py
In order to terminate the program, type exit in the prompt.
(Using data from the Wikipedia page Coronation of Charles III and Camilla).
Notice that the questions do not have to be full, the chain will rephrase each question to provide it some context from the conversation.
Prompt: When the coronation took place?
The coronation took place on May 6, 2023.
Prompt: Where?
The coronation took place at Westminster Abbey.
Prompt: Why there?
The coronation took place at Westminster Abbey because it is a traditional location for British coronations, with the last 40 monarchs being crowned there since William the Conqueror in 1066.