Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
Signed-off-by: potthoffjan <[email protected]>
  • Loading branch information
potthoffjan committed Jul 16, 2024
1 parent 6b2fcd7 commit 4238fd1
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions functions/chain.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import concurrent.futures
from os import environ

from get_google_docs import get_inital_prompt
Expand Down Expand Up @@ -69,13 +68,13 @@ def hist_aware_answers(llm_list, input_string, message_history):
which might reference context in the chat history, formulate a standalone question \
which can be understood without the chat history. Do NOT answer the question, \
just reformulate it if needed and otherwise return it as is."""

# add in custom user info: -----------------------------
# custom_istructions = get_custom_instructions_callable()
# user_info = " "
# if custom_istructions:
# user_info = f"""Here is some information about the user, including the user's name,
# their profile description and style instructions on how they want you to answer stylewise:
# user_info = f"""Here is some information about the user, including the user's name,
# their profile description and style instructions on how they want you to answer stylewise:
# User Name: {custom_istructions['name']}
# Style Instrctions: {custom_istructions['styleInstructions']}
# Personal Info: {custom_istructions['personalInstructions']}
Expand All @@ -89,14 +88,13 @@ def hist_aware_answers(llm_list, input_string, message_history):
to answer accurately. write your response in markdown form and also add reference url
so user can know from which source you are answering the questions.
"""
context_str ="""

context_str = """
CONTEXT:
{context}
"""


# health_ai_template = f'{init_prompt}{agent_str}{user_info}{context_str}'
health_ai_template = f'{init_prompt}{agent_str}{context_str}'

Expand Down Expand Up @@ -128,10 +126,16 @@ def hist_aware_answers(llm_list, input_string, message_history):
('human', '{input}'),
]
)
history_aware_retriever = create_history_aware_retriever(llm, retriever, contextualize_q_prompt)
history_aware_retriever = create_history_aware_retriever(
llm, retriever, contextualize_q_prompt
)

qa_prompt = ChatPromptTemplate.from_messages(
[('system', health_ai_template), MessagesPlaceholder('chat_history'), ('human', '{input}')]
[
('system', health_ai_template),
MessagesPlaceholder('chat_history'),
('human', '{input}'),
]
)

question_answer_chain = create_stuff_documents_chain(llm, qa_prompt)
Expand Down

0 comments on commit 4238fd1

Please sign in to comment.