Skip to content

Files

Latest commit

03e580e Β· Oct 10, 2023

History

History
202 lines (141 loc) Β· 7.94 KB

README.md

File metadata and controls

202 lines (141 loc) Β· 7.94 KB
OpenSauced logo

πŸ• RepoQuery πŸ•

GitHub code size in bytes GitHub commit activity Discord Twitter

263793091-872fbaf0-c33f-4c4f-a86e-5bd7f5b4dad7

A REST service to answer user-queries about public GitHub repositories

πŸ”Ž The Project

RepoQuery is an early-beta project, that uses recursive OpenAI function calling paired with semantic search using sentence-transformers/all-MiniLM-L6-v2 to index and answer user queries about public GitHub repositories.

πŸ“¬ Service Endpoints

Note: Since the service returns responses as SSEs, a REST client like Postman is recommended. Download it here. The Postman web client doesn't support requests to localhost.

Run in Postman

Endpoint Method Description
/ GET Redirects to the configured redirect URL.
/embed POST Generate and store embeddings for a GitHub repository.
/query POST Perform a query on the API with a specific question related to a repository.
/collection GET Check if a repository has been indexed.

1. /embed

Parameters

The parameters are passed as a JSON object in the request body:

  • owner (string, required): The owner of the repository.
  • name (string, required): The name of the repository.
  • branch (string, required): The name of the branch.

Response

The request is processed by the server and responses are sent as Server-sent events(SSE). The event stream will contain events with optional data.

Example

curl --location 'localhost:3000/embed' \
--header 'Content-Type: application/json' \
--data '{
    "owner": "open-sauced",
    "name": "ai",
    "branch": "beta"
}'

2. /query

Parameters

The parameters are passed as a JSON object in the request body:

  • query (string, required): The question or query you want to ask.
  • repository (object, required): Information about the repository for which you want to get the answer.
    • owner (string, required): The owner of the repository.
    • name (string, required): The name of the repository.
    • branch (string, required): The name of the branch.

Response

The request is processed by the server and responses are sent as Server-sent events(SSE). The event stream will contain events with optional data.

Example

curl --location 'localhost:3000/query' \
--header 'Content-Type: application/json' \
--data '{
    "query": "How is the PR description being generated using AI?",
    "repository": {
        "owner": "open-sauced",
        "name": "ai",
        "branch": "beta"
    }
}'

3. /collection

Parameters

  • owner (string, required): The owner of the repository.
  • name (string, required): The name of the repository.
  • branch (string, required): The name of the branch.

Response

This endpoint returns an OK status code if the repository has been indexed by the service.

Example

curl --location 'localhost:3000/embed?owner=open-sauced&name=ai&branch=beta'

πŸ§ͺ Running Locally

To run the project locally, there are a few prerequisites:

Once, the above requirements are satisfied, you can run the project like so:

Environment variables

The project requires the following environment variables to be set.

Database setup

Start Docker and run the following commands to spin-up a Docker container with a QdrantDB image.

docker pull qdrant/qdrant
docker run -p 6333:6333 -p 6334:6334 qdrant/qdrant

The database dashboard will be accessible at localhost:6333/dashboard, the project communicates with the DB on port 6334.

Running the project

Run the following command to install the dependencies and run the project on port 3000.

cargo run --release

This command will build and run the project with optimizations enabled(Highly recommended).

🐳 Docker container

The repo-query engine can also be run locally via a docker container and includes all the necessary dependencies.

To build the container tagged as open-sauced-repo-query:latest, run:

make local-image

Then, you can start the repo-query service with:

docker run --env-file ./.env -p 3000:3000 open-sauced-repo-query

There's also a docker-compose.yaml file that can be used to start both qdrant and the repo-query engine together.

To build the image and then start the services, run:

make up

Attributions

sentence-transformers/all-MiniLM-L6-v2.

@inproceedings{reimers-2019-sentence-bert,
  title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
  author = "Reimers, Nils and Gurevych, Iryna",
  booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
  month = "11",
  year = "2019",
  publisher = "Association for Computational Linguistics",
  url = "https://arxiv.org/abs/1908.10084",
}

🀝 Contributing

We encourage you to contribute to OpenSauced! Please check out the Contributing guide for guidelines about how to proceed.

We have a commit utility called @open-sauced/conventional-commit that helps you write your commits in a way that is easy to understand and process by others.

πŸ• Community

Got Questions? Join the conversation in our Discord.
Find Open Sauced videos and release overviews on our YouTube Channel.

βš–οΈ LICENSE

MIT Β© Open Sauced