AI Evy
10/06/2025, 4:41 PMAI Evy
10/06/2025, 4:41 PMprepare_prompt method after yielding a func_result object
2. Checking before streaming the agent response whether the previous function call was the problematic one
3. Verifying if the message before it is an assistant message with the exact message yielded in the function call
4. If conditions match, preventing the loop from yielding a response
python
if chunk.choices[0].delta.content:
output += chunk.choices[0].delta.content
if '*' in chunk.choices[0].delta.content:
chunk.choices[0].delta.content = chunk.choices[0].delta.content.replace('*', '')
if not should_stay_quite(prompt) :
response = ResponseResponse(
response_id=request.response_id,
content=chunk.choices[0].delta.content,
content_complete=False,
end_call=False,
)
yield responseAI Evy
10/06/2025, 4:41 PMAI Evy
10/06/2025, 4:41 PMAI Evy
10/06/2025, 4:42 PM