Skip to content

Commit 53b1831

Browse files
committed
Add RAG specific requirements
1 parent 6548033 commit 53b1831

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

README.md

+19-3
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,26 @@ Plus these scripts to demonstrate additional features:
1313

1414
* [`chat_safety.py`](./chat_safety.py): The simple script with exception handling for Azure AI Content Safety filter errors.
1515
* [`chat_async.py`](./chat_async.py): Uses the async clients to make asynchronous calls, including an example of sending off multiple requests at once using `asyncio.gather`.
16-
* [`chat_langchain.py`](./chat_langchain.py): Uses the langchain SDK to generate chat completions. [Learn more from Langchain docs](https://python.langchain.com/docs/get_started/quickstart)
17-
* [`chat_llamaindex.py`](./chat_llamaindex.py): Uses the LlamaIndex SDK to generate chat completions. [Learn more from LlamaIndex docs](https://docs.llamaindex.ai/en/stable/)
1816

19-
These scripts for RAG:
17+
## Using popular libraries
18+
19+
These scripts use popular libraries to demonstrate how to use the OpenAI API with them:
20+
21+
* [`chat_langchain.py`](./chat_langchain.py): Uses the Langchain package to generate chat completions. [Learn more from Langchain docs](https://python.langchain.com/docs/get_started/quickstart)
22+
* [`chat_llamaindex.py`](./chat_llamaindex.py): Uses the LlamaIndex package to generate chat completions. [Learn more from LlamaIndex docs](https://docs.llamaindex.ai/en/stable/)
23+
* [`chat_pydanticai.py`](./chat_pydanticai.py): Uses the PydanticAI package to generate chat completions. [Learn more from PydanticAI docs](https://ai.pydantic.dev/)
24+
25+
## Retrieval-Augmented Generation (RAG)
26+
27+
These scripts demonstrate how to use the OpenAI API for Retrieval-Augmented Generation (RAG) tasks, where the model retrieves relevant information from a source and uses it to generate a response.
28+
29+
First install the RAG dependencies:
30+
31+
```bash
32+
python -m pip install -r requirements-rag.txt
33+
```
34+
35+
Then run the scripts (in order of increasing complexity):
2036

2137
* [`rag_csv.py`](./rag.py): Retrieves matching results from a CSV file and uses them to answer user's question.
2238
* [`rag_multiturn.py`](./rag_multiturn.py): The same idea, but with a back-and-forth chat interface using `input()` which keeps track of past messages and sends them with each chat completion call.

requirements-rag.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pymupdf4llm
2+
lunr
3+
sentence-transformers

requirements.txt

-2
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,3 @@ llama-index-llms-azure-openai
77
llama-index-llms-openai
88
llama-index-llms-openai-like
99
pydantic-ai
10-
pymupdf4llm
11-
lunr

0 commit comments

Comments
 (0)