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>;
241
241
export const AssistantContent = z . discriminatedUnion ( 'type' , [
242
242
OutputText ,
243
243
Refusal ,
244
- InputText ,
245
244
AudioContent ,
246
245
ImageContent ,
247
246
] ) ;
Original file line number Diff line number Diff line change @@ -116,29 +116,16 @@ export function itemsToLanguageV1Messages(
116
116
messages . push ( {
117
117
role,
118
118
content : content
119
- . filter ( ( c ) => c . type === 'input_text' || c . type === ' output_text')
119
+ . filter ( ( c ) => c . type === 'output_text' )
120
120
. map ( ( c ) => {
121
121
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
+ } ;
142
129
} ) ,
143
130
providerMetadata : {
144
131
...( providerData ?? { } ) ,
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ export function extractAllAssistantContent(
37
37
}
38
38
const out : ChatCompletionAssistantMessageParam [ 'content' ] = [ ] ;
39
39
for ( const c of content ) {
40
- if ( c . type === 'output_text' || c . type === 'input_text' ) {
40
+ if ( c . type === 'output_text' ) {
41
41
out . push ( {
42
42
type : 'text' ,
43
43
text : c . text ,
You can’t perform that action at this time.
0 commit comments