File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ This example is inspired from the [LangChain doc](https://python.langchain.com/e
15
15
This example has extra dependencies. You can install them with:
16
16
17
17
``` bash
18
- pip installchromadb tiktoken openai
18
+ pip install chromadb tiktoken openai
19
19
```
20
20
21
21
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/
29
29
30
30
```` python qa.py
31
31
from langchain.embeddings.openai import OpenAIEmbeddings
32
- from langchain.text_splitter import CharacterTextSplitter
32
+ from langchain.text_splitter import RecursiveCharacterTextSplitter
33
33
from langchain.vectorstores import Chroma
34
34
from langchain.chains import RetrievalQAWithSourcesChain
35
35
from langchain.chat_models import ChatOpenAI
@@ -44,7 +44,7 @@ import chainlit as cl
44
44
45
45
os.environ[" OPENAI_API_KEY" ] = " OPENAI_API_KEY"
46
46
47
- text_splitter = CharacterTextSplitter (chunk_size = 1000 , chunk_overlap = 0 )
47
+ text_splitter = RecursiveCharacterTextSplitter (chunk_size = 1000 , chunk_overlap = 100 )
48
48
49
49
system_template = """ Use the following pieces of context to answer the users question.
50
50
If you don't know the answer, just say that you don't know, don't try to make up an answer.
You can’t perform that action at this time.
0 commit comments