Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -16,6 +16,7 @@ from langchain.prompts.chat import (
|
|
16 |
import chainlit as cl
|
17 |
|
18 |
from build_langchain_vector_store import chunk_docs, load_gitbook_docs, tiktoken_len
|
|
|
19 |
|
20 |
import openai
|
21 |
# import os
|
@@ -33,11 +34,10 @@ chunked_langchain_documents = chunk_docs(
|
|
33 |
)
|
34 |
|
35 |
embedding_model = OpenAIEmbeddings(model=embedding_model_name)
|
36 |
-
shutil.rmtree(args.persist_path, ignore_errors=True)
|
37 |
vector_store = Chroma.from_documents(
|
38 |
-
chunked_langchain_documents, embedding=embedding_model, persist_directory=
|
39 |
)
|
40 |
read_vector_store = Chroma(
|
41 |
-
persist_directory=
|
42 |
)
|
43 |
print(read_vector_store.similarity_search("How do I use Pulze?"))
|
|
|
16 |
import chainlit as cl
|
17 |
|
18 |
from build_langchain_vector_store import chunk_docs, load_gitbook_docs, tiktoken_len
|
19 |
+
from tiktoken import Encoding, encoding_for_model
|
20 |
|
21 |
import openai
|
22 |
# import os
|
|
|
34 |
)
|
35 |
|
36 |
embedding_model = OpenAIEmbeddings(model=embedding_model_name)
|
|
|
37 |
vector_store = Chroma.from_documents(
|
38 |
+
chunked_langchain_documents, embedding=embedding_model, persist_directory="langchain-chroma-pulze-docs"
|
39 |
)
|
40 |
read_vector_store = Chroma(
|
41 |
+
persist_directory="langchain-chroma-pulze-docs", embedding_function=embedding_model
|
42 |
)
|
43 |
print(read_vector_store.similarity_search("How do I use Pulze?"))
|