File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed
Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -690,10 +690,26 @@ async def hidden_context_to_input(
690690 ) -> TResponseInputItem | list [TResponseInputItem ] | None :
691691 """
692692 Convert a HiddenContextItem into input item(s) to send to the model.
693- Required when HiddenContextItem are used.
693+ Required to override when HiddenContextItems with non-string content are used.
694694 """
695- raise NotImplementedError (
696- "HiddenContextItem were present in a user message but Converter.hidden_context_to_input was not implemented"
695+ if not isinstance (item .content , str ):
696+ raise NotImplementedError (
697+ "HiddenContextItems with non-string content were present in a user message but a Converter.hidden_context_to_input was not implemented"
698+ )
699+
700+ text = (
701+ "Hidden context for the agent (not shown to the user):\n "
702+ f"<HiddenContext>\n { item .content } \n </HiddenContext>"
703+ )
704+ return Message (
705+ type = "message" ,
706+ content = [
707+ ResponseInputTextParam (
708+ type = "input_text" ,
709+ text = text ,
710+ )
711+ ],
712+ role = "user" ,
697713 )
698714
699715 async def task_to_input (
You can’t perform that action at this time.
0 commit comments