@@ -14,31 +14,30 @@ export class TurnResource extends APIResource {
1414 sessionId : string ,
1515 body : TurnCreateParamsNonStreaming ,
1616 options ?: Core . RequestOptions ,
17- ) : APIPromise < TurnCreateResponse > ;
17+ ) : APIPromise < Turn > ;
1818 create (
1919 agentId : string ,
2020 sessionId : string ,
2121 body : TurnCreateParamsStreaming ,
2222 options ?: Core . RequestOptions ,
23- ) : APIPromise < Stream < TurnCreateResponse > > ;
23+ ) : APIPromise < Stream < AgentTurnResponseStreamChunk > > ;
2424 create (
2525 agentId : string ,
2626 sessionId : string ,
2727 body : TurnCreateParamsBase ,
2828 options ?: Core . RequestOptions ,
29- ) : APIPromise < Stream < TurnCreateResponse > | TurnCreateResponse > ;
29+ ) : APIPromise < Stream < AgentTurnResponseStreamChunk > | Turn > ;
3030 create (
3131 agentId : string ,
3232 sessionId : string ,
3333 body : TurnCreateParams ,
3434 options ?: Core . RequestOptions ,
35- ) : APIPromise < TurnCreateResponse > | APIPromise < Stream < TurnCreateResponse > > {
35+ ) : APIPromise < Turn > | APIPromise < Stream < AgentTurnResponseStreamChunk > > {
3636 return this . _client . post ( `/v1/agents/${ agentId } /session/${ sessionId } /turn` , {
3737 body,
3838 ...options ,
39- headers : { Accept : 'text/event-stream' , ...options ?. headers } ,
4039 stream : body . stream ?? false ,
41- } ) as APIPromise < TurnCreateResponse > | APIPromise < Stream < TurnCreateResponse > > ;
40+ } ) as APIPromise < Turn > | APIPromise < Stream < AgentTurnResponseStreamChunk > > ;
4241 }
4342
4443 retrieve (
@@ -51,6 +50,10 @@ export class TurnResource extends APIResource {
5150 }
5251}
5352
53+ export interface AgentTurnResponseStreamChunk {
54+ event : TurnResponseEvent ;
55+ }
56+
5457export interface Turn {
5558 input_messages : Array < Shared . UserMessage | Shared . ToolResponseMessage > ;
5659
@@ -88,22 +91,44 @@ export namespace Turn {
8891
8992 export namespace OutputAttachment {
9093 export interface ImageContentItem {
94+ /**
95+ * Image as a base64 encoded string or an URL
96+ */
9197 image : ImageContentItem . Image ;
9298
99+ /**
100+ * Discriminator type of the content item. Always "image"
101+ */
93102 type : 'image' ;
94103 }
95104
96105 export namespace ImageContentItem {
106+ /**
107+ * Image as a base64 encoded string or an URL
108+ */
97109 export interface Image {
110+ /**
111+ * base64 encoded image data as string
112+ */
98113 data ?: string ;
99114
115+ /**
116+ * A URL of the image or data URL in the format of data:image/{type};base64,{data}.
117+ * Note that URL could have length limits.
118+ */
100119 url ?: Shared . URL ;
101120 }
102121 }
103122
104123 export interface TextContentItem {
124+ /**
125+ * Text content
126+ */
105127 text : string ;
106128
129+ /**
130+ * Discriminator type of the content item. Always "text"
131+ */
107132 type : 'text' ;
108133 }
109134 }
@@ -168,14 +193,6 @@ export namespace TurnResponseEventPayload {
168193 }
169194}
170195
171- export type TurnCreateResponse = Turn | TurnCreateResponse . AgentTurnResponseStreamChunk ;
172-
173- export namespace TurnCreateResponse {
174- export interface AgentTurnResponseStreamChunk {
175- event : TurnAPI . TurnResponseEvent ;
176- }
177- }
178-
179196export type TurnCreateParams = TurnCreateParamsNonStreaming | TurnCreateParamsStreaming ;
180197
181198export interface TurnCreateParamsBase {
@@ -202,22 +219,44 @@ export namespace TurnCreateParams {
202219
203220 export namespace Document {
204221 export interface ImageContentItem {
222+ /**
223+ * Image as a base64 encoded string or an URL
224+ */
205225 image : ImageContentItem . Image ;
206226
227+ /**
228+ * Discriminator type of the content item. Always "image"
229+ */
207230 type : 'image' ;
208231 }
209232
210233 export namespace ImageContentItem {
234+ /**
235+ * Image as a base64 encoded string or an URL
236+ */
211237 export interface Image {
238+ /**
239+ * base64 encoded image data as string
240+ */
212241 data ?: string ;
213242
243+ /**
244+ * A URL of the image or data URL in the format of data:image/{type};base64,{data}.
245+ * Note that URL could have length limits.
246+ */
214247 url ?: Shared . URL ;
215248 }
216249 }
217250
218251 export interface TextContentItem {
252+ /**
253+ * Text content
254+ */
219255 text : string ;
220256
257+ /**
258+ * Discriminator type of the content item. Always "text"
259+ */
221260 type : 'text' ;
222261 }
223262 }
@@ -242,10 +281,10 @@ export interface TurnCreateParamsStreaming extends TurnCreateParamsBase {
242281
243282export declare namespace TurnResource {
244283 export {
284+ type AgentTurnResponseStreamChunk as AgentTurnResponseStreamChunk ,
245285 type Turn as Turn ,
246286 type TurnResponseEvent as TurnResponseEvent ,
247287 type TurnResponseEventPayload as TurnResponseEventPayload ,
248- type TurnCreateResponse as TurnCreateResponse ,
249288 type TurnCreateParams as TurnCreateParams ,
250289 type TurnCreateParamsNonStreaming as TurnCreateParamsNonStreaming ,
251290 type TurnCreateParamsStreaming as TurnCreateParamsStreaming ,
0 commit comments