mirror of
https://github.com/StanGirard/quivr.git
synced 2024-08-17 00:50:37 +03:00
feat(functions): improved by removing only get_context (#459)
This commit is contained in:
parent
12809312f0
commit
dcaa70a947
@ -100,7 +100,7 @@ class BrainPickingOpenAIFunctions(BrainPicking):
|
||||
system_messages = [
|
||||
{
|
||||
"role": "system",
|
||||
"content": "Your name is Quivr. You are a second brain. A person will ask you a question and you will provide a helpful answer. Write the answer in the same language as the question.If you don't know the answer, just say that you don't know. Don't try to make up an answer.our main goal is to answer questions about user uploaded documents. Unless basic questions or greetings, you should always refer to user uploaded documents by fetching them with the get_context function. If the user ask a question that is not common knowledge for a 10 years old, then use get_context to find a document that can help you answer the question. If the user ask a question that is common knowledge for a 10 years old, then you can answer the question without using get_context.",
|
||||
"content": "Your name is Quivr. You are a second brain. A person will ask you a question and you will provide a helpful answer. Write the answer in the same language as the question.If you don't know the answer, just say that you don't know. Don't try to make up an answer.our main goal is to answer questions about user uploaded documents. Unless basic questions or greetings, you should always refer to user uploaded documents by fetching them with the get_history_and_context function. If the user ask a question that is not common knowledge for a 10 years old, then use get_history_and_context to find a document that can help you answer the question. If the user ask a question that is common knowledge for a 10 years old, then you can answer the question without using get_history_and_context.",
|
||||
}
|
||||
]
|
||||
|
||||
@ -133,11 +133,6 @@ class BrainPickingOpenAIFunctions(BrainPicking):
|
||||
"description": "Used to get the chat history between the user and the assistant",
|
||||
"parameters": {"type": "object", "properties": {}},
|
||||
},
|
||||
{
|
||||
"name": "get_context",
|
||||
"description": "Used for retrieving documents related to the question to help answer the question",
|
||||
"parameters": {"type": "object", "properties": {}},
|
||||
},
|
||||
{
|
||||
"name": "get_history_and_context",
|
||||
"description": "Used for retrieving documents related to the question to help answer the question and the previous chat history",
|
||||
@ -164,20 +159,6 @@ class BrainPickingOpenAIFunctions(BrainPicking):
|
||||
|
||||
formatted_response = format_answer(response)
|
||||
|
||||
# If the model calls for context, try again with context included
|
||||
if (
|
||||
formatted_response.function_call
|
||||
and formatted_response.function_call.name == "get_context"
|
||||
):
|
||||
logger.info("Model called for context")
|
||||
response = self._get_model_response(
|
||||
messages=self._construct_prompt(
|
||||
question, useContext=True, useHistory=False
|
||||
),
|
||||
functions=[],
|
||||
)
|
||||
formatted_response = format_answer(response)
|
||||
|
||||
if (
|
||||
formatted_response.function_call
|
||||
and formatted_response.function_call.name == "get_history_and_context"
|
||||
|
Loading…
Reference in New Issue
Block a user