Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Handoff filters

default_handoff_history_mapper

default_handoff_history_mapper(transcript:list[TResponseInputItem],)->list[TResponseInputItem]

Return a single assistant message summarizing the transcript.

Source code insrc/agents/handoffs/history.py
defdefault_handoff_history_mapper(transcript:list[TResponseInputItem],)->list[TResponseInputItem]:"""Return a single assistant message summarizing the transcript."""summary_message=_build_summary_message(transcript)return[summary_message]

nest_handoff_history

nest_handoff_history(handoff_input_data:HandoffInputData,*,history_mapper:HandoffHistoryMapper|None=None,)->HandoffInputData

Summarize the previous transcript for the next agent.

Source code insrc/agents/handoffs/history.py
defnest_handoff_history(handoff_input_data:HandoffInputData,*,history_mapper:HandoffHistoryMapper|None=None,)->HandoffInputData:"""Summarize the previous transcript for the next agent."""normalized_history=_normalize_input_history(handoff_input_data.input_history)flattened_history=_flatten_nested_history_messages(normalized_history)pre_items_as_inputs=[_run_item_to_plain_input(item)foriteminhandoff_input_data.pre_handoff_items]new_items_as_inputs=[_run_item_to_plain_input(item)foriteminhandoff_input_data.new_items]transcript=flattened_history+pre_items_as_inputs+new_items_as_inputsmapper=history_mapperordefault_handoff_history_mapperhistory_items=mapper(transcript)filtered_pre_items=tuple(itemforiteminhandoff_input_data.pre_handoff_itemsif_get_run_item_role(item)!="assistant")returnhandoff_input_data.clone(input_history=tuple(deepcopy(item)foriteminhistory_items),pre_handoff_items=filtered_pre_items,)

remove_all_tools

remove_all_tools(handoff_input_data:HandoffInputData,)->HandoffInputData

Filters out all tool items: file search, web search and function calls+output.

Source code insrc/agents/extensions/handoff_filters.py
defremove_all_tools(handoff_input_data:HandoffInputData)->HandoffInputData:"""Filters out all tool items: file search, web search and function calls+output."""history=handoff_input_data.input_historynew_items=handoff_input_data.new_itemsfiltered_history=(_remove_tool_types_from_input(history)ifisinstance(history,tuple)elsehistory)filtered_pre_handoff_items=_remove_tools_from_items(handoff_input_data.pre_handoff_items)filtered_new_items=_remove_tools_from_items(new_items)returnHandoffInputData(input_history=filtered_history,pre_handoff_items=filtered_pre_handoff_items,new_items=filtered_new_items,run_context=handoff_input_data.run_context,)

[8]ページ先頭

©2009-2025 Movatter.jp