File size: 3,697 Bytes
02d7f34
 
 
 
 
 
 
 
 
 
fff1c68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
02d7f34
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
---
title: Code Weaver
emoji: 🔥
colorFrom: purple
colorTo: indigo
sdk: docker
pinned: false
short_description: Interact with your github repo
---

# Code Weaver

This application is inspired by the [Chat-with-Github-Repo](https://github.com/peterw/Chat-with-Github-Repo) project by peterw, which demonstrates how to create a chatbot using Streamlit, OpenAI, and Activeloop's Deep Lake. Code Weaver builds upon that foundation, offering a more user-friendly experience and optimized performance.

Code Weaver is designed to let you interact with a GitHub repository through a conversational interface. It indexes the contents of a repository, allowing you to ask questions and receive answers based on the repository's documentation and code.

![Code Weaver Screenshot](screenshot.png)

## Key Improvements Over Original Implementation

Code Weaver offers several key improvements that enhance the user experience and the app's overall performance:

*   **Purely Frontend UI:**
    *   The original application used a command-line interface (CLI) for configuration. Code Weaver provides a completely UI-based experience. All configurations (API keys, repo URLs, dataset names, etc.) are entered directly into the Streamlit app, making it much more accessible to users.
*   **Optimized Document Parsing:**
    *   The document parsing and splitting process have been optimized for speed and handling of large files by using `RecursiveCharacterTextSplitter`.
*   **Improved Loading times:**
     * The app is now faster because the embeddings are not recalculated each time the app is started, this is achieved by using `InMemoryCache`.
*   **Direct OpenAI Embeddings Model:**
    *   The app now directly specifies the usage of the `"text-embedding-ada-002"` OpenAI embedding model, resulting in faster embedding calculations.
*   **In Memory Cache:**
    *   `InMemoryCache` is used to cache the results from the language model improving loading speeds.
*   **Streamlined Setup:**
    *   No more need for `.env` files, as all necessary variables are inserted directly in the app UI.
*    **Easier Deployment**: The app is built to be deployed in Hugging Face Spaces, making the deployment process easier.

## How to Use Code Weaver

1.  **Clone the repository:**
     ```bash
     https://github.com/WHITELOTUS0/chat-with-a-repo.git
     ```
2.  **Navigate to the Project Directory:**

    ```bash
    cd your-repo-name
    ```
3.  **Install dependencies:**

    ```bash
    pip install -r requirements.txt
    ```
4.  **Run the app:**
    ```bash
    streamlit run app.py
    ```

5.  **Enter configurations**: The Streamlit app will open in your web browser. In the sidebar, provide:
    *   Your OpenAI API Key
    *   Your Activeloop Token
    *   Your Activeloop Username
    *   The GitHub repository URL you want to explore
    *   The file extensions to include (optional)
    *   A desired name for the DeepLake dataset
6.  **Process the repository**: Click on the "Process Repository" Button, and wait for it to finish.
7.  **Start Chatting:** After processing is done, you can start asking questions about the repository in the provided input text area.

## Contributing

Contributions to this project are always welcome. If you find any bugs or would like to suggest new features, feel free to create a pull request or open an issue in this repository.

## Credits

*   Inspired by the [Chat-with-Github-Repo](https://github.com/peterw/Chat-with-Github-Repo) project by peterw.
*   Built using Python, Streamlit, OpenAI, Activeloop, and Langchain.

## License

[MIT License](LICENSE)

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference