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
Copy file name to clipboardExpand all lines: README.md
+19-3
Original file line number
Diff line number
Diff line change
@@ -13,10 +13,26 @@ Plus these scripts to demonstrate additional features:
13
13
14
14
*[`chat_safety.py`](./chat_safety.py): The simple script with exception handling for Azure AI Content Safety filter errors.
15
15
*[`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/)
18
16
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):
20
36
21
37
*[`rag_csv.py`](./rag.py): Retrieves matching results from a CSV file and uses them to answer user's question.
22
38
*[`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.
0 commit comments