@@ -34,11 +34,11 @@ import {
3434import { APIPromise } from '../../../../api-promise' ;
3535import { CursorPage , type CursorPageParams , PagePromise } from '../../../../pagination' ;
3636import { Stream } from '../../../../streaming' ;
37+ import { buildHeaders } from '../../../../internal/headers' ;
3738import { RequestOptions } from '../../../../internal/request-options' ;
3839import { AssistantStream , RunCreateParamsBaseStream } from '../../../../lib/AssistantStream' ;
3940import { sleep } from '../../../../internal/utils/sleep' ;
4041import { RunSubmitToolOutputsParamsStream } from '../../../../lib/AssistantStream' ;
41- import { buildHeaders } from '../../../../internal/headers' ;
4242
4343export class Runs extends APIResource {
4444 steps : StepsAPI . Steps = new StepsAPI . Steps ( this . _client ) ;
@@ -67,7 +67,7 @@ export class Runs extends APIResource {
6767 query : { include } ,
6868 body,
6969 ...options ,
70- headers : { 'OpenAI-Beta' : 'assistants=v2' , ... options ?. headers } ,
70+ headers : buildHeaders ( [ { 'OpenAI-Beta' : 'assistants=v2' } , options ?. headers ] ) ,
7171 stream : params . stream ?? false ,
7272 } ) as APIPromise < Run > | APIPromise < Stream < AssistantsAPI . AssistantStreamEvent > > ;
7373 }
@@ -79,7 +79,7 @@ export class Runs extends APIResource {
7979 const { thread_id } = params ;
8080 return this . _client . get ( `/threads/${ thread_id } /runs/${ runID } ` , {
8181 ...options ,
82- headers : { 'OpenAI-Beta' : 'assistants=v2' , ... options ?. headers } ,
82+ headers : buildHeaders ( [ { 'OpenAI-Beta' : 'assistants=v2' } , options ?. headers ] ) ,
8383 } ) ;
8484 }
8585
@@ -91,7 +91,7 @@ export class Runs extends APIResource {
9191 return this . _client . post ( `/threads/${ thread_id } /runs/${ runID } ` , {
9292 body,
9393 ...options ,
94- headers : { 'OpenAI-Beta' : 'assistants=v2' , ... options ?. headers } ,
94+ headers : buildHeaders ( [ { 'OpenAI-Beta' : 'assistants=v2' } , options ?. headers ] ) ,
9595 } ) ;
9696 }
9797
@@ -106,7 +106,7 @@ export class Runs extends APIResource {
106106 return this . _client . getAPIList ( `/threads/${ threadID } /runs` , CursorPage < Run > , {
107107 query,
108108 ...options ,
109- headers : { 'OpenAI-Beta' : 'assistants=v2' , ... options ?. headers } ,
109+ headers : buildHeaders ( [ { 'OpenAI-Beta' : 'assistants=v2' } , options ?. headers ] ) ,
110110 } ) ;
111111 }
112112
@@ -117,7 +117,7 @@ export class Runs extends APIResource {
117117 const { thread_id } = params ;
118118 return this . _client . post ( `/threads/${ thread_id } /runs/${ runID } /cancel` , {
119119 ...options ,
120- headers : { 'OpenAI-Beta' : 'assistants=v2' , ... options ?. headers } ,
120+ headers : buildHeaders ( [ { 'OpenAI-Beta' : 'assistants=v2' } , options ?. headers ] ) ,
121121 } ) ;
122122 }
123123
@@ -241,7 +241,7 @@ export class Runs extends APIResource {
241241 return this . _client . post ( `/threads/${ thread_id } /runs/${ runID } /submit_tool_outputs` , {
242242 body,
243243 ...options ,
244- headers : { 'OpenAI-Beta' : 'assistants=v2' , ... options ?. headers } ,
244+ headers : buildHeaders ( [ { 'OpenAI-Beta' : 'assistants=v2' } , options ?. headers ] ) ,
245245 stream : params . stream ?? false ,
246246 } ) as APIPromise < Run > | APIPromise < Stream < AssistantsAPI . AssistantStreamEvent > > ;
247247 }
0 commit comments