https://github.com/gardner/nais
Example code for RAG search
https://github.com/gardner/nais
rag
Last synced: 11 months ago
JSON representation
Example code for RAG search
- Host: GitHub
- URL: https://github.com/gardner/nais
- Owner: gardner
- Created: 2025-05-11T07:57:52.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-05-13T00:14:30.000Z (about 1 year ago)
- Last Synced: 2025-08-01T22:20:35.248Z (11 months ago)
- Topics: rag
- Language: Jupyter Notebook
- Homepage: https://colab.research.google.com/github/gardner/nais/blob/master/chat_engine_react.ipynb
- Size: 5.53 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NAIS RAG Tutorial
## Get a free Google Gemini API key
https://ai.google.dev/gemini-api/docs/api-key
## Let's start here:
https://docs.llamaindex.ai/en/stable/examples/chat_engine/chat_engine_react/
##
This is a [LlamaIndex](https://www.llamaindex.ai/) simple agentic RAG project using [Agent Workflows](https://docs.llamaindex.ai/en/stable/examples/agent/agent_workflow_basic/).
## Getting Started
### Install `uv`:
https://docs.astral.sh/uv/getting-started/installation/
Then, setup the environment with uv:
```shell
uv sync
```
Then check the parameters that have been pre-configured in the `.env` file in this directory.
Make sure you have set the `GOOGLE_API_KEY` for the LLM.
Second, generate the embeddings of the documents in the `./data` directory:
```shell
uv run generate
```
Third, run the development server:
```shell
uv run fastapi dev
```
Then open [http://localhost:8000](http://localhost:8000) with your browser to start the chat UI.
To start the app optimized for **production**, run:
```
uv run fastapi run
```
## Configure LLM and Embedding Model
You can configure [LLM model](https://docs.llamaindex.ai/en/stable/module_guides/models/llms) and [embedding model](https://docs.llamaindex.ai/en/stable/module_guides/models/embeddings) in [settings.py](app/settings.py).
## Use Case
We have prepared an [example workflow](./app/workflow.py) for the agentic RAG use case, where you can ask questions about the example documents in the [./data](./data) directory.
You can start by sending an request on the [chat UI](http://localhost:8000) or you can test the `/api/chat` endpoint with the following curl request:
```
curl --location 'localhost:8000/api/chat' \
--header 'Content-Type: application/json' \
--data '{ "messages": [{ "role": "user", "content": "What standards for a letter exist?" }] }'
```
## Learn More
To learn more about LlamaIndex, take a look at the following resources:
- [LlamaIndex Documentation](https://docs.llamaindex.ai) - learn about LlamaIndex.
- [Workflows Introduction](https://docs.llamaindex.ai/en/stable/understanding/workflows/) - learn about LlamaIndex workflows.
You can check out [the LlamaIndex GitHub repository](https://github.com/run-llama/llama_index) - your feedback and contributions are welcome!