File tree Expand file tree Collapse file tree 4 files changed +16
-23
lines changed Expand file tree Collapse file tree 4 files changed +16
-23
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @openai/agents-core " : patch
3+ " @openai/agents-extensions " : patch
4+ " @openai/agents-openai " : patch
5+ ---
6+
7+ Fix #233 - eliminate confusion with "input_text" type items with role: "assistant"
Original file line number Diff line number Diff line change @@ -241,7 +241,6 @@ export type ComputerAction = z.infer<typeof computerActions>;
241241export const AssistantContent = z . discriminatedUnion ( 'type' , [
242242 OutputText ,
243243 Refusal ,
244- InputText ,
245244 AudioContent ,
246245 ImageContent ,
247246] ) ;
Original file line number Diff line number Diff line change @@ -116,29 +116,16 @@ export function itemsToLanguageV1Messages(
116116 messages . push ( {
117117 role,
118118 content : content
119- . filter ( ( c ) => c . type === 'input_text' || c . type === ' output_text')
119+ . filter ( ( c ) => c . type === 'output_text' )
120120 . map ( ( c ) => {
121121 const { providerData : contentProviderData } = c ;
122- if ( c . type === 'output_text' ) {
123- return {
124- type : 'text' ,
125- text : c . text ,
126- providerMetadata : {
127- ...( contentProviderData ?? { } ) ,
128- } ,
129- } ;
130- }
131- if ( c . type === 'input_text' ) {
132- return {
133- type : 'text' ,
134- text : c . text ,
135- providerMetadata : {
136- ...( contentProviderData ?? { } ) ,
137- } ,
138- } ;
139- }
140- const exhaustiveCheck = c satisfies never ;
141- throw new UserError ( `Unknown content type: ${ exhaustiveCheck } ` ) ;
122+ return {
123+ type : 'text' ,
124+ text : c . text ,
125+ providerMetadata : {
126+ ...( contentProviderData ?? { } ) ,
127+ } ,
128+ } ;
142129 } ) ,
143130 providerMetadata : {
144131 ...( providerData ?? { } ) ,
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ export function extractAllAssistantContent(
3737 }
3838 const out : ChatCompletionAssistantMessageParam [ 'content' ] = [ ] ;
3939 for ( const c of content ) {
40- if ( c . type === 'output_text' || c . type === 'input_text' ) {
40+ if ( c . type === 'output_text' ) {
4141 out . push ( {
4242 type : 'text' ,
4343 text : c . text ,
You can’t perform that action at this time.
0 commit comments