Update app.py
Browse files
app.py
CHANGED
@@ -104,6 +104,7 @@ knowledge_base = KnowledgeBase()
|
|
104 |
# LLMs
|
105 |
# repharser_llm = ChatNVIDIA(model="mistralai/mistral-7b-instruct-v0.3") | StrOutputParser()
|
106 |
repharser_llm = ChatNVIDIA(model="microsoft/phi-3-mini-4k-instruct") | StrOutputParser()
|
|
|
107 |
instruct_llm = ChatNVIDIA(model="mistralai/mixtral-8x22b-instruct-v0.1") | StrOutputParser()
|
108 |
relevance_llm = ChatNVIDIA(model="nvidia/llama-3.1-nemotron-70b-instruct") | StrOutputParser()
|
109 |
answer_llm = ChatOpenAI(
|
@@ -369,7 +370,7 @@ extract_validation_inputs = RunnableLambda(lambda x: {
|
|
369 |
validation_chain = (
|
370 |
extract_validation_inputs
|
371 |
| relevance_prompt
|
372 |
-
|
|
373 |
| RunnableLambda(safe_json_parse)
|
374 |
)
|
375 |
|
@@ -394,7 +395,7 @@ select_and_prompt = RunnableLambda(lambda x:
|
|
394 |
answer_chain = (
|
395 |
prepare_answer_inputs
|
396 |
| select_and_prompt
|
397 |
-
|
|
398 |
)
|
399 |
|
400 |
def RExtract(pydantic_class: Type[BaseModel], llm, prompt):
|
@@ -422,7 +423,7 @@ def RExtract(pydantic_class: Type[BaseModel], llm, prompt):
|
|
422 |
|
423 |
knowledge_extractor = RExtract(
|
424 |
pydantic_class=KnowledgeBase,
|
425 |
-
llm=
|
426 |
prompt=parser_prompt
|
427 |
)
|
428 |
|
@@ -464,7 +465,7 @@ def chat_interface(message, history):
|
|
464 |
"query": message,
|
465 |
"all_queries": [message],
|
466 |
"all_texts": all_chunks,
|
467 |
-
"k_per_query":
|
468 |
"alpha": 0.5,
|
469 |
"vectorstore": vectorstore,
|
470 |
"bm25_retriever": bm25_retriever,
|
@@ -529,7 +530,7 @@ demo = gr.ChatInterface(
|
|
529 |
description="💡 Ask anything about Krishna Vamsi Dhulipalla",
|
530 |
examples=[
|
531 |
"Give me an overview of Krishna Vamsi Dhulipalla’s work experience across different roles?",
|
532 |
-
"What programming languages and tools does Krishna use for data science?",
|
533 |
"Can this chatbot tell me what Krishna's chatbot architecture looks like and how it works?"
|
534 |
],
|
535 |
)
|
|
|
104 |
# LLMs
|
105 |
# repharser_llm = ChatNVIDIA(model="mistralai/mistral-7b-instruct-v0.3") | StrOutputParser()
|
106 |
repharser_llm = ChatNVIDIA(model="microsoft/phi-3-mini-4k-instruct") | StrOutputParser()
|
107 |
+
validation_llm = ChatNVIDIA(model="microsoft/phi-3-small-8k-instruct") | StrOutputParser()
|
108 |
instruct_llm = ChatNVIDIA(model="mistralai/mixtral-8x22b-instruct-v0.1") | StrOutputParser()
|
109 |
relevance_llm = ChatNVIDIA(model="nvidia/llama-3.1-nemotron-70b-instruct") | StrOutputParser()
|
110 |
answer_llm = ChatOpenAI(
|
|
|
370 |
validation_chain = (
|
371 |
extract_validation_inputs
|
372 |
| relevance_prompt
|
373 |
+
| validation_llm
|
374 |
| RunnableLambda(safe_json_parse)
|
375 |
)
|
376 |
|
|
|
395 |
answer_chain = (
|
396 |
prepare_answer_inputs
|
397 |
| select_and_prompt
|
398 |
+
| answer_llm
|
399 |
)
|
400 |
|
401 |
def RExtract(pydantic_class: Type[BaseModel], llm, prompt):
|
|
|
423 |
|
424 |
knowledge_extractor = RExtract(
|
425 |
pydantic_class=KnowledgeBase,
|
426 |
+
llm=validation_llm,
|
427 |
prompt=parser_prompt
|
428 |
)
|
429 |
|
|
|
465 |
"query": message,
|
466 |
"all_queries": [message],
|
467 |
"all_texts": all_chunks,
|
468 |
+
"k_per_query": 7,
|
469 |
"alpha": 0.5,
|
470 |
"vectorstore": vectorstore,
|
471 |
"bm25_retriever": bm25_retriever,
|
|
|
530 |
description="💡 Ask anything about Krishna Vamsi Dhulipalla",
|
531 |
examples=[
|
532 |
"Give me an overview of Krishna Vamsi Dhulipalla’s work experience across different roles?",
|
533 |
+
"What programming languages and tools does Krishna use for data science and data engineering?",
|
534 |
"Can this chatbot tell me what Krishna's chatbot architecture looks like and how it works?"
|
535 |
],
|
536 |
)
|