jonathanjordan21
commited on
Commit
•
82082e6
1
Parent(s):
2ca2be3
Update custom_llm.py
Browse files- custom_llm.py +4 -4
custom_llm.py
CHANGED
@@ -270,7 +270,7 @@ def custom_unique_df_chain(llm, df):
|
|
270 |
|
271 |
def custom_combined_chain(llm, df_chain, memory_chain):
|
272 |
|
273 |
-
prompt = PromptTemplate.
|
274 |
|
275 |
<question>
|
276 |
{question}
|
@@ -287,9 +287,9 @@ def custom_combined_chain(llm, df_chain, memory_chain):
|
|
287 |
# return memory_chain
|
288 |
|
289 |
|
290 |
-
# full_chain = RunnablePassthrough.assign(topic= (
|
291 |
-
|
292 |
-
return RunnableBranch( (lambda x: "ticket" in x['topic'].lower(), df_chain), (lambda x: "dataframe" in x['topic'].lower(), df_chain), memory_chain )
|
293 |
|
294 |
|
295 |
class CustomLLM(LLM):
|
|
|
270 |
|
271 |
def custom_combined_chain(llm, df_chain, memory_chain):
|
272 |
|
273 |
+
prompt = PromptTemplate.from_template("""<s><INST> Given the following question, classify it as either being more relevant with a dataframe object of ticket submissions' history or several documents of user guide and general knowledge:
|
274 |
|
275 |
<question>
|
276 |
{question}
|
|
|
287 |
# return memory_chain
|
288 |
|
289 |
|
290 |
+
# full_chain = RunnablePassthrough.assign(topic= (prompt | llm)) | RunnableLambda(route)
|
291 |
+
# combined_chain = prompt | llm
|
292 |
+
return RunnablePassthrough.assign(topic=prompt | llm) | RunnableBranch( (lambda x: "ticket" in x['topic'].lower(), df_chain), (lambda x: "dataframe" in x['topic'].lower(), df_chain), memory_chain )
|
293 |
|
294 |
|
295 |
class CustomLLM(LLM):
|