Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -26,11 +26,11 @@ system_prompt = ChatPromptTemplate.from_messages([
|
|
| 26 |
("user", "{question}, {context}")
|
| 27 |
])
|
| 28 |
|
| 29 |
-
vectorstore = Chroma(
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
)
|
| 34 |
|
| 35 |
def read_url(url):
|
| 36 |
response = requests.get(url)
|
|
@@ -83,6 +83,11 @@ def greet(prompt, file, url):
|
|
| 83 |
url_splits = read_url(url)
|
| 84 |
all_splits = url_splits
|
| 85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
vectorstore.add_documents(documents = all_splits)
|
| 87 |
|
| 88 |
retriever = vectorstore.as_retriever()
|
|
|
|
| 26 |
("user", "{question}, {context}")
|
| 27 |
])
|
| 28 |
|
| 29 |
+
# vectorstore = Chroma(
|
| 30 |
+
# collection_name = "example_collection",
|
| 31 |
+
# embedding_function = OpenAIEmbeddings(),
|
| 32 |
+
# # persist_directory = "./chroma_langchain_db", # Where to save data locally, remove if not neccesary
|
| 33 |
+
# )
|
| 34 |
|
| 35 |
def read_url(url):
|
| 36 |
response = requests.get(url)
|
|
|
|
| 83 |
url_splits = read_url(url)
|
| 84 |
all_splits = url_splits
|
| 85 |
|
| 86 |
+
vectorstore = Chroma(
|
| 87 |
+
collection_name = "example_collection",
|
| 88 |
+
embedding_function = OpenAIEmbeddings(),
|
| 89 |
+
# persist_directory = "./chroma_langchain_db", # Where to save data locally, remove if not neccesary
|
| 90 |
+
)
|
| 91 |
vectorstore.add_documents(documents = all_splits)
|
| 92 |
|
| 93 |
retriever = vectorstore.as_retriever()
|