Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -20,16 +20,18 @@ text_splitter = RecursiveCharacterTextSplitter(
|
|
| 20 |
chunk_overlap = 150
|
| 21 |
)
|
| 22 |
|
|
|
|
|
|
|
| 23 |
# Recursive Splitting the whole text of emails into chunks
|
| 24 |
splits = text_splitter.split_documents(documents)
|
| 25 |
|
| 26 |
# Creating the Embeddings from the splits we created
|
| 27 |
-
embedding = OpenAIEmbeddings(openai_api_key=
|
| 28 |
|
| 29 |
# Storing the Embeddings into ChromaDB
|
| 30 |
persist_directory = 'docs/chroma/'
|
| 31 |
vectordb = Chroma.from_documents(
|
| 32 |
-
documents=splits[0:
|
| 33 |
embedding=embedding,
|
| 34 |
persist_directory=persist_directory
|
| 35 |
)
|
|
|
|
| 20 |
chunk_overlap = 150
|
| 21 |
)
|
| 22 |
|
| 23 |
+
openai.api_key = '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'
|
| 24 |
+
|
| 25 |
# Recursive Splitting the whole text of emails into chunks
|
| 26 |
splits = text_splitter.split_documents(documents)
|
| 27 |
|
| 28 |
# Creating the Embeddings from the splits we created
|
| 29 |
+
embedding = OpenAIEmbeddings(openai_api_key=openai.api_key)
|
| 30 |
|
| 31 |
# Storing the Embeddings into ChromaDB
|
| 32 |
persist_directory = 'docs/chroma/'
|
| 33 |
vectordb = Chroma.from_documents(
|
| 34 |
+
documents=splits[0:100],
|
| 35 |
embedding=embedding,
|
| 36 |
persist_directory=persist_directory
|
| 37 |
)
|