4
4
5
5
from agents import (
6
6
Agent ,
7
+ ItemHelpers ,
7
8
ModelSettings ,
8
9
OpenAIChatCompletionsModel ,
9
10
Runner ,
@@ -124,7 +125,8 @@ async def prepare_context(self) -> tuple[list[ItemPublic], list[ThoughtStep]]:
124
125
thoughts = [
125
126
ThoughtStep (
126
127
title = "Prompt to generate search arguments" ,
127
- description = [{"content" : self .search_agent .instructions }] + run_results .input ,
128
+ description = [{"content" : self .query_prompt_template }]
129
+ + ItemHelpers .input_to_new_input_list (run_results .input ),
128
130
props = self .model_for_thoughts ,
129
131
),
130
132
ThoughtStep (
@@ -163,7 +165,8 @@ async def answer(
163
165
+ [
164
166
ThoughtStep (
165
167
title = "Prompt to generate answer" ,
166
- description = [{"content" : self .answer_agent .instructions }] + run_results .input ,
168
+ description = [{"content" : self .answer_prompt_template }]
169
+ + ItemHelpers .input_to_new_input_list (run_results .input ),
167
170
props = self .model_for_thoughts ,
168
171
),
169
172
],
@@ -178,7 +181,7 @@ async def answer_stream(
178
181
run_results = Runner .run_streamed (
179
182
self .answer_agent ,
180
183
input = self .chat_params .past_messages
181
- + [{"content" : self .prepare_rag_request (self .chat_params .original_user_query , items ), "role" : "user" }],
184
+ + [{"content" : self .prepare_rag_request (self .chat_params .original_user_query , items ), "role" : "user" }], # noqa
182
185
)
183
186
184
187
yield RetrievalResponseDelta (
@@ -188,7 +191,8 @@ async def answer_stream(
188
191
+ [
189
192
ThoughtStep (
190
193
title = "Prompt to generate answer" ,
191
- description = [{"content" : self .answer_agent .instructions }] + run_results .input ,
194
+ description = [{"content" : self .answer_prompt_template }]
195
+ + ItemHelpers .input_to_new_input_list (run_results .input ),
192
196
props = self .model_for_thoughts ,
193
197
),
194
198
],
0 commit comments