https://github.com/peterw/Chat-with-Github-Repo
This repository contains two Python scripts that demonstrate how to create a chatbot using Streamlit, OpenAI GPT-3.5-turbo, and Activeloop's Deep Lake.
https://github.com/peterw/Chat-with-Github-Repo
Last synced: about 1 year ago
JSON representation
This repository contains two Python scripts that demonstrate how to create a chatbot using Streamlit, OpenAI GPT-3.5-turbo, and Activeloop's Deep Lake.
- Host: GitHub
- URL: https://github.com/peterw/Chat-with-Github-Repo
- Owner: peterw
- License: mit
- Created: 2023-04-25T02:41:24.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-05-20T03:44:27.000Z (about 2 years ago)
- Last Synced: 2025-03-18T07:11:20.430Z (over 1 year ago)
- Language: Python
- Homepage: https://explodinginsights.com/
- Size: 31.3 KB
- Stars: 1,151
- Watchers: 14
- Forks: 168
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- StarryDivineSky - peterw/Chat-with-Github-Repo - with-Github-Repo包含两个Python脚本,展示了如何使用Streamlit、OpenAI GPT-3.5-turbo和Activeloop的Deep Lake创建一个聊天机器人。该聊天机器人可以与GitHub仓库进行交互,理解仓库内容并回答相关问题。项目利用OpenAI的GPT-3.5-turbo模型进行自然语言处理和生成,Streamlit构建用户界面,Deep Lake用于存储和管理向量嵌入数据。用户可以通过友好的界面与机器人对话,获取关于GitHub仓库的信息。项目旨在简化用户理解和探索GitHub仓库内容的过程。 (A01_文本生成_文本对话 / 大语言对话模型及数据)
README
# Chat-with-Github-Repo
This repository contains Python scripts that demonstrate how to create a chatbot using Streamlit, OpenAI GPT-3.5-turbo, and Activeloop's Deep Lake.
The chatbot searches a dataset stored in Deep Lake to find relevant information from any Git repository and generates responses based on the user's input.
## Files
- `src/utils/process.py`: This script clones a Git repository, processes the text documents, computes embeddings using OpenAIEmbeddings, and stores the embeddings in a DeepLake instance.
- `src/utils/chat.py`: This script creates a Streamlit web application that interacts with the user and the DeepLake instance to generate chatbot responses using OpenAI GPT-3.5-turbo.
- `src/main.py`: This script contains the command line interface (CLI) that allows you to run the chatbot application.
## Setup
Before getting started, be sure to sign up for an [Activeloop](https://www.activeloop.ai/) and [OpenAI](https://openai.com/) account and create API keys.
To set up and run this project, follow these steps:
1. Clone the repository and navigate to the project directory:
```bash
git clone https://github.com/peterw/Chat-with-Git-Repo.git
cd Chat-with-Git-Repo
```
2. Install the required packages with `pip`:
```bash
pip install -r requirements.txt
```
For development dependencies, you can install them using the following command:
```bash
pip install -r dev-requirements.txt
```
3. Set the environment variables:
Copy the `.env.example` file:
```bash
cp .env.example .env
```
Provide your API keys and username:
```
OPENAI_API_KEY=your_openai_api_key
ACTIVELOOP_TOKEN=your_activeloop_api_token
ACTIVELOOP_USERNAME=your_activeloop_username
```
4. Use the CLI to run the chatbot application. You can either process a Git repository or start the chat application using an existing dataset.
> For complete CLI instructions run `python src/main.py --help`
To process a Git repository, use the `process` subcommand:
```bash
python src/main.py process --repo-url https://github.com/username/repo_name
```
You can also specify additional options, such as file extensions to include while processing the repository, the name for the Activeloop dataset, or the destination to clone the repository:
```bash
python src/main.py process --repo-url https://github.com/username/repo_name --include-file-extensions .md .txt --activeloop-dataset-name my-dataset --repo-destination repos
```
To start the chat application using an existing dataset, use the `chat` subcommand:
```bash
python src/main.py chat --activeloop-dataset-name my-dataset
```
The Streamlit chat app will run, and you can interact with the chatbot at `http://localhost:8501` (or the next available port) to ask questions about the repository.
## Sponsors
✨ Find profitable ideas faster: [Exploding Insights](https://explodinginsights.com/)
## License
[MIT License](LICENSE)