Spaces:
Running
Running
app19
Browse files
app.py
CHANGED
@@ -72,7 +72,7 @@ vectordb = Chroma.from_documents(
|
|
72 |
retriever = vectordb.as_retriever(search_kwargs={"k": 1}, search_type="mmr")
|
73 |
|
74 |
class FinalAnswer(BaseModel):
|
75 |
-
|
76 |
answer: str = Field(description="the extracted answer")
|
77 |
|
78 |
# Assuming you have a parser for the FinalAnswer class
|
@@ -80,8 +80,8 @@ parser = PydanticOutputParser(pydantic_object=FinalAnswer)
|
|
80 |
|
81 |
template = """
|
82 |
Your name is AngryGreta and you are a recycling chatbot with the objective to anwer querys from user in English or Spanish /
|
83 |
-
Use the following pieces of context to answer the
|
84 |
-
Answer in the same language of the
|
85 |
Context: {context}
|
86 |
Chat history: {chat_history}
|
87 |
User: {query}
|
@@ -94,7 +94,7 @@ qa_prompt = ChatPromptTemplate(
|
|
94 |
messages=[
|
95 |
sys_prompt,
|
96 |
MessagesPlaceholder(variable_name="chat_history"),
|
97 |
-
HumanMessagePromptTemplate.from_template("{
|
98 |
partial_variables={"format_instructions": parser.get_format_instructions()}
|
99 |
)
|
100 |
llm = HuggingFaceHub(
|
|
|
72 |
retriever = vectordb.as_retriever(search_kwargs={"k": 1}, search_type="mmr")
|
73 |
|
74 |
class FinalAnswer(BaseModel):
|
75 |
+
query: str = Field(description="the original query")
|
76 |
answer: str = Field(description="the extracted answer")
|
77 |
|
78 |
# Assuming you have a parser for the FinalAnswer class
|
|
|
80 |
|
81 |
template = """
|
82 |
Your name is AngryGreta and you are a recycling chatbot with the objective to anwer querys from user in English or Spanish /
|
83 |
+
Use the following pieces of context to answer the query /
|
84 |
+
Answer in the same language of the query /
|
85 |
Context: {context}
|
86 |
Chat history: {chat_history}
|
87 |
User: {query}
|
|
|
94 |
messages=[
|
95 |
sys_prompt,
|
96 |
MessagesPlaceholder(variable_name="chat_history"),
|
97 |
+
HumanMessagePromptTemplate.from_template("{query}")],
|
98 |
partial_variables={"format_instructions": parser.get_format_instructions()}
|
99 |
)
|
100 |
llm = HuggingFaceHub(
|