Skip to content

Commit de586e6

Browse files
committed
fix doc qa example
1 parent cc97eb0 commit de586e6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

examples/qa.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This example is inspired from the [LangChain doc](https://python.langchain.com/e
1515
This example has extra dependencies. You can install them with:
1616

1717
```bash
18-
pip installchromadb tiktoken openai
18+
pip install chromadb tiktoken openai
1919
```
2020

2121
Then, you need to go to create an OpenAI key [here](https://platform.openai.com/account/api-keys) and get a SperpApi key [here](https://serpapi.com/).
@@ -29,7 +29,7 @@ Then, you need to go to create an OpenAI key [here](https://platform.openai.com/
2929

3030
````python qa.py
3131
from langchain.embeddings.openai import OpenAIEmbeddings
32-
from langchain.text_splitter import CharacterTextSplitter
32+
from langchain.text_splitter import RecursiveCharacterTextSplitter
3333
from langchain.vectorstores import Chroma
3434
from langchain.chains import RetrievalQAWithSourcesChain
3535
from langchain.chat_models import ChatOpenAI
@@ -44,7 +44,7 @@ import chainlit as cl
4444

4545
os.environ["OPENAI_API_KEY"] = "OPENAI_API_KEY"
4646

47-
text_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)
47+
text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=100)
4848

4949
system_template = """Use the following pieces of context to answer the users question.
5050
If you don't know the answer, just say that you don't know, don't try to make up an answer.

0 commit comments

Comments
 (0)