Spaces:
Sleeping
Sleeping
arslan-ahmed
commited on
Commit
•
f56e647
1
Parent(s):
ea694cd
Update app.py
Browse files
app.py
CHANGED
@@ -57,20 +57,6 @@ if mode.type!='userInputDocs':
|
|
57 |
|
58 |
###############################################################################################
|
59 |
|
60 |
-
def generateExamples(api_key_st, vsDict_st):
|
61 |
-
qa_chain = RetrievalQA.from_llm(llm=ChatOpenAI(openai_api_key=api_key_st, temperature=0),
|
62 |
-
retriever=vsDict_st['chromaClient'].as_retriever(search_type="similarity", search_kwargs={"k": 4}))
|
63 |
-
|
64 |
-
result = qa_chain({'query': exp_query})
|
65 |
-
answer = result['result'].strip('\n')
|
66 |
-
grSamples = [[]]
|
67 |
-
if answer.startswith('1. '):
|
68 |
-
lines = answer.split("\n") # split the answers into individual lines
|
69 |
-
list_items = [line.split(". ")[1] for line in lines] # extract each answer after the numbering
|
70 |
-
grSamples = [[x] for x in list_items] # gr takes list of each item as a list
|
71 |
-
|
72 |
-
return grSamples
|
73 |
-
|
74 |
# initialize chatbot function sets the QA Chain, and also sets/updates any other components to start chatting. updateQaChain function only updates QA chain and will be called whenever Adv Settings are updated.
|
75 |
def initializeChatbot(temp, k, modelName, stdlQs, api_key_st, vsDict_st, progress=gr.Progress()):
|
76 |
progress(0.1, waitText_initialize)
|
|
|
57 |
|
58 |
###############################################################################################
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
# initialize chatbot function sets the QA Chain, and also sets/updates any other components to start chatting. updateQaChain function only updates QA chain and will be called whenever Adv Settings are updated.
|
61 |
def initializeChatbot(temp, k, modelName, stdlQs, api_key_st, vsDict_st, progress=gr.Progress()):
|
62 |
progress(0.1, waitText_initialize)
|