File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
packages/agents-openai/src Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @openai/agents-openai " : patch
3
+ ---
4
+
5
+ Handle function call messages with empty content in Chat Completions
Original file line number Diff line number Diff line change @@ -67,7 +67,13 @@ export class OpenAIChatCompletionsModel implements Model {
67
67
const output : protocol . OutputModelItem [ ] = [ ] ;
68
68
if ( response . choices && response . choices [ 0 ] ) {
69
69
const message = response . choices [ 0 ] . message ;
70
- if ( message . content !== undefined && message . content !== null ) {
70
+
71
+ if (
72
+ message . content !== undefined &&
73
+ message . content !== null &&
74
+ // Azure OpenAI returns empty string instead of null for tool calls, causing parser rejection
75
+ ! ( message . tool_calls && message . content === '' )
76
+ ) {
71
77
const { content, ...rest } = message ;
72
78
output . push ( {
73
79
id : response . id ,
You can’t perform that action at this time.
0 commit comments