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 4238fd1 commit adade60
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
21 changes: 13 additions & 8 deletions src/backend/RAG/LangChain_Implementation/combined_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,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 @@ -111,14 +111,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 @@ -150,10 +149,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
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,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 @@ -159,14 +159,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}'

# Parallel processing
Expand Down

0 comments on commit adade60

Please sign in to comment.