Skip to main content

Using LLMS to facilitate document retrieval and chat operations

Project description

Repo Chat

Repo Chat is a software package for answering queries about code repositories using large language models with document retrieval. It leverages the langchain library to facilitate the retrieval and chat operations.

Installation

To install the required libraries, run:

pip install -r requirements.txt

Usage

Basic Usage

In order to use Repo Chat, you need to set the OPENAI_API_KEY in a .env file as shown below:

OPENAI_API_KEY=your_api_key_here

After setting the API key, you can use the chain_manager module to create a chain:

from repo_chat import chain_manager

chain = chain_manager.get_chain("UPGRADE_QUERY")

You can then call the chain with input data:

chain_input_data = {
    "query": "What does the function do?",
    "repo": "https://github.com/my-org/my-repo",
}

output = chain(chain_input_data)

Advanced Usage

Please refer to the source code examples in the following files to learn more about Repo Chat's advanced features:

  • repo_chat\chain_manager.py
  • repo_chat\chat_utils.py
  • repo_chat\eval_utils.py
  • repo_chat\templates.py

Chain Templates

Repo Chat uses multiple chain templates for different purposes. The templates are defined in repo_chat\templates.py. Here is a brief explanation of the available templates:

  • UPGRADE_QUERY: Expand or refine a given query to improve the retrieved documents' quality and relevance.
  • RUN_QUERY_RAG: Process the given query and its similar documents to provide the most accurate and relevant response possible.
  • CONTEXT_VALIDATOR: Validate the context sufficiency of the given query and similar documents.
  • CRITIC: Score a given response for a query by evaluating relevancy and accuracy.
  • RAW_CODE: Process a given query for a specific code repository.

Evaluation

Repo Chat provides evaluation utilities in the repo_chat\eval_utils.py module. The CriticChain class is used to evaluate a response generated by the model. The QueryEvaluator class is used to evaluate a single query against the Repo Chat chain, and MultiQueryEvaluator evaluates multiple queries in parallel.

Contributing

Feel free to submit issues or pull requests if you have any suggestions or improvements you would like to add to Repo Chat.

License

Repo Chat is released under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

repo_chat-0.1.3.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

repo_chat-0.1.3-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file repo_chat-0.1.3.tar.gz.

File metadata

  • Download URL: repo_chat-0.1.3.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.1

File hashes

Hashes for repo_chat-0.1.3.tar.gz
Algorithm Hash digest
SHA256 eb3963ad80581c93fb2a1fea2bd2c41ebeff5fd149f74edfc6c572c419be294e
MD5 1c6dd56d1866d86e83df1cc515100b77
BLAKE2b-256 9d030ec1c72a16c2675367d4c98ba5b89fc63f17b1ade2ed6d16fd1a9cee06ec

See more details on using hashes here.

File details

Details for the file repo_chat-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: repo_chat-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.1

File hashes

Hashes for repo_chat-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 47806a1670e2a01306700fcd62b6e9aa6d48f5af64a55d25409cd1da49128e84
MD5 a4d4e4644f7ca2ccbc7a10494a0d7fd3
BLAKE2b-256 bed30ba2ad786154da539e6fd8a9e6673fe944ab88b3a6c13b6841bd9a9a6278

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page