@openrouter/sdk 0.3.2 → 0.3.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (319) hide show
  1. package/.zed/settings.json +10 -0
  2. package/_speakeasy/.github/action-inputs-config.json +53 -0
  3. package/_speakeasy/.github/action-security-config.json +88 -0
  4. package/esm/core.js +1 -0
  5. package/esm/funcs/analyticsGetUserActivity.js +1 -0
  6. package/esm/funcs/apiKeysCreate.js +1 -0
  7. package/esm/funcs/apiKeysDelete.js +1 -0
  8. package/esm/funcs/apiKeysGet.js +1 -0
  9. package/esm/funcs/apiKeysGetCurrentKeyMetadata.js +1 -0
  10. package/esm/funcs/apiKeysList.js +1 -0
  11. package/esm/funcs/apiKeysUpdate.js +1 -0
  12. package/esm/funcs/betaResponsesSend.js +1 -0
  13. package/esm/funcs/call-model.d.ts +118 -0
  14. package/esm/funcs/call-model.js +137 -0
  15. package/esm/funcs/chatSend.js +1 -0
  16. package/esm/funcs/completionsGenerate.js +1 -0
  17. package/esm/funcs/creditsCreateCoinbaseCharge.js +1 -0
  18. package/esm/funcs/creditsGetCredits.js +1 -0
  19. package/esm/funcs/embeddingsGenerate.js +1 -0
  20. package/esm/funcs/embeddingsListModels.js +1 -0
  21. package/esm/funcs/endpointsList.js +1 -0
  22. package/esm/funcs/endpointsListZdrEndpoints.js +1 -0
  23. package/esm/funcs/generationsGetGeneration.js +1 -0
  24. package/esm/funcs/modelsCount.js +1 -0
  25. package/esm/funcs/modelsList.js +1 -0
  26. package/esm/funcs/modelsListForUser.js +1 -0
  27. package/esm/funcs/oAuthCreateAuthCode.js +1 -0
  28. package/esm/funcs/oAuthExchangeAuthCodeForAPIKey.js +1 -0
  29. package/esm/funcs/parametersGetParameters.js +1 -0
  30. package/esm/funcs/providersList.js +1 -0
  31. package/esm/hooks/hooks.js +1 -0
  32. package/esm/hooks/index.js +1 -0
  33. package/esm/hooks/types.js +1 -0
  34. package/esm/index.d.ts +20 -5
  35. package/esm/index.js +21 -4
  36. package/esm/lib/anthropic-compat.d.ts +50 -0
  37. package/esm/lib/anthropic-compat.js +223 -0
  38. package/esm/lib/anthropic-compat.test.d.ts +2 -0
  39. package/esm/lib/anthropic-compat.test.js +479 -0
  40. package/esm/lib/async-params.d.ts +53 -0
  41. package/esm/lib/async-params.js +76 -0
  42. package/esm/lib/base64.js +1 -0
  43. package/esm/lib/chat-compat.d.ts +46 -0
  44. package/esm/lib/chat-compat.js +112 -0
  45. package/esm/lib/chat-compat.test.d.ts +2 -0
  46. package/esm/lib/chat-compat.test.js +282 -0
  47. package/esm/lib/claude-constants.d.ts +22 -0
  48. package/esm/lib/claude-constants.js +20 -0
  49. package/esm/lib/claude-type-guards.d.ts +10 -0
  50. package/esm/lib/claude-type-guards.js +70 -0
  51. package/esm/lib/config.d.ts +2 -2
  52. package/esm/lib/config.js +3 -2
  53. package/esm/lib/dlv.js +1 -0
  54. package/esm/lib/encodings.js +1 -0
  55. package/esm/lib/env.js +1 -0
  56. package/esm/lib/event-streams.js +1 -0
  57. package/esm/lib/files.js +1 -0
  58. package/esm/lib/http.js +1 -0
  59. package/esm/lib/is-plain-object.js +1 -0
  60. package/esm/lib/logger.js +1 -0
  61. package/esm/lib/matchers.js +1 -0
  62. package/esm/lib/{response-wrapper.d.ts → model-result.d.ts} +29 -43
  63. package/esm/lib/{response-wrapper.js → model-result.js} +146 -175
  64. package/esm/lib/next-turn-params.d.ts +30 -0
  65. package/esm/lib/next-turn-params.js +129 -0
  66. package/esm/lib/primitives.js +1 -0
  67. package/esm/lib/retries.js +1 -0
  68. package/esm/lib/reusable-stream.js +10 -10
  69. package/esm/lib/schemas.js +1 -0
  70. package/esm/lib/sdks.js +1 -0
  71. package/esm/lib/security.js +1 -0
  72. package/esm/lib/stop-conditions.d.ts +80 -0
  73. package/esm/lib/stop-conditions.js +104 -0
  74. package/esm/lib/stream-transformers.d.ts +30 -4
  75. package/esm/lib/stream-transformers.js +467 -98
  76. package/esm/lib/stream-type-guards.d.ts +29 -0
  77. package/esm/lib/stream-type-guards.js +109 -0
  78. package/esm/lib/tool-executor.d.ts +7 -6
  79. package/esm/lib/tool-executor.js +4 -0
  80. package/esm/lib/tool-orchestrator.d.ts +7 -7
  81. package/esm/lib/tool-orchestrator.js +38 -10
  82. package/esm/lib/tool-types.d.ts +163 -29
  83. package/esm/lib/tool-types.js +6 -0
  84. package/esm/lib/tool.d.ts +99 -0
  85. package/esm/lib/tool.js +71 -0
  86. package/esm/lib/turn-context.d.ts +50 -0
  87. package/esm/lib/turn-context.js +59 -0
  88. package/esm/lib/url.js +1 -0
  89. package/esm/models/activityitem.js +1 -0
  90. package/esm/models/assistantmessage.js +1 -0
  91. package/esm/models/badgatewayresponseerrordata.js +1 -0
  92. package/esm/models/badrequestresponseerrordata.js +1 -0
  93. package/esm/models/chatcompletionfinishreason.js +1 -0
  94. package/esm/models/chaterror.js +1 -0
  95. package/esm/models/chatgenerationparams.js +1 -0
  96. package/esm/models/chatgenerationtokenusage.js +1 -0
  97. package/esm/models/chatmessagecontentitem.js +1 -0
  98. package/esm/models/chatmessagecontentitemaudio.js +1 -0
  99. package/esm/models/chatmessagecontentitemcachecontrol.js +1 -0
  100. package/esm/models/chatmessagecontentitemimage.js +1 -0
  101. package/esm/models/chatmessagecontentitemtext.js +1 -0
  102. package/esm/models/chatmessagecontentitemvideo.js +1 -0
  103. package/esm/models/chatmessagetokenlogprob.js +1 -0
  104. package/esm/models/chatmessagetokenlogprobs.js +1 -0
  105. package/esm/models/chatmessagetoolcall.js +1 -0
  106. package/esm/models/chatresponse.js +1 -0
  107. package/esm/models/chatresponsechoice.js +1 -0
  108. package/esm/models/chatstreamingchoice.js +1 -0
  109. package/esm/models/chatstreamingmessagechunk.js +1 -0
  110. package/esm/models/chatstreamingmessagetoolcall.js +1 -0
  111. package/esm/models/chatstreamingresponsechunk.js +1 -0
  112. package/esm/models/chatstreamoptions.js +1 -0
  113. package/esm/models/claude-message.d.ts +218 -0
  114. package/esm/models/claude-message.js +6 -0
  115. package/esm/models/completionchoice.js +1 -0
  116. package/esm/models/completioncreateparams.js +1 -0
  117. package/esm/models/completionlogprobs.js +1 -0
  118. package/esm/models/completionresponse.js +1 -0
  119. package/esm/models/completionusage.js +1 -0
  120. package/esm/models/createchargerequest.js +1 -0
  121. package/esm/models/datacollection.js +1 -0
  122. package/esm/models/defaultparameters.js +1 -0
  123. package/esm/models/edgenetworktimeoutresponseerrordata.js +1 -0
  124. package/esm/models/endpointstatus.js +1 -0
  125. package/esm/models/errors/badgatewayresponseerror.js +1 -0
  126. package/esm/models/errors/badrequestresponseerror.js +1 -0
  127. package/esm/models/errors/chaterror.js +1 -0
  128. package/esm/models/errors/edgenetworktimeoutresponseerror.js +1 -0
  129. package/esm/models/errors/forbiddenresponseerror.js +1 -0
  130. package/esm/models/errors/httpclienterrors.js +1 -0
  131. package/esm/models/errors/index.js +1 -0
  132. package/esm/models/errors/internalserverresponseerror.js +1 -0
  133. package/esm/models/errors/notfoundresponseerror.js +1 -0
  134. package/esm/models/errors/openrouterdefaulterror.js +1 -0
  135. package/esm/models/errors/openroutererror.js +1 -0
  136. package/esm/models/errors/payloadtoolargeresponseerror.js +1 -0
  137. package/esm/models/errors/paymentrequiredresponseerror.js +1 -0
  138. package/esm/models/errors/provideroverloadedresponseerror.js +1 -0
  139. package/esm/models/errors/requesttimeoutresponseerror.js +1 -0
  140. package/esm/models/errors/responsevalidationerror.js +1 -0
  141. package/esm/models/errors/sdkvalidationerror.js +1 -0
  142. package/esm/models/errors/serviceunavailableresponseerror.js +1 -0
  143. package/esm/models/errors/toomanyrequestsresponseerror.js +1 -0
  144. package/esm/models/errors/unauthorizedresponseerror.js +1 -0
  145. package/esm/models/errors/unprocessableentityresponseerror.js +1 -0
  146. package/esm/models/filecitation.js +1 -0
  147. package/esm/models/filepath.js +1 -0
  148. package/esm/models/forbiddenresponseerrordata.js +1 -0
  149. package/esm/models/imagegenerationstatus.js +1 -0
  150. package/esm/models/index.d.ts +1 -0
  151. package/esm/models/index.js +2 -0
  152. package/esm/models/inputmodality.js +1 -0
  153. package/esm/models/instructtype.js +1 -0
  154. package/esm/models/internalserverresponseerrordata.js +1 -0
  155. package/esm/models/jsonschemaconfig.js +1 -0
  156. package/esm/models/listendpointsresponse.js +1 -0
  157. package/esm/models/message.js +1 -0
  158. package/esm/models/model.js +1 -0
  159. package/esm/models/modelarchitecture.js +1 -0
  160. package/esm/models/modelgroup.js +1 -0
  161. package/esm/models/modelscountresponse.js +1 -0
  162. package/esm/models/modelslistresponse.js +1 -0
  163. package/esm/models/namedtoolchoice.js +1 -0
  164. package/esm/models/notfoundresponseerrordata.js +1 -0
  165. package/esm/models/openairesponsesannotation.js +1 -0
  166. package/esm/models/openairesponsesincludable.js +1 -0
  167. package/esm/models/openairesponsesincompletedetails.js +1 -0
  168. package/esm/models/openairesponsesinputunion.js +1 -0
  169. package/esm/models/openairesponsesprompt.js +1 -0
  170. package/esm/models/openairesponsesreasoningconfig.js +1 -0
  171. package/esm/models/openairesponsesreasoningeffort.js +1 -0
  172. package/esm/models/openairesponsesrefusalcontent.js +1 -0
  173. package/esm/models/openairesponsesresponsestatus.js +1 -0
  174. package/esm/models/openairesponsesservicetier.js +1 -0
  175. package/esm/models/openairesponsestoolchoiceunion.js +1 -0
  176. package/esm/models/openairesponsestruncation.js +1 -0
  177. package/esm/models/openresponseseasyinputmessage.js +1 -0
  178. package/esm/models/openresponseserrorevent.js +1 -0
  179. package/esm/models/openresponsesfunctioncalloutput.js +1 -0
  180. package/esm/models/openresponsesfunctiontoolcall.js +1 -0
  181. package/esm/models/openresponsesimagegencallcompleted.js +1 -0
  182. package/esm/models/openresponsesimagegencallgenerating.js +1 -0
  183. package/esm/models/openresponsesimagegencallinprogress.js +1 -0
  184. package/esm/models/openresponsesimagegencallpartialimage.js +1 -0
  185. package/esm/models/openresponsesinput.js +1 -0
  186. package/esm/models/openresponsesinputmessageitem.js +1 -0
  187. package/esm/models/openresponseslogprobs.js +1 -0
  188. package/esm/models/openresponsesnonstreamingresponse.js +1 -0
  189. package/esm/models/openresponsesreasoning.js +1 -0
  190. package/esm/models/openresponsesreasoningconfig.js +1 -0
  191. package/esm/models/openresponsesreasoningdeltaevent.js +1 -0
  192. package/esm/models/openresponsesreasoningdoneevent.js +1 -0
  193. package/esm/models/openresponsesreasoningsummarypartaddedevent.js +1 -0
  194. package/esm/models/openresponsesreasoningsummarytextdeltaevent.js +1 -0
  195. package/esm/models/openresponsesreasoningsummarytextdoneevent.js +1 -0
  196. package/esm/models/openresponsesrequest.js +1 -0
  197. package/esm/models/openresponsesresponsetext.js +1 -0
  198. package/esm/models/openresponsesstreamevent.js +1 -0
  199. package/esm/models/openresponsestoplogprobs.js +1 -0
  200. package/esm/models/openresponsesusage.js +1 -0
  201. package/esm/models/openresponseswebsearch20250826tool.js +1 -0
  202. package/esm/models/openresponseswebsearchpreview20250311tool.js +1 -0
  203. package/esm/models/openresponseswebsearchpreviewtool.js +1 -0
  204. package/esm/models/openresponseswebsearchtool.js +1 -0
  205. package/esm/models/operations/createauthkeyscode.js +1 -0
  206. package/esm/models/operations/createcoinbasecharge.js +1 -0
  207. package/esm/models/operations/createembeddings.js +1 -0
  208. package/esm/models/operations/createkeys.js +1 -0
  209. package/esm/models/operations/createresponses.js +1 -0
  210. package/esm/models/operations/deletekeys.js +1 -0
  211. package/esm/models/operations/exchangeauthcodeforapikey.js +1 -0
  212. package/esm/models/operations/getcredits.js +1 -0
  213. package/esm/models/operations/getcurrentkey.js +1 -0
  214. package/esm/models/operations/getgeneration.js +1 -0
  215. package/esm/models/operations/getkey.js +1 -0
  216. package/esm/models/operations/getmodels.js +1 -0
  217. package/esm/models/operations/getparameters.js +1 -0
  218. package/esm/models/operations/getuseractivity.js +1 -0
  219. package/esm/models/operations/index.js +1 -0
  220. package/esm/models/operations/list.js +1 -0
  221. package/esm/models/operations/listendpoints.js +1 -0
  222. package/esm/models/operations/listendpointszdr.js +1 -0
  223. package/esm/models/operations/listmodelsuser.js +1 -0
  224. package/esm/models/operations/listproviders.js +1 -0
  225. package/esm/models/operations/sendchatcompletionrequest.js +1 -0
  226. package/esm/models/operations/updatekeys.js +1 -0
  227. package/esm/models/outputitemimagegenerationcall.js +1 -0
  228. package/esm/models/outputmessage.js +1 -0
  229. package/esm/models/outputmodality.js +1 -0
  230. package/esm/models/parameter.js +1 -0
  231. package/esm/models/payloadtoolargeresponseerrordata.js +1 -0
  232. package/esm/models/paymentrequiredresponseerrordata.js +1 -0
  233. package/esm/models/pdfparserengine.js +1 -0
  234. package/esm/models/pdfparseroptions.js +1 -0
  235. package/esm/models/perrequestlimits.js +1 -0
  236. package/esm/models/providername.js +1 -0
  237. package/esm/models/provideroverloadedresponseerrordata.js +1 -0
  238. package/esm/models/providerpreferences.js +1 -0
  239. package/esm/models/providersort.js +1 -0
  240. package/esm/models/providersortconfig.js +1 -0
  241. package/esm/models/providersortunion.js +1 -0
  242. package/esm/models/publicendpoint.js +1 -0
  243. package/esm/models/publicpricing.js +1 -0
  244. package/esm/models/quantization.js +1 -0
  245. package/esm/models/reasoningsummarytext.js +1 -0
  246. package/esm/models/reasoningsummaryverbosity.js +1 -0
  247. package/esm/models/reasoningtextcontent.js +1 -0
  248. package/esm/models/requesttimeoutresponseerrordata.js +1 -0
  249. package/esm/models/responseformatjsonschema.js +1 -0
  250. package/esm/models/responseformattextconfig.js +1 -0
  251. package/esm/models/responseformattextgrammar.js +1 -0
  252. package/esm/models/responseinputaudio.js +1 -0
  253. package/esm/models/responseinputfile.js +1 -0
  254. package/esm/models/responseinputimage.js +1 -0
  255. package/esm/models/responseinputtext.js +1 -0
  256. package/esm/models/responseoutputtext.js +1 -0
  257. package/esm/models/responseserrorfield.js +1 -0
  258. package/esm/models/responsesformatjsonobject.js +1 -0
  259. package/esm/models/responsesformattext.js +1 -0
  260. package/esm/models/responsesformattextjsonschemaconfig.js +1 -0
  261. package/esm/models/responsesimagegenerationcall.js +1 -0
  262. package/esm/models/responsesoutputitem.js +1 -0
  263. package/esm/models/responsesoutputitemfilesearchcall.js +1 -0
  264. package/esm/models/responsesoutputitemfunctioncall.js +1 -0
  265. package/esm/models/responsesoutputitemreasoning.js +1 -0
  266. package/esm/models/responsesoutputmessage.js +1 -0
  267. package/esm/models/responsessearchcontextsize.js +1 -0
  268. package/esm/models/responseswebsearchcalloutput.js +1 -0
  269. package/esm/models/responseswebsearchuserlocation.js +1 -0
  270. package/esm/models/responsetextconfig.js +1 -0
  271. package/esm/models/schema0.js +1 -0
  272. package/esm/models/schema3.js +1 -0
  273. package/esm/models/security.js +1 -0
  274. package/esm/models/serviceunavailableresponseerrordata.js +1 -0
  275. package/esm/models/systemmessage.js +1 -0
  276. package/esm/models/toolcallstatus.js +1 -0
  277. package/esm/models/tooldefinitionjson.js +1 -0
  278. package/esm/models/toolresponsemessage.js +1 -0
  279. package/esm/models/toomanyrequestsresponseerrordata.js +1 -0
  280. package/esm/models/topproviderinfo.js +1 -0
  281. package/esm/models/unauthorizedresponseerrordata.js +1 -0
  282. package/esm/models/unprocessableentityresponseerrordata.js +1 -0
  283. package/esm/models/urlcitation.js +1 -0
  284. package/esm/models/usermessage.js +1 -0
  285. package/esm/models/websearchengine.js +1 -0
  286. package/esm/models/websearchpreviewtooluserlocation.js +1 -0
  287. package/esm/models/websearchstatus.js +1 -0
  288. package/esm/sdk/analytics.js +1 -0
  289. package/esm/sdk/apikeys.js +1 -0
  290. package/esm/sdk/beta.js +1 -0
  291. package/esm/sdk/chat.js +1 -0
  292. package/esm/sdk/completions.js +1 -0
  293. package/esm/sdk/credits.js +1 -0
  294. package/esm/sdk/embeddings.js +1 -0
  295. package/esm/sdk/endpoints.js +1 -0
  296. package/esm/sdk/generations.js +1 -0
  297. package/esm/sdk/index.js +1 -0
  298. package/esm/sdk/models.js +1 -0
  299. package/esm/sdk/oauth.js +1 -0
  300. package/esm/sdk/parameters.js +1 -0
  301. package/esm/sdk/providers.js +1 -0
  302. package/esm/sdk/responses.js +1 -0
  303. package/esm/sdk/sdk.d.ts +4 -10
  304. package/esm/sdk/sdk.js +2 -1
  305. package/esm/types/async.js +1 -0
  306. package/esm/types/blobs.js +1 -0
  307. package/esm/types/constdatetime.js +1 -0
  308. package/esm/types/discriminatedUnion.js +1 -0
  309. package/esm/types/enums.js +1 -0
  310. package/esm/types/fp.js +1 -0
  311. package/esm/types/index.js +1 -0
  312. package/esm/types/operations.js +1 -0
  313. package/esm/types/rfcdate.js +1 -0
  314. package/esm/types/streams.js +1 -0
  315. package/esm/types/unrecognized.js +1 -0
  316. package/jsr.json +1 -1
  317. package/package.json +6 -3
  318. package/esm/funcs/callModel.d.ts +0 -87
  319. package/esm/funcs/callModel.js +0 -215
@@ -1,31 +1,37 @@
1
1
  import type { OpenRouterCore } from '../core.js';
2
2
  import type * as models from '../models/index.js';
3
+ import type { CallModelInput } from './async-params.js';
3
4
  import type { RequestOptions } from './sdks.js';
4
- import type { ChatStreamEvent, EnhancedResponseStreamEvent, Tool, MaxToolRounds, ParsedToolCall, ToolStreamEvent } from './tool-types.js';
5
- export interface GetResponseOptions {
6
- request: models.OpenResponsesRequest;
5
+ import type { ResponseStreamEvent, InferToolEventsUnion, ParsedToolCall, StopWhen, Tool, ToolStreamEvent } from './tool-types.js';
6
+ export interface GetResponseOptions<TTools extends readonly Tool[]> {
7
+ request: CallModelInput<TTools>;
7
8
  client: OpenRouterCore;
8
9
  options?: RequestOptions;
9
- tools?: Tool[];
10
- maxToolRounds?: MaxToolRounds;
10
+ tools?: TTools;
11
+ stopWhen?: StopWhen<TTools>;
11
12
  }
12
13
  /**
13
14
  * A wrapper around a streaming response that provides multiple consumption patterns.
14
15
  *
15
16
  * Allows consuming the response in multiple ways:
16
- * - `await response.getMessage()` - Get the completed message
17
- * - `await response.getText()` - Get just the text
18
- * - `for await (const delta of response.getTextStream())` - Stream text deltas
19
- * - `for await (const msg of response.getNewMessagesStream())` - Stream incremental message updates
20
- * - `for await (const event of response.getFullResponsesStream())` - Stream all response events
17
+ * - `await result.getText()` - Get just the text
18
+ * - `await result.getResponse()` - Get the full response object
19
+ * - `for await (const delta of result.getTextStream())` - Stream text deltas
20
+ * - `for await (const msg of result.getNewMessagesStream())` - Stream incremental message updates
21
+ * - `for await (const event of result.getFullResponsesStream())` - Stream all response events
22
+ *
23
+ * For message format conversion, use the helper functions:
24
+ * - `toChatMessage(response)` for OpenAI chat format
25
+ * - `toClaudeMessage(response)` for Anthropic Claude format
21
26
  *
22
27
  * All consumption patterns can be used concurrently thanks to the underlying
23
28
  * ReusableReadableStream implementation.
29
+ *
30
+ * @template TTools - The tools array type to enable typed tool calls and results
24
31
  */
25
- export declare class ResponseWrapper {
32
+ export declare class ModelResult<TTools extends readonly Tool[]> {
26
33
  private reusableStream;
27
34
  private streamPromise;
28
- private messagePromise;
29
35
  private textPromise;
30
36
  private options;
31
37
  private initPromise;
@@ -33,7 +39,8 @@ export declare class ResponseWrapper {
33
39
  private finalResponse;
34
40
  private preliminaryResults;
35
41
  private allToolExecutionRounds;
36
- constructor(options: GetResponseOptions);
42
+ private resolvedRequest;
43
+ constructor(options: GetResponseOptions<TTools>);
37
44
  /**
38
45
  * Type guard to check if a value is a non-streaming response
39
46
  */
@@ -48,20 +55,10 @@ export declare class ResponseWrapper {
48
55
  * This is idempotent - multiple calls will return the same promise
49
56
  */
50
57
  private executeToolsIfNeeded;
51
- /**
52
- * Internal helper to get the message after tool execution
53
- */
54
- private getMessageInternal;
55
58
  /**
56
59
  * Internal helper to get the text after tool execution
57
60
  */
58
61
  private getTextInternal;
59
- /**
60
- * Get the completed message from the response.
61
- * This will consume the stream until completion, execute any tools, and extract the first message.
62
- * Returns an AssistantMessage in chat format.
63
- */
64
- getMessage(): Promise<models.AssistantMessage>;
65
62
  /**
66
63
  * Get just the text content from the response.
67
64
  * This will consume the stream until completion, execute any tools, and extract the text.
@@ -78,19 +75,19 @@ export declare class ResponseWrapper {
78
75
  * Multiple consumers can iterate over this stream concurrently.
79
76
  * Includes preliminary tool result events after tool execution.
80
77
  */
81
- getFullResponsesStream(): AsyncIterableIterator<EnhancedResponseStreamEvent>;
78
+ getFullResponsesStream(): AsyncIterableIterator<ResponseStreamEvent<InferToolEventsUnion<TTools>>>;
82
79
  /**
83
80
  * Stream only text deltas as they arrive.
84
81
  * This filters the full event stream to only yield text content.
85
82
  */
86
83
  getTextStream(): AsyncIterableIterator<string>;
87
84
  /**
88
- * Stream incremental message updates as content is added.
85
+ * Stream incremental message updates as content is added in responses format.
89
86
  * Each iteration yields an updated version of the message with new content.
90
- * Also yields ToolResponseMessages after tool execution completes.
91
- * Returns AssistantMessage or ToolResponseMessage in chat format.
87
+ * Also yields OpenResponsesFunctionCallOutput after tool execution completes.
88
+ * Returns ResponsesOutputMessage or OpenResponsesFunctionCallOutput compatible with OpenAI Responses API format.
92
89
  */
93
- getNewMessagesStream(): AsyncIterableIterator<models.AssistantMessage | models.ToolResponseMessage>;
90
+ getNewMessagesStream(): AsyncIterableIterator<models.ResponsesOutputMessage | models.OpenResponsesFunctionCallOutput>;
94
91
  /**
95
92
  * Stream only reasoning deltas as they arrive.
96
93
  * This filters the full event stream to only yield reasoning content.
@@ -102,33 +99,22 @@ export declare class ResponseWrapper {
102
99
  * - Tool call argument deltas as { type: "delta", content: string }
103
100
  * - Preliminary results as { type: "preliminary_result", toolCallId, result }
104
101
  */
105
- getToolStream(): AsyncIterableIterator<ToolStreamEvent>;
106
- /**
107
- * Stream events in chat format (compatibility layer).
108
- * Note: This transforms responses API events into a chat-like format.
109
- * Includes preliminary tool result events after tool execution.
110
- *
111
- * @remarks
112
- * This is a compatibility method that attempts to transform the responses API
113
- * stream into a format similar to the chat API. Due to differences in the APIs,
114
- * this may not be a perfect mapping.
115
- */
116
- getFullChatStream(): AsyncIterableIterator<ChatStreamEvent>;
102
+ getToolStream(): AsyncIterableIterator<ToolStreamEvent<InferToolEventsUnion<TTools>>>;
117
103
  /**
118
104
  * Get all tool calls from the completed response (before auto-execution).
119
105
  * Note: If tools have execute functions, they will be automatically executed
120
106
  * and this will return the tool calls from the initial response.
121
107
  * Returns structured tool calls with parsed arguments.
122
108
  */
123
- getToolCalls(): Promise<ParsedToolCall[]>;
109
+ getToolCalls(): Promise<ParsedToolCall<TTools[number]>[]>;
124
110
  /**
125
111
  * Stream structured tool call objects as they're completed.
126
112
  * Each iteration yields a complete tool call with parsed arguments.
127
113
  */
128
- getToolCallsStream(): AsyncIterableIterator<ParsedToolCall>;
114
+ getToolCallsStream(): AsyncIterableIterator<ParsedToolCall<TTools[number]>>;
129
115
  /**
130
116
  * Cancel the underlying stream and all consumers
131
117
  */
132
118
  cancel(): Promise<void>;
133
119
  }
134
- //# sourceMappingURL=response-wrapper.d.ts.map
120
+ //# sourceMappingURL=model-result.d.ts.map
@@ -1,32 +1,60 @@
1
1
  import { betaResponsesSend } from '../funcs/betaResponsesSend.js';
2
+ import { hasAsyncFunctions, resolveAsyncFunctions, } from './async-params.js';
2
3
  import { ReusableReadableStream } from './reusable-stream.js';
3
- import { buildMessageStream, buildToolCallStream, consumeStreamForCompletion, extractMessageFromResponse, extractReasoningDeltas, extractTextDeltas, extractTextFromResponse, extractToolCallsFromResponse, extractToolDeltas, } from './stream-transformers.js';
4
+ import { buildResponsesMessageStream, buildToolCallStream, consumeStreamForCompletion, extractReasoningDeltas, extractResponsesMessageFromResponse, extractTextDeltas, extractTextFromResponse, extractToolCallsFromResponse, extractToolDeltas, } from './stream-transformers.js';
4
5
  import { executeTool } from './tool-executor.js';
6
+ import { executeNextTurnParamsFunctions, applyNextTurnParamsToRequest } from './next-turn-params.js';
5
7
  import { hasExecuteFunction } from './tool-types.js';
8
+ import { isStopConditionMet } from './stop-conditions.js';
9
+ /**
10
+ * Type guard for stream event with toReadableStream method
11
+ */
12
+ function isEventStream(value) {
13
+ return (value !== null &&
14
+ typeof value === 'object' &&
15
+ 'toReadableStream' in value &&
16
+ typeof value.toReadableStream === 'function');
17
+ }
18
+ /**
19
+ * Type guard for output items with a type property
20
+ */
21
+ function hasTypeProperty(item) {
22
+ return (typeof item === 'object' &&
23
+ item !== null &&
24
+ 'type' in item &&
25
+ typeof item.type === 'string');
26
+ }
6
27
  /**
7
28
  * A wrapper around a streaming response that provides multiple consumption patterns.
8
29
  *
9
30
  * Allows consuming the response in multiple ways:
10
- * - `await response.getMessage()` - Get the completed message
11
- * - `await response.getText()` - Get just the text
12
- * - `for await (const delta of response.getTextStream())` - Stream text deltas
13
- * - `for await (const msg of response.getNewMessagesStream())` - Stream incremental message updates
14
- * - `for await (const event of response.getFullResponsesStream())` - Stream all response events
31
+ * - `await result.getText()` - Get just the text
32
+ * - `await result.getResponse()` - Get the full response object
33
+ * - `for await (const delta of result.getTextStream())` - Stream text deltas
34
+ * - `for await (const msg of result.getNewMessagesStream())` - Stream incremental message updates
35
+ * - `for await (const event of result.getFullResponsesStream())` - Stream all response events
36
+ *
37
+ * For message format conversion, use the helper functions:
38
+ * - `toChatMessage(response)` for OpenAI chat format
39
+ * - `toClaudeMessage(response)` for Anthropic Claude format
15
40
  *
16
41
  * All consumption patterns can be used concurrently thanks to the underlying
17
42
  * ReusableReadableStream implementation.
43
+ *
44
+ * @template TTools - The tools array type to enable typed tool calls and results
18
45
  */
19
- export class ResponseWrapper {
46
+ export class ModelResult {
20
47
  constructor(options) {
21
48
  this.reusableStream = null;
22
49
  this.streamPromise = null;
23
- this.messagePromise = null;
24
50
  this.textPromise = null;
25
51
  this.initPromise = null;
26
52
  this.toolExecutionPromise = null;
27
53
  this.finalResponse = null;
28
54
  this.preliminaryResults = new Map();
29
55
  this.allToolExecutionRounds = [];
56
+ // Track resolved request after async function resolution
57
+ this.resolvedRequest = null;
30
58
  this.options = options;
31
59
  }
32
60
  /**
@@ -34,11 +62,11 @@ export class ResponseWrapper {
34
62
  */
35
63
  isNonStreamingResponse(value) {
36
64
  return (value !== null &&
37
- typeof value === "object" &&
38
- "id" in value &&
39
- "object" in value &&
40
- "output" in value &&
41
- !("toReadableStream" in value));
65
+ typeof value === 'object' &&
66
+ 'id' in value &&
67
+ 'object' in value &&
68
+ 'output' in value &&
69
+ !('toReadableStream' in value));
42
70
  }
43
71
  /**
44
72
  * Initialize the stream if not already started
@@ -49,16 +77,40 @@ export class ResponseWrapper {
49
77
  return this.initPromise;
50
78
  }
51
79
  this.initPromise = (async () => {
52
- // Force stream mode
53
- const request = {
54
- ...this.options.request,
80
+ // Resolve async functions before initial request
81
+ // Build initial turn context (turn 0 for initial request)
82
+ const initialContext = {
83
+ numberOfTurns: 0,
84
+ };
85
+ // Resolve any async functions first
86
+ let baseRequest;
87
+ if (hasAsyncFunctions(this.options.request)) {
88
+ baseRequest = await resolveAsyncFunctions(this.options.request, initialContext);
89
+ }
90
+ else {
91
+ // Already resolved, extract non-function fields
92
+ // Since request is CallModelInput, we need to filter out stopWhen
93
+ // Note: tools are already in API format at this point (converted in callModel())
94
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
95
+ const { stopWhen, ...rest } = this.options.request;
96
+ // Cast to ResolvedCallModelInput - we know it's resolved if hasAsyncFunctions returned false
97
+ baseRequest = rest;
98
+ }
99
+ // Store resolved request with stream mode
100
+ this.resolvedRequest = {
101
+ ...baseRequest,
55
102
  stream: true,
56
103
  };
104
+ // Force stream mode for initial request
105
+ const request = this.resolvedRequest;
57
106
  // Create the stream promise
58
107
  this.streamPromise = betaResponsesSend(this.options.client, request, this.options.options).then((result) => {
59
108
  if (!result.ok) {
60
109
  throw result.error;
61
110
  }
111
+ // When stream: true, the API returns EventStream
112
+ // TypeScript can't narrow the union type based on runtime parameter values,
113
+ // so we assert the type here based on our knowledge that stream=true
62
114
  return result.value;
63
115
  });
64
116
  // Wait for the stream and create the reusable stream
@@ -80,12 +132,13 @@ export class ResponseWrapper {
80
132
  if (!this.reusableStream) {
81
133
  throw new Error('Stream not initialized');
82
134
  }
135
+ // Note: Async functions already resolved in initStream()
83
136
  // Get the initial response
84
137
  const initialResponse = await consumeStreamForCompletion(this.reusableStream);
85
138
  // Check if we have tools and if auto-execution is enabled
86
139
  const shouldAutoExecute = this.options.tools &&
87
140
  this.options.tools.length > 0 &&
88
- initialResponse.output.some((item) => 'type' in item && item.type === 'function_call');
141
+ initialResponse.output.some((item) => hasTypeProperty(item) && item.type === 'function_call');
89
142
  if (!shouldAutoExecute) {
90
143
  // No tools to execute, use initial response
91
144
  this.finalResponse = initialResponse;
@@ -103,12 +156,34 @@ export class ResponseWrapper {
103
156
  this.finalResponse = initialResponse;
104
157
  return;
105
158
  }
106
- // Get maxToolRounds configuration
107
- const maxToolRounds = this.options.maxToolRounds ?? 5;
108
159
  let currentResponse = initialResponse;
109
160
  let currentRound = 0;
110
- let currentInput = this.options.request.input || [];
111
161
  while (true) {
162
+ // Check stopWhen conditions
163
+ if (this.options.stopWhen) {
164
+ const stopConditions = Array.isArray(this.options.stopWhen)
165
+ ? this.options.stopWhen
166
+ : [this.options.stopWhen];
167
+ const shouldStop = await isStopConditionMet({
168
+ stopConditions,
169
+ steps: this.allToolExecutionRounds.map((round) => ({
170
+ stepType: 'continue',
171
+ text: extractTextFromResponse(round.response),
172
+ toolCalls: round.toolCalls,
173
+ toolResults: round.toolResults.map((tr) => ({
174
+ toolCallId: tr.callId,
175
+ toolName: round.toolCalls.find((tc) => tc.id === tr.callId)?.name ?? '',
176
+ result: JSON.parse(tr.output),
177
+ })),
178
+ response: round.response,
179
+ usage: round.response.usage,
180
+ finishReason: undefined, // OpenResponsesNonStreamingResponse doesn't have finishReason
181
+ })),
182
+ });
183
+ if (shouldStop) {
184
+ break;
185
+ }
186
+ }
112
187
  const currentToolCalls = extractToolCallsFromResponse(currentResponse);
113
188
  if (currentToolCalls.length === 0) {
114
189
  break;
@@ -120,46 +195,19 @@ export class ResponseWrapper {
120
195
  if (!hasExecutable) {
121
196
  break;
122
197
  }
123
- // Check if we should continue based on maxToolRounds
124
- if (typeof maxToolRounds === 'number') {
125
- if (currentRound >= maxToolRounds) {
126
- break;
127
- }
128
- }
129
- else if (typeof maxToolRounds === 'function') {
130
- // Function signature: (context: TurnContext) => boolean
131
- const turnContext = {
132
- numberOfTurns: currentRound + 1,
133
- messageHistory: currentInput,
134
- ...(this.options.request.model && {
135
- model: this.options.request.model,
136
- }),
137
- ...(this.options.request.models && {
138
- models: this.options.request.models,
139
- }),
140
- };
141
- const shouldContinue = maxToolRounds(turnContext);
142
- if (!shouldContinue) {
143
- break;
144
- }
145
- }
146
- // Store execution round info
147
- this.allToolExecutionRounds.push({
148
- round: currentRound,
149
- toolCalls: currentToolCalls,
150
- response: currentResponse,
151
- });
152
- // Build turn context for tool execution
198
+ // Build turn context for this round (for async parameter resolution only)
153
199
  const turnContext = {
154
200
  numberOfTurns: currentRound + 1, // 1-indexed
155
- messageHistory: currentInput,
156
- ...(this.options.request.model && {
157
- model: this.options.request.model,
158
- }),
159
- ...(this.options.request.models && {
160
- models: this.options.request.models,
161
- }),
162
201
  };
202
+ // Resolve async functions for this turn
203
+ if (hasAsyncFunctions(this.options.request)) {
204
+ const resolved = await resolveAsyncFunctions(this.options.request, turnContext);
205
+ // Update resolved request with new values
206
+ this.resolvedRequest = {
207
+ ...resolved,
208
+ stream: false, // Tool execution turns don't need streaming
209
+ };
210
+ }
163
211
  // Execute all tool calls
164
212
  const toolResults = [];
165
213
  for (const toolCall of currentToolCalls) {
@@ -183,6 +231,24 @@ export class ResponseWrapper {
183
231
  : JSON.stringify(result.result),
184
232
  });
185
233
  }
234
+ // Store execution round info including tool results
235
+ this.allToolExecutionRounds.push({
236
+ round: currentRound,
237
+ toolCalls: currentToolCalls,
238
+ response: currentResponse,
239
+ toolResults,
240
+ });
241
+ // Execute nextTurnParams functions for tools that were called
242
+ if (this.options.tools && currentToolCalls.length > 0) {
243
+ if (!this.resolvedRequest) {
244
+ throw new Error('Request not initialized');
245
+ }
246
+ const computedParams = await executeNextTurnParamsFunctions(currentToolCalls, this.options.tools, this.resolvedRequest);
247
+ // Apply computed parameters to the resolved request for next turn
248
+ if (Object.keys(computedParams).length > 0) {
249
+ this.resolvedRequest = applyNextTurnParamsToRequest(this.resolvedRequest, computedParams);
250
+ }
251
+ }
186
252
  // Build new input with tool results
187
253
  // For the Responses API, we need to include the tool results in the input
188
254
  const newInput = [
@@ -193,11 +259,12 @@ export class ResponseWrapper {
193
259
  ]),
194
260
  ...toolResults,
195
261
  ];
196
- // Update current input for next iteration
197
- currentInput = newInput;
198
262
  // Make new request with tool results
263
+ if (!this.resolvedRequest) {
264
+ throw new Error('Request not initialized');
265
+ }
199
266
  const newRequest = {
200
- ...this.options.request,
267
+ ...this.resolvedRequest,
201
268
  input: newInput,
202
269
  stream: false,
203
270
  };
@@ -207,7 +274,7 @@ export class ResponseWrapper {
207
274
  }
208
275
  // Handle the result - it might be a stream or a response
209
276
  const value = newResult.value;
210
- if (value && typeof value === 'object' && 'toReadableStream' in value) {
277
+ if (isEventStream(value)) {
211
278
  // It's a stream, consume it
212
279
  const stream = new ReusableReadableStream(value);
213
280
  currentResponse = await consumeStreamForCompletion(stream);
@@ -216,54 +283,32 @@ export class ResponseWrapper {
216
283
  currentResponse = value;
217
284
  }
218
285
  else {
219
- throw new Error("Unexpected response type from API");
286
+ throw new Error('Unexpected response type from API');
220
287
  }
221
288
  currentRound++;
222
289
  }
223
290
  // Validate the final response has required fields
224
291
  if (!currentResponse || !currentResponse.id || !currentResponse.output) {
225
- throw new Error("Invalid final response: missing required fields");
292
+ throw new Error('Invalid final response: missing required fields');
226
293
  }
227
294
  // Ensure the response is in a completed state (has output content)
228
295
  if (!Array.isArray(currentResponse.output) || currentResponse.output.length === 0) {
229
- throw new Error("Invalid final response: empty or invalid output");
296
+ throw new Error('Invalid final response: empty or invalid output');
230
297
  }
231
298
  this.finalResponse = currentResponse;
232
299
  })();
233
300
  return this.toolExecutionPromise;
234
301
  }
235
- /**
236
- * Internal helper to get the message after tool execution
237
- */
238
- async getMessageInternal() {
239
- await this.executeToolsIfNeeded();
240
- if (!this.finalResponse) {
241
- throw new Error("Response not available");
242
- }
243
- return extractMessageFromResponse(this.finalResponse);
244
- }
245
302
  /**
246
303
  * Internal helper to get the text after tool execution
247
304
  */
248
305
  async getTextInternal() {
249
306
  await this.executeToolsIfNeeded();
250
307
  if (!this.finalResponse) {
251
- throw new Error("Response not available");
308
+ throw new Error('Response not available');
252
309
  }
253
310
  return extractTextFromResponse(this.finalResponse);
254
311
  }
255
- /**
256
- * Get the completed message from the response.
257
- * This will consume the stream until completion, execute any tools, and extract the first message.
258
- * Returns an AssistantMessage in chat format.
259
- */
260
- getMessage() {
261
- if (this.messagePromise) {
262
- return this.messagePromise;
263
- }
264
- this.messagePromise = this.getMessageInternal();
265
- return this.messagePromise;
266
- }
267
312
  /**
268
313
  * Get just the text content from the response.
269
314
  * This will consume the stream until completion, execute any tools, and extract the text.
@@ -311,7 +356,7 @@ export class ResponseWrapper {
311
356
  yield {
312
357
  type: 'tool.preliminary_result',
313
358
  toolCallId,
314
- result,
359
+ result: result,
315
360
  timestamp: Date.now(),
316
361
  };
317
362
  }
@@ -332,10 +377,10 @@ export class ResponseWrapper {
332
377
  }.call(this);
333
378
  }
334
379
  /**
335
- * Stream incremental message updates as content is added.
380
+ * Stream incremental message updates as content is added in responses format.
336
381
  * Each iteration yields an updated version of the message with new content.
337
- * Also yields ToolResponseMessages after tool execution completes.
338
- * Returns AssistantMessage or ToolResponseMessage in chat format.
382
+ * Also yields OpenResponsesFunctionCallOutput after tool execution completes.
383
+ * Returns ResponsesOutputMessage or OpenResponsesFunctionCallOutput compatible with OpenAI Responses API format.
339
384
  */
340
385
  getNewMessagesStream() {
341
386
  return async function* () {
@@ -343,37 +388,22 @@ export class ResponseWrapper {
343
388
  if (!this.reusableStream) {
344
389
  throw new Error('Stream not initialized');
345
390
  }
346
- // First yield assistant messages from the stream
347
- yield* buildMessageStream(this.reusableStream);
391
+ // First yield messages from the stream in responses format
392
+ yield* buildResponsesMessageStream(this.reusableStream);
348
393
  // Execute tools if needed
349
394
  await this.executeToolsIfNeeded();
350
- // Yield tool response messages for each executed tool
395
+ // Yield function call outputs for each executed tool
351
396
  for (const round of this.allToolExecutionRounds) {
352
- for (const toolCall of round.toolCalls) {
353
- // Find the tool to check if it was executed
354
- const tool = this.options.tools?.find((t) => t.function.name === toolCall.name);
355
- if (!tool || !hasExecuteFunction(tool)) {
356
- continue;
357
- }
358
- // Get the result from preliminary results or construct from the response
359
- const prelimResults = this.preliminaryResults.get(toolCall.id);
360
- const result = prelimResults && prelimResults.length > 0
361
- ? prelimResults[prelimResults.length - 1] // Last result is the final output
362
- : undefined;
363
- // Yield tool response message
364
- yield {
365
- role: 'tool',
366
- content: result !== undefined ? JSON.stringify(result) : '',
367
- toolCallId: toolCall.id,
368
- };
397
+ for (const toolResult of round.toolResults) {
398
+ yield toolResult;
369
399
  }
370
400
  }
371
- // If tools were executed, yield the final assistant message (if there is one)
401
+ // If tools were executed, yield the final message (if there is one)
372
402
  if (this.finalResponse && this.allToolExecutionRounds.length > 0) {
373
403
  // Check if the final response contains a message
374
- const hasMessage = this.finalResponse.output.some((item) => 'type' in item && item.type === 'message');
404
+ const hasMessage = this.finalResponse.output.some((item) => hasTypeProperty(item) && item.type === 'message');
375
405
  if (hasMessage) {
376
- yield extractMessageFromResponse(this.finalResponse);
406
+ yield extractResponsesMessageFromResponse(this.finalResponse);
377
407
  }
378
408
  }
379
409
  }.call(this);
@@ -418,66 +448,7 @@ export class ResponseWrapper {
418
448
  yield {
419
449
  type: 'preliminary_result',
420
450
  toolCallId,
421
- result,
422
- };
423
- }
424
- }
425
- }.call(this);
426
- }
427
- /**
428
- * Stream events in chat format (compatibility layer).
429
- * Note: This transforms responses API events into a chat-like format.
430
- * Includes preliminary tool result events after tool execution.
431
- *
432
- * @remarks
433
- * This is a compatibility method that attempts to transform the responses API
434
- * stream into a format similar to the chat API. Due to differences in the APIs,
435
- * this may not be a perfect mapping.
436
- */
437
- getFullChatStream() {
438
- return async function* () {
439
- await this.initStream();
440
- if (!this.reusableStream) {
441
- throw new Error('Stream not initialized');
442
- }
443
- const consumer = this.reusableStream.createConsumer();
444
- for await (const event of consumer) {
445
- if (!('type' in event)) {
446
- continue;
447
- }
448
- // Transform responses events to chat-like format
449
- // This is a simplified transformation - you may need to adjust based on your needs
450
- if (event.type === 'response.output_text.delta') {
451
- const deltaEvent = event;
452
- yield {
453
- type: 'content.delta',
454
- delta: deltaEvent.delta,
455
- };
456
- }
457
- else if (event.type === 'response.completed') {
458
- const completedEvent = event;
459
- yield {
460
- type: 'message.complete',
461
- response: completedEvent.response,
462
- };
463
- }
464
- else {
465
- // Pass through other events
466
- yield {
467
- type: event.type,
468
- event,
469
- };
470
- }
471
- }
472
- // After stream completes, check if tools were executed and emit preliminary results
473
- await this.executeToolsIfNeeded();
474
- // Emit all preliminary results
475
- for (const [toolCallId, results] of this.preliminaryResults) {
476
- for (const result of results) {
477
- yield {
478
- type: 'tool.preliminary_result',
479
- toolCallId,
480
- result,
451
+ result: result,
481
452
  };
482
453
  }
483
454
  }
@@ -519,4 +490,4 @@ export class ResponseWrapper {
519
490
  }
520
491
  }
521
492
  }
522
- //# sourceMappingURL=response-wrapper.js.map
493
+ //# sourceMappingURL=model-result.js.map
@@ -0,0 +1,30 @@
1
+ import type * as models from '../models/index.js';
2
+ import type { NextTurnParamsContext, ParsedToolCall, Tool } from './tool-types.js';
3
+ /**
4
+ * Build a NextTurnParamsContext from the current request
5
+ * Extracts relevant fields that can be modified by nextTurnParams functions
6
+ *
7
+ * @param request - The current OpenResponsesRequest
8
+ * @returns Context object with current parameter values
9
+ */
10
+ export declare function buildNextTurnParamsContext(request: models.OpenResponsesRequest): NextTurnParamsContext;
11
+ /**
12
+ * Execute nextTurnParams functions for all called tools
13
+ * Composes functions when multiple tools modify the same parameter
14
+ *
15
+ * @param toolCalls - Tool calls that were executed in this turn
16
+ * @param tools - All available tools
17
+ * @param currentRequest - The current request
18
+ * @returns Object with computed parameter values
19
+ */
20
+ export declare function executeNextTurnParamsFunctions(toolCalls: ParsedToolCall<Tool>[], tools: readonly Tool[], currentRequest: models.OpenResponsesRequest): Promise<Partial<NextTurnParamsContext>>;
21
+ /**
22
+ * Apply computed nextTurnParams to the current request
23
+ * Returns a new request object with updated parameters
24
+ *
25
+ * @param request - The current request
26
+ * @param computedParams - Computed parameter values from nextTurnParams functions
27
+ * @returns New request with updated parameters
28
+ */
29
+ export declare function applyNextTurnParamsToRequest(request: models.OpenResponsesRequest, computedParams: Partial<NextTurnParamsContext>): models.OpenResponsesRequest;
30
+ //# sourceMappingURL=next-turn-params.d.ts.map