Zaman
commited on
Commit
•
59b9bf8
1
Parent(s):
444dc2c
added debugging code
Browse files
bot.py
CHANGED
@@ -12,14 +12,14 @@ from langchain.memory import ConversationBufferWindowMemory
|
|
12 |
|
13 |
|
14 |
persist_direcory = "db_index"
|
15 |
-
# persist_directory = "db"
|
16 |
|
17 |
embeddings = OpenAIEmbeddings()
|
18 |
# db = FAISS.load_local(persist_directory, embeddings)
|
19 |
chroma = Chroma(embedding_function=embeddings, persist_directory=persist_direcory)
|
20 |
# retriever = chroma.as_retriever(search_type="mmr", search_kwargs={"k": 10})
|
21 |
retriever = chroma.as_retriever(search_kwargs={"k": 10})
|
22 |
-
|
|
|
23 |
|
24 |
memory = ConversationBufferWindowMemory(
|
25 |
memory_key="chat_history", return_messages=False
|
@@ -35,6 +35,7 @@ qa = ConversationalRetrievalChain.from_llm(
|
|
35 |
# return_source_documents=True,
|
36 |
)
|
37 |
|
|
|
38 |
# res = qa({"question": "what is AD790?", "chat_history": []})
|
39 |
# print(res["answer"])
|
40 |
|
|
|
12 |
|
13 |
|
14 |
persist_direcory = "db_index"
|
|
|
15 |
|
16 |
embeddings = OpenAIEmbeddings()
|
17 |
# db = FAISS.load_local(persist_directory, embeddings)
|
18 |
chroma = Chroma(embedding_function=embeddings, persist_directory=persist_direcory)
|
19 |
# retriever = chroma.as_retriever(search_type="mmr", search_kwargs={"k": 10})
|
20 |
retriever = chroma.as_retriever(search_kwargs={"k": 10})
|
21 |
+
query = "what were the net sales of aws in the first quarter of 2023?"
|
22 |
+
print(retriever.get_relevant_documents(query))
|
23 |
|
24 |
memory = ConversationBufferWindowMemory(
|
25 |
memory_key="chat_history", return_messages=False
|
|
|
35 |
# return_source_documents=True,
|
36 |
)
|
37 |
|
38 |
+
|
39 |
# res = qa({"question": "what is AD790?", "chat_history": []})
|
40 |
# print(res["answer"])
|
41 |
|