Skip to content

Latest commit

 

History

History
47 lines (31 loc) · 1.26 KB

README.md

File metadata and controls

47 lines (31 loc) · 1.26 KB

ChatGPT

ChatGPT Retrieval

Simple script to use ChatGPT on your own files

Here's the Original YouTube Guide.

📦 Installation

Install Langchain and other required packages.

pip install langchain openai chromadb tiktoken unstructured

Modify constants.py.default to use your own OpenAI API key, and rename it to constants.py.

Place your own additional data into data.

✨ Example usage

Test reading data/data.txt file.

> python chatgpt.py "what is my dog's name"
Your dog's name is Lilia.

Test reading data/cat.pdf file.

> python chatgpt.py "what is my cat's name"
Your cat's name is Muffy.

🔄 Alternate Version

There's also an alternate version of the script that prioritizes retrieving answers from the dataset before using the OpenAI model. This can help reduce the cost of using the OpenAI API.

To use the alternate version, run the chatgpt_reduced_cost.py script instead of chatgpt.py.

> python chatgpt_alternate.py "what is my dog's name"
Your dog's name is Lilia.