You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A CLI application for building a [RAG](https://blogs.nvidia.com/blog/what-is-retrieval-augmented-generation/) for GitHub repository's markdown files and using it as a context for an LLM to ask questions related to the repository's documentation.
5
+
A REST API and CLI application for building a [RAG](https://blogs.nvidia.com/blog/what-is-retrieval-augmented-generation/) for GitHub repository's markdown files and using it as a context for an LLM to ask questions related to the repository's documentation.
6
6
7
7
The client code is implemented using TypeScript. PostgreSQL with [pgvector](https://github.com/pgvector/pgvector) is used as a vector database. Redis is used for caching purposes.
8
8
@@ -14,5 +14,29 @@ Docker and [Ollama](https://ollama.com/).
14
14
15
15
1. Setup [Ollama](https://ollama.com/) and pull the `llama3:8b` model by running `ollama pull llama3:8b`. You can use other Ollama models as well, see next step for configuration instructions.
16
16
2. Create a `.env` and with the contents of the `.env.template` file. Feel free to change the environment variables, e.g. `OLLAMA_MODEL` variable to change the model.
17
-
2. Run the containers by running `docker compose up -d pg redis`.
18
-
3. Once the containers are ready, run the CLI application by running `docker compose run -it --rm cli` and follow the instructions provided by the application.
17
+
3. Run the containers by running `docker compose up -d`
18
+
4. Once the containers are ready, there's two ways to access the LLM: `http://localhost:3000/api/repos/{owner}/{repo}/prompt` REST API endpoint and the CLI application. Details for both are below.
19
+
20
+
> [!WARNING]
21
+
> GitHub's API [limits the requests for unauthenticated users](https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28). Provide a GitHub authentication token as instructed below to increate your rate limit.
22
+
23
+
### REST API
24
+
25
+
REST API endpoint `http://localhost:3000/api/repos/{owner}/{repo}/prompt` (e.g. <http://localhost:3000/api/repos/Kaltsoon/rag-my-docs>) accepts a request body in the following format:
26
+
27
+
```json
28
+
{
29
+
"question": "What is the purpose of the repository?",
30
+
"ref": "dev",
31
+
"auth": "supersecret"
32
+
}
33
+
```
34
+
35
+
The `ref` and `auth` attributes are optional. The `ref` attribute determines name of the commit/branch/tag. Defaults to repository's default branch. The `auth` attribute determines the GitHub authentication token used for requests to GitHub's API. It is only required while accessing non-public resources or to increase the rate limit.
36
+
37
+
> [!WARNING]
38
+
> The first request for the repository will take some time, but the subsequent request to the same repository are much faster due to caching.
39
+
40
+
### CLI
41
+
42
+
You can run the CLI application by running `docker compose exec -it app npm run start:cli`. The CLI application will provide instructions on the usage.
0 commit comments