44
55from agents import (
66 Agent ,
7+ ItemHelpers ,
78 ModelSettings ,
89 OpenAIChatCompletionsModel ,
910 Runner ,
@@ -124,7 +125,8 @@ async def prepare_context(self) -> tuple[list[ItemPublic], list[ThoughtStep]]:
124125 thoughts = [
125126 ThoughtStep (
126127 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 ),
128130 props = self .model_for_thoughts ,
129131 ),
130132 ThoughtStep (
@@ -163,7 +165,8 @@ async def answer(
163165 + [
164166 ThoughtStep (
165167 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 ),
167170 props = self .model_for_thoughts ,
168171 ),
169172 ],
@@ -178,7 +181,7 @@ async def answer_stream(
178181 run_results = Runner .run_streamed (
179182 self .answer_agent ,
180183 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
182185 )
183186
184187 yield RetrievalResponseDelta (
@@ -188,7 +191,8 @@ async def answer_stream(
188191 + [
189192 ThoughtStep (
190193 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 ),
192196 props = self .model_for_thoughts ,
193197 ),
194198 ],
0 commit comments