Skip to content

Commit 68077a6

Browse files
authored
Fixes: More detailed prompt & summary resolved (#22)
* fix: testing summary * fix debug statement * fix: summary prompting * remove prints * feat: more info on question and set * feat: more question info prompt
1 parent 4c81531 commit 68077a6

File tree

9 files changed

+34
-18
lines changed

9 files changed

+34
-18
lines changed

src/agents/base_agent/base_agent.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,12 @@ def summarize_conversation(self, state: State, config: RunnableConfig) -> dict:
120120
conversationalStyle_message = self.conversation_preference_prompt
121121

122122
# STEP 1: Summarize the conversation
123-
messages = [SystemMessage(content=summary_message)] + state["messages"][:-1]
123+
messages = state["messages"][:-1] + [HumanMessage(content=summary_message)]
124124
valid_messages = self.check_for_valid_messages(messages)
125125
summary_response = self.summarisation_llm.invoke(valid_messages)
126126

127127
# STEP 2: Analyze the conversational style
128-
messages = [SystemMessage(content=conversationalStyle_message)] + state["messages"][:-1]
128+
messages = state["messages"][:-1] + [HumanMessage(content=conversationalStyle_message)]
129129
valid_messages = self.check_for_valid_messages(messages)
130130
conversationalStyle_response = self.summarisation_llm.invoke(valid_messages)
131131

src/agents/base_agent/base_prompts.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,13 @@
6868
Structured: Organize the summary into sections such as 'Topics Discussed' and 'Top 3 Key Detailed Ideas'.
6969
Neutral and Accurate: Avoid adding interpretations or opinions; focus only on the content shared.
7070
When summarizing: If the conversation is technical, highlight significant concepts, solutions, and terminology. If context involves problem-solving, detail the problem and the steps or solutions provided. If the user asks for creative input, briefly describe the ideas presented.
71-
Last messages: Include the most recent 4 messages to provide context for the summary.
71+
Last messages: Include the most recent 5 messages to provide context for the summary.
7272
7373
Provide the summary in a bulleted format for clarity. Avoid redundant details while preserving the core intent of the discussion."""
7474

75-
summary_prompt = f"""Summarize the conversation between a student and a tutor. Your summary should highlight the major topics discussed during the session, followed by a detailed recollection of the last five significant points or ideas. Ensure the summary flows smoothly to maintain the continuity of the discussion."""
75+
summary_prompt = f"""Summarize the conversation between a student and a tutor. Your summary should highlight the major topics discussed during the session, followed by a detailed recollection of the last five significant points or ideas. Ensure the summary flows smoothly to maintain the continuity of the discussion.
76+
77+
{summary_guidelines}"""
7678

7779
update_summary_prompt = f"""Update the summary by taking into account the new messages above.
7880

src/agents/google_learnLM_agent/google_learnLM_agent.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,12 @@ def summarize_conversation(self, state: State, config: RunnableConfig) -> dict:
124124
conversationalStyle_message = self.conversation_preference_prompt
125125

126126
# STEP 1: Summarize the conversation
127-
messages = [SystemMessage(content=summary_message)] + state["messages"][:-1]
127+
messages = state["messages"][:-1] + [HumanMessage(content=summary_message)]
128128
valid_messages = self.check_for_valid_messages(messages)
129129
summary_response = self.summarisation_llm.invoke(valid_messages)
130130

131131
# STEP 2: Analyze the conversational style
132-
messages = [SystemMessage(content=conversationalStyle_message)] + state["messages"][:-1]
132+
messages = state["messages"][:-1] + [HumanMessage(content=conversationalStyle_message)]
133133
valid_messages = self.check_for_valid_messages(messages)
134134
conversationalStyle_response = self.summarisation_llm.invoke(valid_messages)
135135

src/agents/google_learnLM_agent/google_learnLM_prompts.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,13 @@
6868
Structured: Organize the summary into sections such as 'Topics Discussed' and 'Top 3 Key Detailed Ideas'.
6969
Neutral and Accurate: Avoid adding interpretations or opinions; focus only on the content shared.
7070
When summarizing: If the conversation is technical, highlight significant concepts, solutions, and terminology. If context involves problem-solving, detail the problem and the steps or solutions provided. If the user asks for creative input, briefly describe the ideas presented.
71-
Last messages: Include the most recent 4 messages to provide context for the summary.
71+
Last messages: Include the most recent 5 messages to provide context for the summary.
7272
7373
Provide the summary in a bulleted format for clarity. Avoid redundant details while preserving the core intent of the discussion."""
7474

75-
summary_prompt = f"""Summarize the conversation between a student and a tutor. Your summary should highlight the major topics discussed during the session, followed by a detailed recollection of the last five significant points or ideas. Ensure the summary flows smoothly to maintain the continuity of the discussion."""
75+
summary_prompt = f"""Summarize the conversation between a student and a tutor. Your summary should highlight the major topics discussed during the session, followed by a detailed recollection of the last five significant points or ideas. Ensure the summary flows smoothly to maintain the continuity of the discussion.
76+
77+
{summary_guidelines}"""
7678

7779
update_summary_prompt = f"""Update the summary by taking into account the new messages above.
7880

src/agents/informational_agent/informational_agent.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,12 @@ def summarize_conversation(self, state: State, config: RunnableConfig) -> dict:
122122
conversationalStyle_message = self.conversation_preference_prompt
123123

124124
# STEP 1: Summarize the conversation
125-
messages = [SystemMessage(content=summary_message)] + state["messages"][:-1]
125+
messages = state["messages"][:-1] + [HumanMessage(content=summary_message)]
126126
valid_messages = self.check_for_valid_messages(messages)
127127
summary_response = self.summarisation_llm.invoke(valid_messages)
128128

129129
# STEP 2: Analyze the conversational style
130-
messages = [SystemMessage(content=conversationalStyle_message)] + state["messages"][:-1]
130+
messages = state["messages"][:-1] + [HumanMessage(content=conversationalStyle_message)]
131131
valid_messages = self.check_for_valid_messages(messages)
132132
conversationalStyle_response = self.summarisation_llm.invoke(valid_messages)
133133

src/agents/informational_agent/informational_prompts.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,13 @@
133133
Structured: Organize the summary into sections such as 'Topics Discussed' and 'Top 3 Key Detailed Ideas'.
134134
Neutral and Accurate: Avoid adding interpretations or opinions; focus only on the content shared.
135135
When summarizing: If the conversation is technical, highlight significant concepts, solutions, and terminology. If context involves problem-solving, detail the problem and the steps or solutions provided. If the user asks for creative input, briefly describe the ideas presented.
136-
Last messages: Include the most recent 4 messages to provide context for the summary.
136+
Last messages: Include the most recent 5 messages to provide context for the summary.
137137
138138
Provide the summary in a bulleted format for clarity. Avoid redundant details while preserving the core intent of the discussion."""
139139

140-
summary_prompt = f"""Summarize the conversation between a student and a tutor. Your summary should highlight the major topics discussed during the session, followed by a detailed recollection of the last five significant points or ideas. Ensure the summary flows smoothly to maintain the continuity of the discussion."""
140+
summary_prompt = f"""Summarize the conversation between a student and a tutor. Your summary should highlight the major topics discussed during the session, followed by a detailed recollection of the last five significant points or ideas. Ensure the summary flows smoothly to maintain the continuity of the discussion.
141+
142+
{summary_guidelines}"""
141143

142144
update_summary_prompt = f"""Update the summary by taking into account the new messages above.
143145

src/agents/socratic_agent/socratic_agent.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,12 @@ def summarize_conversation(self, state: State, config: RunnableConfig) -> dict:
122122
# conversationalStyle_message = self.conversation_preference_prompt
123123

124124
# STEP 1: Summarize the conversation
125-
messages = [SystemMessage(content=summary_message)] + state["messages"][:-1]
125+
messages = state["messages"][:-1] + [HumanMessage(content=summary_message)]
126126
valid_messages = self.check_for_valid_messages(messages)
127127
summary_response = self.summarisation_llm.invoke(valid_messages)
128128

129129
# STEP 2: Analyze the conversational style
130-
# messages = [SystemMessage(content=conversationalStyle_message)] + state["messages"][:-1]
130+
# messages = state["messages"][:-1] + [HumanMessage(content=conversationalStyle_message)]
131131
# valid_messages = self.check_for_valid_messages(messages)
132132
# conversationalStyle_response = self.summarisation_llm.invoke(valid_messages)
133133

src/agents/socratic_agent/socratic_prompts.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,13 @@
9292
Structured: Organize the summary into sections such as 'Topics Discussed' and 'Top 3 Key Detailed Ideas'.
9393
Neutral and Accurate: Avoid adding interpretations or opinions; focus only on the content shared.
9494
When summarizing: If the conversation is technical, highlight significant concepts, solutions, and terminology. If context involves problem-solving, detail the problem and the steps or solutions provided. If the user asks for creative input, briefly describe the ideas presented.
95-
Last messages: Include the most recent 4 messages to provide context for the summary.
95+
Last messages: Include the most recent 5 messages to provide context for the summary.
9696
9797
Provide the summary in a bulleted format for clarity. Avoid redundant details while preserving the core intent of the discussion."""
9898

99-
summary_prompt = f"""Summarize the conversation between a student and a tutor. Your summary should highlight the major topics discussed during the session, followed by a detailed recollection of the last five significant points or ideas. Ensure the summary flows smoothly to maintain the continuity of the discussion."""
99+
summary_prompt = f"""Summarize the conversation between a student and a tutor. Your summary should highlight the major topics discussed during the session, followed by a detailed recollection of the last five significant points or ideas. Ensure the summary flows smoothly to maintain the continuity of the discussion.
100+
101+
{summary_guidelines}"""
100102

101103
update_summary_prompt = f"""Update the summary by taking into account the new messages above.
102104

src/agents/utils/parse_json_to_prompt.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,21 @@ def __init__(
8383
class QuestionDetails:
8484
def __init__(
8585
self,
86+
setNumber: Optional[int] = None,
87+
setName: Optional[str] = None,
88+
setDescription: Optional[str] = None,
89+
questionNumber: Optional[int] = None,
8690
questionTitle: Optional[str] = None,
8791
questionGuidance: Optional[str] = None,
8892
questionContent: Optional[str] = None,
8993
durationLowerBound: Optional[int] = None,
9094
durationUpperBound: Optional[int] = None,
9195
parts: Optional[List[PartDetails]] = [],
9296
):
97+
self.setNumber = setNumber
98+
self.setName = setName
99+
self.setDescription = setDescription
100+
self.questionNumber = questionNumber
93101
self.questionTitle = questionTitle
94102
self.questionGuidance = questionGuidance
95103
self.questionContent = questionContent
@@ -186,8 +194,8 @@ def format_part_details(part: PartDetails, currentPart: CurrentPart, summary: Li
186194

187195
questionDetails = f"""This is the question I am currently working on. I am currently working on Part ({convert_index_to_lowercase_letter(questionAccessInformation.currentPart.position)}). Below, you'll find its details, including the parts of the question, my responses for each response area, and the feedback I received. This information highlights my efforts and progress so far. Use this this information to inform your understanding about the question materials provided to me and my work on them.
188196
Maths equations are in KaTex format, preserve them the same. Use British English spellings.
189-
190-
# Question: {questionInformation.questionTitle};
197+
{f'# Question Set {questionInformation.setNumber + 1}: {questionInformation.setName};' if questionInformation.setName and questionInformation.setNumber else ''}
198+
# Question{f' {questionInformation.setNumber + 1}.{questionInformation.questionNumber + 1}' if questionInformation.setNumber and questionInformation.questionNumber else ''}: {questionInformation.questionTitle};
191199
Guidance to Solve the Question: {questionInformation.questionGuidance or 'None'};
192200
Description of Question: {questionInformation.questionContent};
193201
Expected Time to Complete the Question: {f'{questionInformation.durationLowerBound} - {questionInformation.durationUpperBound} min;' if questionInformation.durationLowerBound and questionInformation.durationUpperBound else 'No specified duration.'}

0 commit comments

Comments
 (0)