Skip to content

jpmcb/repo-query

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenSauced logo

🍕 RepoQuery 🍕

GitHub code size in bytes GitHub commit activity Discord Twitter

Open Sauced

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 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

1. POST /embed

To generate and store embeddings for a GitHub repository.

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 the following events with optional data. https://github.com/open-sauced/repo-query/blob/f2f415a4fa9c02d4530624fd7bac2105eea1a77c/src/routes/events.rs#L14-L20

Example

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

2. POST /query

To perform a query on the API with a specific question related to a repository.

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 the following events with optional data. https://github.com/open-sauced/repo-query/blob/f2f415a4fa9c02d4530624fd7bac2105eea1a77c/src/routes/events.rs#L22-L29

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. GET /collection

To check if a repository has been indexed.

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).

Attributions

https://sbert.net for https://huggingface.co/sentence-transformers/multi-qa-MiniLM-L6-cos-v1.

@inproceedings{reimers-2020-multilingual-sentence-bert,
  title = "Making Monolingual Sentence Embeddings Multilingual using Knowledge Distillation",
  author = "Reimers, Nils and Gurevych, Iryna",
  booktitle = "Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing",
  month = "11",
  year = "2020",
  publisher = "Association for Computational Linguistics",
  url = "https://arxiv.org/abs/2004.09813",
}

🤝 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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Languages

  • Rust 100.0%