@mistralai/mistralai 3.3.0 → 3.5.0
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.
- package/README.md +76 -46
- package/esm/extra/realtime/connection.d.ts +16 -3
- package/esm/extra/realtime/connection.d.ts.map +1 -1
- package/esm/extra/realtime/connection.js +35 -9
- package/esm/extra/realtime/connection.js.map +1 -1
- package/esm/extra/realtime/errors.d.ts +18 -0
- package/esm/extra/realtime/errors.d.ts.map +1 -1
- package/esm/extra/realtime/errors.js +19 -0
- package/esm/extra/realtime/errors.js.map +1 -1
- package/esm/extra/realtime/index.d.ts +20 -1
- package/esm/extra/realtime/index.d.ts.map +1 -1
- package/esm/extra/realtime/index.js +5 -0
- package/esm/extra/realtime/index.js.map +1 -1
- package/esm/extra/realtime/speech.d.ts +64 -0
- package/esm/extra/realtime/speech.d.ts.map +1 -0
- package/esm/extra/realtime/speech.js +461 -0
- package/esm/extra/realtime/speech.js.map +1 -0
- package/esm/extra/realtime/transcription.d.ts +2 -2
- package/esm/extra/realtime/transcription.d.ts.map +1 -1
- package/esm/extra/realtime/transcription.js +11 -2
- package/esm/extra/realtime/transcription.js.map +1 -1
- package/esm/extra/workflows/encoding/payload-encoder.d.ts.map +1 -1
- package/esm/extra/workflows/encoding/payload-encoder.js +2 -2
- package/esm/extra/workflows/encoding/payload-encoder.js.map +1 -1
- package/esm/extra/workflows/encoding/python-json.d.ts +3 -2
- package/esm/extra/workflows/encoding/python-json.d.ts.map +1 -1
- package/esm/extra/workflows/encoding/python-json.js +24 -9
- package/esm/extra/workflows/encoding/python-json.js.map +1 -1
- package/esm/funcs/{betaRagManagedIndexesCreate.d.ts → betaContextSearchIndexesCreate.d.ts} +2 -2
- package/esm/funcs/betaContextSearchIndexesCreate.d.ts.map +1 -0
- package/esm/funcs/{betaRagManagedIndexesCreate.js → betaContextSearchIndexesCreate.js} +3 -3
- package/esm/funcs/betaContextSearchIndexesCreate.js.map +1 -0
- package/esm/funcs/{betaRagManagedIndexesDelete.d.ts → betaContextSearchIndexesDelete.d.ts} +2 -2
- package/esm/funcs/betaContextSearchIndexesDelete.d.ts.map +1 -0
- package/esm/funcs/{betaRagManagedIndexesDelete.js → betaContextSearchIndexesDelete.js} +2 -2
- package/esm/funcs/betaContextSearchIndexesDelete.js.map +1 -0
- package/esm/funcs/{betaRagManagedIndexesDeleteDocuments.d.ts → betaContextSearchIndexesDeleteDocuments.d.ts} +2 -2
- package/esm/funcs/betaContextSearchIndexesDeleteDocuments.d.ts.map +1 -0
- package/esm/funcs/{betaRagManagedIndexesDeleteDocuments.js → betaContextSearchIndexesDeleteDocuments.js} +2 -2
- package/esm/funcs/betaContextSearchIndexesDeleteDocuments.js.map +1 -0
- package/esm/funcs/{betaRagManagedIndexesGenerateIndexSummary.d.ts → betaContextSearchIndexesGenerateIndexSummary.d.ts} +2 -2
- package/esm/funcs/betaContextSearchIndexesGenerateIndexSummary.d.ts.map +1 -0
- package/esm/funcs/{betaRagManagedIndexesGenerateIndexSummary.js → betaContextSearchIndexesGenerateIndexSummary.js} +2 -2
- package/esm/funcs/betaContextSearchIndexesGenerateIndexSummary.js.map +1 -0
- package/esm/funcs/{betaRagManagedIndexesGet.d.ts → betaContextSearchIndexesGet.d.ts} +2 -2
- package/esm/funcs/{betaRagManagedIndexesDelete.d.ts.map → betaContextSearchIndexesGet.d.ts.map} +1 -1
- package/esm/funcs/{betaRagManagedIndexesGet.js → betaContextSearchIndexesGet.js} +2 -2
- package/esm/funcs/betaContextSearchIndexesGet.js.map +1 -0
- package/esm/funcs/{betaRagManagedIndexesGetChunk.d.ts → betaContextSearchIndexesGetChunk.d.ts} +2 -2
- package/esm/funcs/betaContextSearchIndexesGetChunk.d.ts.map +1 -0
- package/esm/funcs/{betaRagManagedIndexesGetChunk.js → betaContextSearchIndexesGetChunk.js} +2 -2
- package/esm/funcs/betaContextSearchIndexesGetChunk.js.map +1 -0
- package/esm/funcs/{betaRagManagedIndexesGetIndexSummary.d.ts → betaContextSearchIndexesGetIndexSummary.d.ts} +2 -2
- package/esm/funcs/betaContextSearchIndexesGetIndexSummary.d.ts.map +1 -0
- package/esm/funcs/{betaRagManagedIndexesGetIndexSummary.js → betaContextSearchIndexesGetIndexSummary.js} +2 -2
- package/esm/funcs/betaContextSearchIndexesGetIndexSummary.js.map +1 -0
- package/esm/funcs/{betaRagManagedIndexesGrep.d.ts → betaContextSearchIndexesGrep.d.ts} +2 -2
- package/esm/funcs/betaContextSearchIndexesGrep.d.ts.map +1 -0
- package/esm/funcs/{betaRagManagedIndexesGrep.js → betaContextSearchIndexesGrep.js} +2 -2
- package/esm/funcs/betaContextSearchIndexesGrep.js.map +1 -0
- package/esm/funcs/betaContextSearchIndexesIngestDocuments.d.ts +19 -0
- package/esm/funcs/betaContextSearchIndexesIngestDocuments.d.ts.map +1 -0
- package/esm/funcs/{betaRagManagedIndexesIngestDocuments.js → betaContextSearchIndexesIngestDocuments.js} +2 -2
- package/esm/funcs/betaContextSearchIndexesIngestDocuments.js.map +1 -0
- package/esm/funcs/{betaRagManagedIndexesList.d.ts → betaContextSearchIndexesList.d.ts} +2 -2
- package/esm/funcs/betaContextSearchIndexesList.d.ts.map +1 -0
- package/esm/funcs/{betaRagManagedIndexesList.js → betaContextSearchIndexesList.js} +3 -3
- package/esm/funcs/betaContextSearchIndexesList.js.map +1 -0
- package/esm/funcs/{betaRagManagedIndexesNavigate.d.ts → betaContextSearchIndexesNavigate.d.ts} +2 -2
- package/esm/funcs/betaContextSearchIndexesNavigate.d.ts.map +1 -0
- package/esm/funcs/{betaRagManagedIndexesNavigate.js → betaContextSearchIndexesNavigate.js} +2 -2
- package/esm/funcs/betaContextSearchIndexesNavigate.js.map +1 -0
- package/esm/funcs/{betaRagManagedIndexesRead.d.ts → betaContextSearchIndexesRead.d.ts} +2 -2
- package/esm/funcs/betaContextSearchIndexesRead.d.ts.map +1 -0
- package/esm/funcs/{betaRagManagedIndexesRead.js → betaContextSearchIndexesRead.js} +2 -2
- package/esm/funcs/betaContextSearchIndexesRead.js.map +1 -0
- package/esm/funcs/{betaRagManagedIndexesSearch.d.ts → betaContextSearchIndexesSearch.d.ts} +2 -2
- package/esm/funcs/betaContextSearchIndexesSearch.d.ts.map +1 -0
- package/esm/funcs/{betaRagManagedIndexesSearch.js → betaContextSearchIndexesSearch.js} +2 -2
- package/esm/funcs/betaContextSearchIndexesSearch.js.map +1 -0
- package/esm/funcs/{betaRagManagedIndexesSetIndexSummary.d.ts → betaContextSearchIndexesSetIndexSummary.d.ts} +2 -2
- package/esm/funcs/betaContextSearchIndexesSetIndexSummary.d.ts.map +1 -0
- package/esm/funcs/{betaRagManagedIndexesSetIndexSummary.js → betaContextSearchIndexesSetIndexSummary.js} +2 -2
- package/esm/funcs/betaContextSearchIndexesSetIndexSummary.js.map +1 -0
- package/esm/funcs/{betaRagManagedIndexesUpdate.d.ts → betaContextSearchIndexesUpdate.d.ts} +2 -2
- package/esm/funcs/betaContextSearchIndexesUpdate.d.ts.map +1 -0
- package/esm/funcs/{betaRagManagedIndexesUpdate.js → betaContextSearchIndexesUpdate.js} +2 -2
- package/esm/funcs/betaContextSearchIndexesUpdate.js.map +1 -0
- package/esm/funcs/betaTriggersCreate.d.ts +15 -0
- package/esm/funcs/betaTriggersCreate.d.ts.map +1 -0
- package/esm/funcs/betaTriggersCreate.js +80 -0
- package/esm/funcs/betaTriggersCreate.js.map +1 -0
- package/esm/funcs/betaTriggersDelete.d.ts +15 -0
- package/esm/funcs/betaTriggersDelete.d.ts.map +1 -0
- package/esm/funcs/betaTriggersDelete.js +87 -0
- package/esm/funcs/betaTriggersDelete.js.map +1 -0
- package/esm/funcs/{betaRagManagedIndexesIngestDocuments.d.ts → betaTriggersGet.d.ts} +3 -6
- package/esm/funcs/betaTriggersGet.d.ts.map +1 -0
- package/esm/funcs/betaTriggersGet.js +86 -0
- package/esm/funcs/betaTriggersGet.js.map +1 -0
- package/esm/funcs/betaTriggersList.d.ts +16 -0
- package/esm/funcs/betaTriggersList.d.ts.map +1 -0
- package/esm/funcs/betaTriggersList.js +88 -0
- package/esm/funcs/betaTriggersList.js.map +1 -0
- package/esm/funcs/betaTriggersListEvents.d.ts +16 -0
- package/esm/funcs/betaTriggersListEvents.d.ts.map +1 -0
- package/esm/funcs/betaTriggersListEvents.js +92 -0
- package/esm/funcs/betaTriggersListEvents.js.map +1 -0
- package/esm/funcs/betaWebhooksCreate.d.ts +15 -0
- package/esm/funcs/betaWebhooksCreate.d.ts.map +1 -0
- package/esm/funcs/betaWebhooksCreate.js +80 -0
- package/esm/funcs/betaWebhooksCreate.js.map +1 -0
- package/esm/funcs/betaWebhooksDelete.d.ts +15 -0
- package/esm/funcs/betaWebhooksDelete.d.ts.map +1 -0
- package/esm/funcs/betaWebhooksDelete.js +87 -0
- package/esm/funcs/betaWebhooksDelete.js.map +1 -0
- package/esm/funcs/betaWebhooksGet.d.ts +16 -0
- package/esm/funcs/betaWebhooksGet.d.ts.map +1 -0
- package/esm/funcs/betaWebhooksGet.js +86 -0
- package/esm/funcs/betaWebhooksGet.js.map +1 -0
- package/esm/funcs/betaWebhooksGetSigningSecret.d.ts +16 -0
- package/esm/funcs/betaWebhooksGetSigningSecret.d.ts.map +1 -0
- package/esm/funcs/betaWebhooksGetSigningSecret.js +88 -0
- package/esm/funcs/betaWebhooksGetSigningSecret.js.map +1 -0
- package/esm/funcs/betaWebhooksList.d.ts +14 -0
- package/esm/funcs/betaWebhooksList.d.ts.map +1 -0
- package/esm/funcs/betaWebhooksList.js +67 -0
- package/esm/funcs/betaWebhooksList.js.map +1 -0
- package/esm/funcs/workflowsAddWorkflowTags.d.ts +15 -0
- package/esm/funcs/workflowsAddWorkflowTags.d.ts.map +1 -0
- package/esm/funcs/workflowsAddWorkflowTags.js +88 -0
- package/esm/funcs/workflowsAddWorkflowTags.js.map +1 -0
- package/esm/funcs/workflowsDeploymentsGetDeploymentArchive.d.ts +22 -0
- package/esm/funcs/workflowsDeploymentsGetDeploymentArchive.d.ts.map +1 -0
- package/esm/funcs/workflowsDeploymentsGetDeploymentArchive.js +94 -0
- package/esm/funcs/workflowsDeploymentsGetDeploymentArchive.js.map +1 -0
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/components/connectionpreference.d.ts +12 -2
- package/esm/models/components/connectionpreference.d.ts.map +1 -1
- package/esm/models/components/connectionpreference.js +3 -3
- package/esm/models/components/connectionpreference.js.map +1 -1
- package/esm/models/components/connectoropenapispec.d.ts +14 -0
- package/esm/models/components/connectoropenapispec.d.ts.map +1 -0
- package/esm/models/components/connectoropenapispec.js +14 -0
- package/esm/models/components/connectoropenapispec.js.map +1 -0
- package/esm/models/components/createtrigger.d.ts +34 -0
- package/esm/models/components/createtrigger.d.ts.map +1 -0
- package/esm/models/components/createtrigger.js +26 -0
- package/esm/models/components/createtrigger.js.map +1 -0
- package/esm/models/components/createtriggeraction.d.ts +18 -0
- package/esm/models/components/createtriggeraction.d.ts.map +1 -0
- package/esm/models/components/createtriggeraction.js +19 -0
- package/esm/models/components/createtriggeraction.js.map +1 -0
- package/esm/models/components/createwebhook.d.ts +62 -0
- package/esm/models/components/createwebhook.d.ts.map +1 -0
- package/esm/models/components/createwebhook.js +47 -0
- package/esm/models/components/createwebhook.js.map +1 -0
- package/esm/models/components/deploymentarchiveresponse.d.ts +20 -0
- package/esm/models/components/deploymentarchiveresponse.d.ts.map +1 -0
- package/esm/models/components/deploymentarchiveresponse.js +20 -0
- package/esm/models/components/deploymentarchiveresponse.js.map +1 -0
- package/esm/models/components/deploymentworkerspecinput.d.ts +15 -2
- package/esm/models/components/deploymentworkerspecinput.d.ts.map +1 -1
- package/esm/models/components/deploymentworkerspecinput.js +5 -1
- package/esm/models/components/deploymentworkerspecinput.js.map +1 -1
- package/esm/models/components/deploymentworkerspecresponse.d.ts +8 -0
- package/esm/models/components/deploymentworkerspecresponse.d.ts.map +1 -1
- package/esm/models/components/deploymentworkerspecresponse.js +4 -0
- package/esm/models/components/deploymentworkerspecresponse.js.map +1 -1
- package/esm/models/components/getlog.d.ts +1 -0
- package/esm/models/components/getlog.d.ts.map +1 -1
- package/esm/models/components/getlog.js +2 -0
- package/esm/models/components/getlog.js.map +1 -1
- package/esm/models/components/getspan.d.ts +1 -0
- package/esm/models/components/getspan.d.ts.map +1 -1
- package/esm/models/components/getspan.js +2 -0
- package/esm/models/components/getspan.js.map +1 -1
- package/esm/models/components/getspanevaluation.d.ts +1 -0
- package/esm/models/components/getspanevaluation.d.ts.map +1 -1
- package/esm/models/components/getspanevaluation.js +2 -0
- package/esm/models/components/getspanevaluation.js.map +1 -1
- package/esm/models/components/gettrace.d.ts +1 -0
- package/esm/models/components/gettrace.d.ts.map +1 -1
- package/esm/models/components/gettrace.js +2 -0
- package/esm/models/components/gettrace.js.map +1 -1
- package/esm/models/components/httpconnector.d.ts +5 -0
- package/esm/models/components/httpconnector.d.ts.map +1 -1
- package/esm/models/components/httpconnector.js +3 -0
- package/esm/models/components/httpconnector.js.map +1 -1
- package/esm/models/components/index.d.ts +33 -5
- package/esm/models/components/index.d.ts.map +1 -1
- package/esm/models/components/index.js +33 -5
- package/esm/models/components/index.js.map +1 -1
- package/esm/models/components/observabilityerrorcode.d.ts +1 -0
- package/esm/models/components/observabilityerrorcode.d.ts.map +1 -1
- package/esm/models/components/observabilityerrorcode.js +1 -0
- package/esm/models/components/observabilityerrorcode.js.map +1 -1
- package/esm/models/components/openapifilesource.d.ts +14 -0
- package/esm/models/components/openapifilesource.d.ts.map +1 -0
- package/esm/models/components/openapifilesource.js +14 -0
- package/esm/models/components/openapifilesource.js.map +1 -0
- package/esm/models/components/openapispecsource.d.ts +11 -0
- package/esm/models/components/openapispecsource.d.ts.map +1 -0
- package/esm/models/components/openapispecsource.js +16 -0
- package/esm/models/components/openapispecsource.js.map +1 -0
- package/esm/models/components/openapiurlsource.d.ts +14 -0
- package/esm/models/components/openapiurlsource.d.ts.map +1 -0
- package/esm/models/components/openapiurlsource.js +14 -0
- package/esm/models/components/openapiurlsource.js.map +1 -0
- package/esm/models/components/realtimespeecherror.d.ts +20 -0
- package/esm/models/components/realtimespeecherror.d.ts.map +1 -0
- package/esm/models/components/realtimespeecherror.js +23 -0
- package/esm/models/components/realtimespeecherror.js.map +1 -0
- package/esm/models/components/realtimespeecherrordetail.d.ts +45 -0
- package/esm/models/components/realtimespeecherrordetail.d.ts.map +1 -0
- package/esm/models/components/realtimespeecherrordetail.js +33 -0
- package/esm/models/components/realtimespeecherrordetail.js.map +1 -0
- package/esm/models/components/realtimespeechinputtextappend.d.ts +19 -0
- package/esm/models/components/realtimespeechinputtextappend.d.ts.map +1 -0
- package/esm/models/components/realtimespeechinputtextappend.js +22 -0
- package/esm/models/components/realtimespeechinputtextappend.js.map +1 -0
- package/esm/models/components/realtimespeechinputtextend.d.ts +17 -0
- package/esm/models/components/realtimespeechinputtextend.d.ts.map +1 -0
- package/esm/models/components/realtimespeechinputtextend.js +20 -0
- package/esm/models/components/realtimespeechinputtextend.js.map +1 -0
- package/esm/models/components/realtimespeechinputtextflush.d.ts +19 -0
- package/esm/models/components/realtimespeechinputtextflush.d.ts.map +1 -0
- package/esm/models/components/realtimespeechinputtextflush.js +22 -0
- package/esm/models/components/realtimespeechinputtextflush.js.map +1 -0
- package/esm/models/components/realtimespeechsession.d.ts +31 -0
- package/esm/models/components/realtimespeechsession.d.ts.map +1 -0
- package/esm/models/components/realtimespeechsession.js +49 -0
- package/esm/models/components/realtimespeechsession.js.map +1 -0
- package/esm/models/components/realtimespeechsessioncreated.d.ts +20 -0
- package/esm/models/components/realtimespeechsessioncreated.d.ts.map +1 -0
- package/esm/models/components/realtimespeechsessioncreated.js +23 -0
- package/esm/models/components/realtimespeechsessioncreated.js.map +1 -0
- package/esm/models/components/realtimespeechsessionupdated.d.ts +20 -0
- package/esm/models/components/realtimespeechsessionupdated.d.ts.map +1 -0
- package/esm/models/components/realtimespeechsessionupdated.js +23 -0
- package/esm/models/components/realtimespeechsessionupdated.js.map +1 -0
- package/esm/models/components/realtimespeechsessionupdatemessage.d.ts +20 -0
- package/esm/models/components/realtimespeechsessionupdatemessage.d.ts.map +1 -0
- package/esm/models/components/realtimespeechsessionupdatemessage.js +23 -0
- package/esm/models/components/realtimespeechsessionupdatemessage.js.map +1 -0
- package/esm/models/components/realtimespeechsessionupdatepayload.d.ts +42 -0
- package/esm/models/components/realtimespeechsessionupdatepayload.d.ts.map +1 -0
- package/esm/models/components/realtimespeechsessionupdatepayload.js +45 -0
- package/esm/models/components/realtimespeechsessionupdatepayload.js.map +1 -0
- package/esm/models/components/realtimespeechstreamingmode.d.ts +12 -0
- package/esm/models/components/realtimespeechstreamingmode.d.ts.map +1 -0
- package/esm/models/components/realtimespeechstreamingmode.js +13 -0
- package/esm/models/components/realtimespeechstreamingmode.js.map +1 -0
- package/esm/models/components/speechoutputformat.d.ts +2 -0
- package/esm/models/components/speechoutputformat.d.ts.map +1 -1
- package/esm/models/components/speechoutputformat.js +3 -1
- package/esm/models/components/speechoutputformat.js.map +1 -1
- package/esm/models/components/speechstreamaudiodelta.d.ts +8 -0
- package/esm/models/components/speechstreamaudiodelta.d.ts.map +1 -1
- package/esm/models/components/speechstreamaudiodelta.js +12 -0
- package/esm/models/components/speechstreamaudiodelta.js.map +1 -1
- package/esm/models/components/speechstreamdone.d.ts +10 -2
- package/esm/models/components/speechstreamdone.d.ts.map +1 -1
- package/esm/models/components/speechstreamdone.js +10 -2
- package/esm/models/components/speechstreamdone.js.map +1 -1
- package/esm/models/components/systemv2.d.ts +4 -0
- package/esm/models/components/systemv2.d.ts.map +1 -1
- package/esm/models/components/systemv2.js +2 -0
- package/esm/models/components/systemv2.js.map +1 -1
- package/esm/models/components/trigger.d.ts +24 -0
- package/esm/models/components/trigger.d.ts.map +1 -0
- package/esm/models/components/trigger.js +37 -0
- package/esm/models/components/trigger.js.map +1 -0
- package/esm/models/components/triggeraction.d.ts +12 -0
- package/esm/models/components/triggeraction.d.ts.map +1 -0
- package/esm/models/components/triggeraction.js +21 -0
- package/esm/models/components/triggeraction.js.map +1 -0
- package/esm/models/components/triggeractiontype.d.ts +14 -0
- package/esm/models/components/triggeractiontype.d.ts.map +1 -0
- package/esm/models/components/triggeractiontype.js +15 -0
- package/esm/models/components/triggeractiontype.js.map +1 -0
- package/esm/models/components/triggerevent.d.ts +19 -0
- package/esm/models/components/triggerevent.d.ts.map +1 -0
- package/esm/models/components/triggerevent.js +33 -0
- package/esm/models/components/triggerevent.js.map +1 -0
- package/esm/models/components/triggereventlist.d.ts +11 -0
- package/esm/models/components/triggereventlist.d.ts.map +1 -0
- package/esm/models/components/triggereventlist.js +14 -0
- package/esm/models/components/triggereventlist.js.map +1 -0
- package/esm/models/components/triggerhandler.d.ts +13 -0
- package/esm/models/components/triggerhandler.d.ts.map +1 -0
- package/esm/models/components/triggerhandler.js +14 -0
- package/esm/models/components/triggerhandler.js.map +1 -0
- package/esm/models/components/triggersownertype.d.ts +12 -0
- package/esm/models/components/triggersownertype.d.ts.map +1 -0
- package/esm/models/components/triggersownertype.js +13 -0
- package/esm/models/components/triggersownertype.js.map +1 -0
- package/esm/models/components/triggerstatusvalue.d.ts +12 -0
- package/esm/models/components/triggerstatusvalue.d.ts.map +1 -0
- package/esm/models/components/triggerstatusvalue.js +13 -0
- package/esm/models/components/triggerstatusvalue.js.map +1 -0
- package/esm/models/components/voicecreaterequest.d.ts +2 -3
- package/esm/models/components/voicecreaterequest.d.ts.map +1 -1
- package/esm/models/components/voicecreaterequest.js +2 -2
- package/esm/models/components/voicecreaterequest.js.map +1 -1
- package/esm/models/components/voiceupdaterequest.d.ts +2 -1
- package/esm/models/components/voiceupdaterequest.d.ts.map +1 -1
- package/esm/models/components/voiceupdaterequest.js +2 -1
- package/esm/models/components/voiceupdaterequest.js.map +1 -1
- package/esm/models/components/webhook.d.ts +35 -0
- package/esm/models/components/webhook.d.ts.map +1 -0
- package/esm/models/components/webhook.js +60 -0
- package/esm/models/components/webhook.js.map +1 -0
- package/esm/models/components/webhookprovider.d.ts +18 -0
- package/esm/models/components/webhookprovider.d.ts.map +1 -0
- package/esm/models/components/webhookprovider.js +19 -0
- package/esm/models/components/webhookprovider.js.map +1 -0
- package/esm/models/components/webhooksignatureencoding.d.ts +12 -0
- package/esm/models/components/webhooksignatureencoding.d.ts.map +1 -0
- package/esm/models/components/webhooksignatureencoding.js +13 -0
- package/esm/models/components/webhooksignatureencoding.js.map +1 -0
- package/esm/models/components/webhooksignaturehashalgorithm.d.ts +12 -0
- package/esm/models/components/webhooksignaturehashalgorithm.d.ts.map +1 -0
- package/esm/models/components/webhooksignaturehashalgorithm.js +13 -0
- package/esm/models/components/webhooksignaturehashalgorithm.js.map +1 -0
- package/esm/models/components/webhooksigningsecret.d.ts +13 -0
- package/esm/models/components/webhooksigningsecret.d.ts.map +1 -0
- package/esm/models/components/webhooksigningsecret.js +18 -0
- package/esm/models/components/webhooksigningsecret.js.map +1 -0
- package/esm/models/components/workflowsworkerspecupdate.d.ts +10 -0
- package/esm/models/components/workflowsworkerspecupdate.d.ts.map +1 -1
- package/esm/models/components/workflowsworkerspecupdate.js +4 -0
- package/esm/models/components/workflowsworkerspecupdate.js.map +1 -1
- package/esm/models/components/workflowtagsaddrequest.d.ts +15 -0
- package/esm/models/components/workflowtagsaddrequest.d.ts.map +1 -0
- package/esm/models/components/workflowtagsaddrequest.js +12 -0
- package/esm/models/components/workflowtagsaddrequest.js.map +1 -0
- package/esm/models/operations/addworkflowtagsv1workflowsworkflowidentifiertagspost.d.ts +15 -0
- package/esm/models/operations/addworkflowtagsv1workflowsworkflowidentifiertagspost.d.ts.map +1 -0
- package/esm/models/operations/addworkflowtagsv1workflowsworkflowidentifiertagspost.js +21 -0
- package/esm/models/operations/addworkflowtagsv1workflowsworkflowidentifiertagspost.js.map +1 -0
- package/esm/models/operations/deletetriggerv1triggerstriggeriddelete.d.ts +12 -0
- package/esm/models/operations/deletetriggerv1triggerstriggeriddelete.d.ts.map +1 -0
- package/esm/models/operations/deletetriggerv1triggerstriggeriddelete.js +17 -0
- package/esm/models/operations/deletetriggerv1triggerstriggeriddelete.js.map +1 -0
- package/esm/models/operations/deletewebhookv1webhookswebhookiddelete.d.ts +12 -0
- package/esm/models/operations/deletewebhookv1webhookswebhookiddelete.d.ts.map +1 -0
- package/esm/models/operations/deletewebhookv1webhookswebhookiddelete.js +17 -0
- package/esm/models/operations/deletewebhookv1webhookswebhookiddelete.js.map +1 -0
- package/esm/models/operations/getdeploymentarchivev1workflowsdeploymentsnamearchiveget.d.ts +12 -0
- package/esm/models/operations/getdeploymentarchivev1workflowsdeploymentsnamearchiveget.d.ts.map +1 -0
- package/esm/models/operations/getdeploymentarchivev1workflowsdeploymentsnamearchiveget.js +13 -0
- package/esm/models/operations/getdeploymentarchivev1workflowsdeploymentsnamearchiveget.js.map +1 -0
- package/esm/models/operations/gettriggerv1triggerstriggeridget.d.ts +12 -0
- package/esm/models/operations/gettriggerv1triggerstriggeridget.d.ts.map +1 -0
- package/esm/models/operations/gettriggerv1triggerstriggeridget.js +17 -0
- package/esm/models/operations/gettriggerv1triggerstriggeridget.js.map +1 -0
- package/esm/models/operations/getwebhooksigningsecretv1webhookswebhookidsigningsecretget.d.ts +12 -0
- package/esm/models/operations/getwebhooksigningsecretv1webhookswebhookidsigningsecretget.d.ts.map +1 -0
- package/esm/models/operations/getwebhooksigningsecretv1webhookswebhookidsigningsecretget.js +18 -0
- package/esm/models/operations/getwebhooksigningsecretv1webhookswebhookidsigningsecretget.js.map +1 -0
- package/esm/models/operations/getwebhookv1webhookswebhookidget.d.ts +12 -0
- package/esm/models/operations/getwebhookv1webhookswebhookidget.d.ts.map +1 -0
- package/esm/models/operations/getwebhookv1webhookswebhookidget.js +17 -0
- package/esm/models/operations/getwebhookv1webhookswebhookidget.js.map +1 -0
- package/esm/models/operations/index.d.ts +9 -0
- package/esm/models/operations/index.d.ts.map +1 -1
- package/esm/models/operations/index.js +9 -0
- package/esm/models/operations/index.js.map +1 -1
- package/esm/models/operations/listtriggereventsv1triggerstriggerideventsget.d.ts +17 -0
- package/esm/models/operations/listtriggereventsv1triggerstriggerideventsget.d.ts.map +1 -0
- package/esm/models/operations/listtriggereventsv1triggerstriggerideventsget.js +18 -0
- package/esm/models/operations/listtriggereventsv1triggerstriggerideventsget.js.map +1 -0
- package/esm/models/operations/listtriggersv1triggersget.d.ts +26 -0
- package/esm/models/operations/listtriggersv1triggersget.d.ts.map +1 -0
- package/esm/models/operations/listtriggersv1triggersget.js +21 -0
- package/esm/models/operations/listtriggersv1triggersget.js.map +1 -0
- package/esm/models/operations/skillslist.d.ts +3 -0
- package/esm/models/operations/skillslist.d.ts.map +1 -1
- package/esm/models/operations/skillslist.js.map +1 -1
- package/esm/sdk/beta.d.ts +9 -0
- package/esm/sdk/beta.d.ts.map +1 -1
- package/esm/sdk/beta.js +15 -0
- package/esm/sdk/beta.js.map +1 -1
- package/esm/sdk/context.d.ts +7 -0
- package/esm/sdk/context.d.ts.map +1 -0
- package/esm/sdk/context.js +12 -0
- package/esm/sdk/context.js.map +1 -0
- package/esm/sdk/{managedindexes.d.ts → contextsearchindexes.d.ts} +2 -2
- package/esm/sdk/contextsearchindexes.d.ts.map +1 -0
- package/esm/sdk/{managedindexes.js → contextsearchindexes.js} +32 -32
- package/esm/sdk/contextsearchindexes.js.map +1 -0
- package/esm/sdk/deployments.d.ts +10 -0
- package/esm/sdk/deployments.d.ts.map +1 -1
- package/esm/sdk/deployments.js +13 -0
- package/esm/sdk/deployments.js.map +1 -1
- package/esm/sdk/rag.d.ts +2 -5
- package/esm/sdk/rag.d.ts.map +1 -1
- package/esm/sdk/rag.js +2 -7
- package/esm/sdk/rag.js.map +1 -1
- package/esm/sdk/{searchindexes.d.ts → ragsearchindexes.d.ts} +2 -2
- package/esm/sdk/ragsearchindexes.d.ts.map +1 -0
- package/esm/sdk/{searchindexes.js → ragsearchindexes.js} +2 -2
- package/esm/sdk/ragsearchindexes.js.map +1 -0
- package/esm/sdk/triggers.d.ts +26 -0
- package/esm/sdk/triggers.d.ts.map +1 -0
- package/esm/sdk/triggers.js +43 -0
- package/esm/sdk/triggers.js.map +1 -0
- package/esm/sdk/webhooks.d.ts +26 -0
- package/esm/sdk/webhooks.d.ts.map +1 -0
- package/esm/sdk/webhooks.js +43 -0
- package/esm/sdk/webhooks.js.map +1 -0
- package/esm/sdk/workflows.d.ts +4 -0
- package/esm/sdk/workflows.d.ts.map +1 -1
- package/esm/sdk/workflows.js +7 -0
- package/esm/sdk/workflows.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +11 -11
- package/packages/mistralai-azure/examples/chatComplete.example.ts +0 -1
- package/packages/mistralai-azure/src/core.ts +0 -1
- package/packages/mistralai-azure/src/funcs/chatComplete.ts +1 -2
- package/packages/mistralai-azure/src/funcs/chatStream.ts +1 -2
- package/packages/mistralai-azure/src/funcs/ocrProcess.ts +1 -2
- package/packages/mistralai-azure/src/hooks/hooks.ts +0 -1
- package/packages/mistralai-azure/src/hooks/index.ts +0 -1
- package/packages/mistralai-azure/src/hooks/types.ts +1 -1
- package/packages/mistralai-azure/src/index.ts +0 -1
- package/packages/mistralai-azure/src/lib/base64.ts +0 -1
- package/packages/mistralai-azure/src/lib/config.ts +7 -8
- package/packages/mistralai-azure/src/lib/encodings.ts +59 -25
- package/packages/mistralai-azure/src/lib/env.ts +7 -4
- package/packages/mistralai-azure/src/lib/event-streams.ts +46 -21
- package/packages/mistralai-azure/src/lib/files.ts +0 -1
- package/packages/mistralai-azure/src/lib/http.ts +3 -2
- package/packages/mistralai-azure/src/lib/logger.ts +0 -1
- package/packages/mistralai-azure/src/lib/matchers.ts +1 -2
- package/packages/mistralai-azure/src/lib/primitives.ts +16 -1
- package/packages/mistralai-azure/src/lib/retries.ts +8 -1
- package/packages/mistralai-azure/src/lib/schemas.ts +0 -1
- package/packages/mistralai-azure/src/lib/sdks.ts +54 -18
- package/packages/mistralai-azure/src/lib/security.ts +10 -6
- package/packages/mistralai-azure/src/lib/url.ts +0 -1
- package/packages/mistralai-azure/src/models/components/apikeyauth.ts +0 -1
- package/packages/mistralai-azure/src/models/components/assistantmessage.ts +0 -1
- package/packages/mistralai-azure/src/models/components/builtinconnectors.ts +1 -1
- package/packages/mistralai-azure/src/models/components/chatcompletionchoice.ts +12 -1
- package/packages/mistralai-azure/src/models/components/chatcompletionrequest.ts +28 -40
- package/packages/mistralai-azure/src/models/components/chatcompletionresponse.ts +0 -1
- package/packages/mistralai-azure/src/models/components/chatcompletionresponsechoicelogprobs.ts +35 -0
- package/packages/mistralai-azure/src/models/components/chatcompletionresponsetokenlogprobs.ts +42 -0
- package/packages/mistralai-azure/src/models/components/chatcompletionresponsetokenlogprobstopk.ts +56 -0
- package/packages/mistralai-azure/src/models/components/chatcompletionstreamrequest.ts +28 -40
- package/packages/mistralai-azure/src/models/components/completionchunk.ts +0 -1
- package/packages/mistralai-azure/src/models/components/completionevent.ts +2 -2
- package/packages/mistralai-azure/src/models/components/completionresponsestreamchoice.ts +12 -1
- package/packages/mistralai-azure/src/models/components/contentchunk.ts +0 -1
- package/packages/mistralai-azure/src/models/components/customconnector.ts +5 -1
- package/packages/mistralai-azure/src/models/components/deltamessage.ts +0 -1
- package/packages/mistralai-azure/src/models/components/documentlibrarytool.ts +0 -1
- package/packages/mistralai-azure/src/models/components/documenturlchunk.ts +0 -1
- package/packages/mistralai-azure/src/models/components/filechunk.ts +0 -1
- package/packages/mistralai-azure/src/models/components/function.ts +0 -1
- package/packages/mistralai-azure/src/models/components/functioncall.ts +0 -1
- package/packages/mistralai-azure/src/models/components/functionname.ts +0 -1
- package/packages/mistralai-azure/src/models/components/guardrailconfig.ts +0 -1
- package/packages/mistralai-azure/src/models/components/imagedetail.ts +0 -1
- package/packages/mistralai-azure/src/models/components/imagegenerationtool.ts +0 -1
- package/packages/mistralai-azure/src/models/components/imageurl.ts +0 -1
- package/packages/mistralai-azure/src/models/components/imageurlchunk.ts +0 -1
- package/packages/mistralai-azure/src/models/components/index.ts +17 -4
- package/packages/mistralai-azure/src/models/components/jsonschema.ts +0 -1
- package/packages/mistralai-azure/src/models/components/mistralpromptmode.ts +0 -1
- package/packages/mistralai-azure/src/models/components/moderationllmaction.ts +0 -1
- package/packages/mistralai-azure/src/models/components/moderationllmv1categorythresholds.ts +0 -1
- package/packages/mistralai-azure/src/models/components/moderationllmv1config.ts +0 -1
- package/packages/mistralai-azure/src/models/components/moderationllmv2categorythresholds.ts +0 -1
- package/packages/mistralai-azure/src/models/components/moderationllmv2config.ts +0 -1
- package/packages/mistralai-azure/src/models/components/oauth2tokenauth.ts +0 -1
- package/packages/mistralai-azure/src/models/components/ocrasidetextblock.ts +62 -0
- package/packages/mistralai-azure/src/models/components/ocrblockconfidencescores.ts +59 -0
- package/packages/mistralai-azure/src/models/components/ocrcaptionblock.ts +62 -0
- package/packages/mistralai-azure/src/models/components/ocrcodeblock.ts +60 -0
- package/packages/mistralai-azure/src/models/components/ocrconfidencescore.ts +0 -1
- package/packages/mistralai-azure/src/models/components/ocrequationblock.ts +62 -0
- package/packages/mistralai-azure/src/models/components/ocrfooterblock.ts +60 -0
- package/packages/mistralai-azure/src/models/components/ocrheaderblock.ts +60 -0
- package/packages/mistralai-azure/src/models/components/ocrimageblock.ts +66 -0
- package/packages/mistralai-azure/src/models/components/ocrimageobject.ts +0 -1
- package/packages/mistralai-azure/src/models/components/ocrlistblock.ts +60 -0
- package/packages/mistralai-azure/src/models/components/ocrpageconfidencescores.ts +8 -5
- package/packages/mistralai-azure/src/models/components/ocrpagedimensions.ts +0 -1
- package/packages/mistralai-azure/src/models/components/ocrpageobject.ts +117 -1
- package/packages/mistralai-azure/src/models/components/ocrreferencesblock.ts +62 -0
- package/packages/mistralai-azure/src/models/components/ocrrequest.ts +15 -2
- package/packages/mistralai-azure/src/models/components/ocrresponse.ts +0 -1
- package/packages/mistralai-azure/src/models/components/ocrsignatureblock.ts +65 -0
- package/packages/mistralai-azure/src/models/components/ocrtableblock.ts +66 -0
- package/packages/mistralai-azure/src/models/components/ocrtableobject.ts +0 -1
- package/packages/mistralai-azure/src/models/components/ocrtextblock.ts +60 -0
- package/packages/mistralai-azure/src/models/components/ocrtitleblock.ts +60 -0
- package/packages/mistralai-azure/src/models/components/ocrusageinfo.ts +0 -1
- package/packages/mistralai-azure/src/models/components/prediction.ts +0 -1
- package/packages/mistralai-azure/src/models/components/reasoningeffort.ts +5 -1
- package/packages/mistralai-azure/src/models/components/referencechunk.ts +0 -1
- package/packages/mistralai-azure/src/models/components/responseformat.ts +0 -1
- package/packages/mistralai-azure/src/models/components/responseformats.ts +0 -1
- package/packages/mistralai-azure/src/models/components/security.ts +0 -1
- package/packages/mistralai-azure/src/models/components/systemmessage.ts +0 -1
- package/packages/mistralai-azure/src/models/components/systemmessagecontentchunks.ts +0 -1
- package/packages/mistralai-azure/src/models/components/textchunk.ts +0 -1
- package/packages/mistralai-azure/src/models/components/thinkchunk.ts +0 -1
- package/packages/mistralai-azure/src/models/components/tool.ts +0 -1
- package/packages/mistralai-azure/src/models/components/toolcall.ts +3 -4
- package/packages/mistralai-azure/src/models/components/toolchoice.ts +2 -3
- package/packages/mistralai-azure/src/models/components/toolchoiceenum.ts +0 -1
- package/packages/mistralai-azure/src/models/components/toolconfiguration.ts +0 -1
- package/packages/mistralai-azure/src/models/components/toolmessage.ts +0 -1
- package/packages/mistralai-azure/src/models/components/toolreferencechunk.ts +0 -1
- package/packages/mistralai-azure/src/models/components/usageinfo.ts +0 -1
- package/packages/mistralai-azure/src/models/components/usermessage.ts +0 -1
- package/packages/mistralai-azure/src/models/components/validationerror.ts +0 -1
- package/packages/mistralai-azure/src/models/errors/httpclienterrors.ts +0 -1
- package/packages/mistralai-azure/src/models/errors/httpvalidationerror.ts +0 -1
- package/packages/mistralai-azure/src/models/errors/index.ts +0 -1
- package/packages/mistralai-azure/src/models/errors/mistralazureerror.ts +0 -1
- package/packages/mistralai-azure/src/models/errors/responsevalidationerror.ts +0 -1
- package/packages/mistralai-azure/src/models/errors/sdkerror.ts +0 -1
- package/packages/mistralai-azure/src/models/errors/sdkvalidationerror.ts +0 -1
- package/packages/mistralai-azure/src/sdk/chat.ts +0 -1
- package/packages/mistralai-azure/src/sdk/index.ts +0 -1
- package/packages/mistralai-azure/src/sdk/ocr.ts +0 -1
- package/packages/mistralai-azure/src/types/async.ts +0 -1
- package/packages/mistralai-azure/src/types/blobs.ts +0 -1
- package/packages/mistralai-azure/src/types/constdatetime.ts +0 -1
- package/packages/mistralai-azure/src/types/discriminatedUnion.ts +0 -1
- package/packages/mistralai-azure/src/types/enums.ts +0 -1
- package/packages/mistralai-azure/src/types/fp.ts +0 -1
- package/packages/mistralai-azure/src/types/index.ts +0 -1
- package/packages/mistralai-azure/src/types/operations.ts +0 -1
- package/packages/mistralai-azure/src/types/rfcdate.ts +0 -1
- package/packages/mistralai-azure/src/types/smartUnion.ts +0 -1
- package/packages/mistralai-azure/src/types/streams.ts +0 -1
- package/packages/mistralai-azure/src/types/unrecognized.ts +0 -1
- package/packages/mistralai-gcp/examples/chatComplete.example.ts +0 -1
- package/packages/mistralai-gcp/src/core.ts +0 -1
- package/packages/mistralai-gcp/src/funcs/chatComplete.ts +1 -2
- package/packages/mistralai-gcp/src/funcs/chatStream.ts +1 -2
- package/packages/mistralai-gcp/src/funcs/fimComplete.ts +1 -2
- package/packages/mistralai-gcp/src/funcs/fimStream.ts +1 -2
- package/packages/mistralai-gcp/src/hooks/hooks.ts +0 -1
- package/packages/mistralai-gcp/src/hooks/index.ts +0 -1
- package/packages/mistralai-gcp/src/hooks/types.ts +1 -1
- package/packages/mistralai-gcp/src/index.ts +0 -1
- package/packages/mistralai-gcp/src/lib/base64.ts +0 -1
- package/packages/mistralai-gcp/src/lib/config.ts +7 -8
- package/packages/mistralai-gcp/src/lib/encodings.ts +59 -25
- package/packages/mistralai-gcp/src/lib/event-streams.ts +46 -21
- package/packages/mistralai-gcp/src/lib/files.ts +0 -1
- package/packages/mistralai-gcp/src/lib/http.ts +3 -2
- package/packages/mistralai-gcp/src/lib/logger.ts +0 -1
- package/packages/mistralai-gcp/src/lib/matchers.ts +1 -2
- package/packages/mistralai-gcp/src/lib/primitives.ts +16 -1
- package/packages/mistralai-gcp/src/lib/retries.ts +8 -1
- package/packages/mistralai-gcp/src/lib/schemas.ts +0 -1
- package/packages/mistralai-gcp/src/lib/sdks.ts +54 -18
- package/packages/mistralai-gcp/src/lib/security.ts +10 -6
- package/packages/mistralai-gcp/src/lib/url.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/apikeyauth.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/assistantmessage.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/builtinconnectors.ts +1 -1
- package/packages/mistralai-gcp/src/models/components/chatcompletionchoice.ts +12 -1
- package/packages/mistralai-gcp/src/models/components/chatcompletionrequest.ts +28 -40
- package/packages/mistralai-gcp/src/models/components/chatcompletionresponse.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/chatcompletionresponsechoicelogprobs.ts +35 -0
- package/packages/mistralai-gcp/src/models/components/chatcompletionresponsetokenlogprobs.ts +42 -0
- package/packages/mistralai-gcp/src/models/components/chatcompletionresponsetokenlogprobstopk.ts +56 -0
- package/packages/mistralai-gcp/src/models/components/chatcompletionstreamrequest.ts +28 -40
- package/packages/mistralai-gcp/src/models/components/completionchunk.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/completionevent.ts +2 -2
- package/packages/mistralai-gcp/src/models/components/completionresponsestreamchoice.ts +12 -1
- package/packages/mistralai-gcp/src/models/components/contentchunk.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/customconnector.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/deltamessage.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/documentlibrarytool.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/fimcompletionrequest.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/fimcompletionresponse.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/fimcompletionstreamrequest.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/function.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/functioncall.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/functionname.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/guardrailconfig.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/imagedetail.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/imagegenerationtool.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/imageurl.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/imageurlchunk.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/index.ts +3 -4
- package/packages/mistralai-gcp/src/models/components/jsonschema.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/mistralpromptmode.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/moderationllmaction.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/moderationllmv1categorythresholds.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/moderationllmv1config.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/moderationllmv2categorythresholds.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/moderationllmv2config.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/oauth2tokenauth.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/prediction.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/reasoningeffort.ts +5 -1
- package/packages/mistralai-gcp/src/models/components/referencechunk.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/responseformat.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/responseformats.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/security.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/systemmessage.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/systemmessagecontentchunks.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/textchunk.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/thinkchunk.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/tool.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/toolcall.ts +3 -4
- package/packages/mistralai-gcp/src/models/components/toolchoice.ts +2 -3
- package/packages/mistralai-gcp/src/models/components/toolchoiceenum.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/toolconfiguration.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/toolmessage.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/toolreferencechunk.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/usageinfo.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/usermessage.ts +0 -1
- package/packages/mistralai-gcp/src/models/components/validationerror.ts +0 -1
- package/packages/mistralai-gcp/src/models/errors/httpclienterrors.ts +0 -1
- package/packages/mistralai-gcp/src/models/errors/httpvalidationerror.ts +0 -1
- package/packages/mistralai-gcp/src/models/errors/index.ts +0 -1
- package/packages/mistralai-gcp/src/models/errors/mistralgcperror.ts +0 -1
- package/packages/mistralai-gcp/src/models/errors/responsevalidationerror.ts +0 -1
- package/packages/mistralai-gcp/src/models/errors/sdkerror.ts +0 -1
- package/packages/mistralai-gcp/src/models/errors/sdkvalidationerror.ts +0 -1
- package/packages/mistralai-gcp/src/sdk/chat.ts +0 -1
- package/packages/mistralai-gcp/src/sdk/fim.ts +0 -1
- package/packages/mistralai-gcp/src/sdk/index.ts +0 -1
- package/packages/mistralai-gcp/src/types/async.ts +0 -1
- package/packages/mistralai-gcp/src/types/blobs.ts +0 -1
- package/packages/mistralai-gcp/src/types/constdatetime.ts +0 -1
- package/packages/mistralai-gcp/src/types/discriminatedUnion.ts +0 -1
- package/packages/mistralai-gcp/src/types/enums.ts +0 -1
- package/packages/mistralai-gcp/src/types/fp.ts +0 -1
- package/packages/mistralai-gcp/src/types/index.ts +0 -1
- package/packages/mistralai-gcp/src/types/operations.ts +0 -1
- package/packages/mistralai-gcp/src/types/rfcdate.ts +0 -1
- package/packages/mistralai-gcp/src/types/smartUnion.ts +0 -1
- package/packages/mistralai-gcp/src/types/streams.ts +0 -1
- package/packages/mistralai-gcp/src/types/unrecognized.ts +0 -1
- package/src/extra/realtime/connection.ts +88 -13
- package/src/extra/realtime/errors.ts +32 -0
- package/src/extra/realtime/index.ts +42 -1
- package/src/extra/realtime/speech.ts +646 -0
- package/src/extra/realtime/transcription.ts +22 -9
- package/src/extra/workflows/encoding/payload-encoder.ts +2 -1
- package/src/extra/workflows/encoding/python-json.ts +34 -8
- package/src/funcs/{betaRagManagedIndexesCreate.ts → betaContextSearchIndexesCreate.ts} +2 -2
- package/src/funcs/{betaRagManagedIndexesDelete.ts → betaContextSearchIndexesDelete.ts} +1 -1
- package/src/funcs/{betaRagManagedIndexesDeleteDocuments.ts → betaContextSearchIndexesDeleteDocuments.ts} +1 -1
- package/src/funcs/{betaRagManagedIndexesGenerateIndexSummary.ts → betaContextSearchIndexesGenerateIndexSummary.ts} +1 -1
- package/src/funcs/{betaRagManagedIndexesGet.ts → betaContextSearchIndexesGet.ts} +1 -1
- package/src/funcs/{betaRagManagedIndexesGetChunk.ts → betaContextSearchIndexesGetChunk.ts} +1 -1
- package/src/funcs/{betaRagManagedIndexesGetIndexSummary.ts → betaContextSearchIndexesGetIndexSummary.ts} +1 -1
- package/src/funcs/{betaRagManagedIndexesGrep.ts → betaContextSearchIndexesGrep.ts} +1 -1
- package/src/funcs/{betaRagManagedIndexesIngestDocuments.ts → betaContextSearchIndexesIngestDocuments.ts} +1 -1
- package/src/funcs/{betaRagManagedIndexesList.ts → betaContextSearchIndexesList.ts} +2 -2
- package/src/funcs/{betaRagManagedIndexesNavigate.ts → betaContextSearchIndexesNavigate.ts} +1 -1
- package/src/funcs/{betaRagManagedIndexesRead.ts → betaContextSearchIndexesRead.ts} +1 -1
- package/src/funcs/{betaRagManagedIndexesSearch.ts → betaContextSearchIndexesSearch.ts} +1 -1
- package/src/funcs/{betaRagManagedIndexesSetIndexSummary.ts → betaContextSearchIndexesSetIndexSummary.ts} +1 -1
- package/src/funcs/{betaRagManagedIndexesUpdate.ts → betaContextSearchIndexesUpdate.ts} +1 -1
- package/src/funcs/betaTriggersCreate.ts +168 -0
- package/src/funcs/betaTriggersDelete.ts +176 -0
- package/src/funcs/betaTriggersGet.ts +177 -0
- package/src/funcs/betaTriggersList.ts +178 -0
- package/src/funcs/betaTriggersListEvents.ts +182 -0
- package/src/funcs/betaWebhooksCreate.ts +168 -0
- package/src/funcs/betaWebhooksDelete.ts +176 -0
- package/src/funcs/betaWebhooksGet.ts +177 -0
- package/src/funcs/betaWebhooksGetSigningSecret.ts +182 -0
- package/src/funcs/betaWebhooksList.ts +142 -0
- package/src/funcs/workflowsAddWorkflowTags.ts +186 -0
- package/src/funcs/workflowsDeploymentsGetDeploymentArchive.ts +188 -0
- package/src/lib/config.ts +2 -2
- package/src/models/components/connectionpreference.ts +15 -5
- package/src/models/components/connectoropenapispec.ts +37 -0
- package/src/models/components/createtrigger.ts +69 -0
- package/src/models/components/createtriggeraction.ts +45 -0
- package/src/models/components/createwebhook.ts +121 -0
- package/src/models/components/deploymentarchiveresponse.ts +47 -0
- package/src/models/components/deploymentworkerspecinput.ts +20 -3
- package/src/models/components/deploymentworkerspecresponse.ts +12 -0
- package/src/models/components/getlog.ts +3 -0
- package/src/models/components/getspan.ts +3 -0
- package/src/models/components/getspanevaluation.ts +3 -0
- package/src/models/components/gettrace.ts +3 -0
- package/src/models/components/httpconnector.ts +10 -0
- package/src/models/components/index.ts +33 -5
- package/src/models/components/observabilityerrorcode.ts +2 -0
- package/src/models/components/openapifilesource.ts +35 -0
- package/src/models/components/openapispecsource.ts +42 -0
- package/src/models/components/openapiurlsource.ts +35 -0
- package/src/models/components/realtimespeecherror.ts +59 -0
- package/src/models/components/realtimespeecherrordetail.ts +100 -0
- package/src/models/components/realtimespeechinputtextappend.ts +55 -0
- package/src/models/components/realtimespeechinputtextend.ts +49 -0
- package/src/models/components/realtimespeechinputtextflush.ts +55 -0
- package/src/models/components/realtimespeechsession.ts +98 -0
- package/src/models/components/realtimespeechsessioncreated.ts +61 -0
- package/src/models/components/realtimespeechsessionupdated.ts +61 -0
- package/src/models/components/realtimespeechsessionupdatemessage.ts +62 -0
- package/src/models/components/realtimespeechsessionupdatepayload.ts +108 -0
- package/src/models/components/realtimespeechstreamingmode.ts +23 -0
- package/src/models/components/speechoutputformat.ts +5 -1
- package/src/models/components/speechstreamaudiodelta.ts +25 -0
- package/src/models/components/speechstreamdone.ts +28 -5
- package/src/models/components/systemv2.ts +4 -0
- package/src/models/components/trigger.ts +67 -0
- package/src/models/components/triggeraction.ts +39 -0
- package/src/models/components/triggeractiontype.ts +26 -0
- package/src/models/components/triggerevent.ts +62 -0
- package/src/models/components/triggereventlist.ts +31 -0
- package/src/models/components/triggerhandler.ts +21 -0
- package/src/models/components/triggersownertype.ts +24 -0
- package/src/models/components/triggerstatusvalue.ts +21 -0
- package/src/models/components/voicecreaterequest.ts +3 -5
- package/src/models/components/voiceupdaterequest.ts +3 -2
- package/src/models/components/webhook.ts +111 -0
- package/src/models/components/webhookprovider.ts +30 -0
- package/src/models/components/webhooksignatureencoding.ts +26 -0
- package/src/models/components/webhooksignaturehashalgorithm.ts +26 -0
- package/src/models/components/webhooksigningsecret.ts +38 -0
- package/src/models/components/workflowsworkerspecupdate.ts +14 -0
- package/src/models/components/workflowtagsaddrequest.ts +33 -0
- package/src/models/operations/addworkflowtagsv1workflowsworkflowidentifiertagspost.ts +44 -0
- package/src/models/operations/deletetriggerv1triggerstriggeriddelete.ts +39 -0
- package/src/models/operations/deletewebhookv1webhookswebhookiddelete.ts +39 -0
- package/src/models/operations/getdeploymentarchivev1workflowsdeploymentsnamearchiveget.ts +34 -0
- package/src/models/operations/gettriggerv1triggerstriggeridget.ts +38 -0
- package/src/models/operations/getwebhooksigningsecretv1webhookswebhookidsigningsecretget.ts +40 -0
- package/src/models/operations/getwebhookv1webhookswebhookidget.ts +38 -0
- package/src/models/operations/index.ts +9 -0
- package/src/models/operations/listtriggereventsv1triggerstriggerideventsget.ts +45 -0
- package/src/models/operations/listtriggersv1triggersget.ts +54 -0
- package/src/models/operations/skillslist.ts +3 -0
- package/src/sdk/beta.ts +18 -0
- package/src/sdk/context.ts +13 -0
- package/src/sdk/{managedindexes.ts → contextsearchindexes.ts} +31 -31
- package/src/sdk/deployments.ts +22 -0
- package/src/sdk/rag.ts +4 -10
- package/src/sdk/{searchindexes.ts → ragsearchindexes.ts} +1 -1
- package/src/sdk/triggers.ts +85 -0
- package/src/sdk/webhooks.ts +84 -0
- package/src/sdk/workflows.ts +16 -0
- package/tests/extra/realtime-speech-ws.test.ts +193 -0
- package/tests/extra/realtime-speech.test.ts +532 -0
- package/tests/extra/realtime.test.ts +217 -0
- package/tests/extra/workflow-encryption.test.ts +2 -2
- package/tests/hooks/workflow-encoding.test.ts +1 -1
- package/esm/funcs/betaRagManagedIndexesCreate.d.ts.map +0 -1
- package/esm/funcs/betaRagManagedIndexesCreate.js.map +0 -1
- package/esm/funcs/betaRagManagedIndexesDelete.js.map +0 -1
- package/esm/funcs/betaRagManagedIndexesDeleteDocuments.d.ts.map +0 -1
- package/esm/funcs/betaRagManagedIndexesDeleteDocuments.js.map +0 -1
- package/esm/funcs/betaRagManagedIndexesGenerateIndexSummary.d.ts.map +0 -1
- package/esm/funcs/betaRagManagedIndexesGenerateIndexSummary.js.map +0 -1
- package/esm/funcs/betaRagManagedIndexesGet.d.ts.map +0 -1
- package/esm/funcs/betaRagManagedIndexesGet.js.map +0 -1
- package/esm/funcs/betaRagManagedIndexesGetChunk.d.ts.map +0 -1
- package/esm/funcs/betaRagManagedIndexesGetChunk.js.map +0 -1
- package/esm/funcs/betaRagManagedIndexesGetIndexSummary.d.ts.map +0 -1
- package/esm/funcs/betaRagManagedIndexesGetIndexSummary.js.map +0 -1
- package/esm/funcs/betaRagManagedIndexesGrep.d.ts.map +0 -1
- package/esm/funcs/betaRagManagedIndexesGrep.js.map +0 -1
- package/esm/funcs/betaRagManagedIndexesIngestDocuments.d.ts.map +0 -1
- package/esm/funcs/betaRagManagedIndexesIngestDocuments.js.map +0 -1
- package/esm/funcs/betaRagManagedIndexesList.d.ts.map +0 -1
- package/esm/funcs/betaRagManagedIndexesList.js.map +0 -1
- package/esm/funcs/betaRagManagedIndexesNavigate.d.ts.map +0 -1
- package/esm/funcs/betaRagManagedIndexesNavigate.js.map +0 -1
- package/esm/funcs/betaRagManagedIndexesRead.d.ts.map +0 -1
- package/esm/funcs/betaRagManagedIndexesRead.js.map +0 -1
- package/esm/funcs/betaRagManagedIndexesSearch.d.ts.map +0 -1
- package/esm/funcs/betaRagManagedIndexesSearch.js.map +0 -1
- package/esm/funcs/betaRagManagedIndexesSetIndexSummary.d.ts.map +0 -1
- package/esm/funcs/betaRagManagedIndexesSetIndexSummary.js.map +0 -1
- package/esm/funcs/betaRagManagedIndexesUpdate.d.ts.map +0 -1
- package/esm/funcs/betaRagManagedIndexesUpdate.js.map +0 -1
- package/esm/models/components/completiontokensdetails.d.ts +0 -19
- package/esm/models/components/completiontokensdetails.d.ts.map +0 -1
- package/esm/models/components/completiontokensdetails.js +0 -18
- package/esm/models/components/completiontokensdetails.js.map +0 -1
- package/esm/models/components/messagetokens.d.ts +0 -18
- package/esm/models/components/messagetokens.d.ts.map +0 -1
- package/esm/models/components/messagetokens.js +0 -26
- package/esm/models/components/messagetokens.js.map +0 -1
- package/esm/models/components/prompttokensdetails.d.ts +0 -16
- package/esm/models/components/prompttokensdetails.d.ts.map +0 -1
- package/esm/models/components/prompttokensdetails.js +0 -22
- package/esm/models/components/prompttokensdetails.js.map +0 -1
- package/esm/models/components/roles.d.ts +0 -12
- package/esm/models/components/roles.d.ts.map +0 -1
- package/esm/models/components/roles.js +0 -14
- package/esm/models/components/roles.js.map +0 -1
- package/esm/models/components/usageinfodollardefs.d.ts +0 -24
- package/esm/models/components/usageinfodollardefs.d.ts.map +0 -1
- package/esm/models/components/usageinfodollardefs.js +0 -41
- package/esm/models/components/usageinfodollardefs.js.map +0 -1
- package/esm/sdk/managedindexes.d.ts.map +0 -1
- package/esm/sdk/managedindexes.js.map +0 -1
- package/esm/sdk/searchindexes.d.ts.map +0 -1
- package/esm/sdk/searchindexes.js.map +0 -1
- package/packages/mistralai-azure/src/lib/dlv.ts +0 -54
- package/packages/mistralai-azure/src/lib/is-plain-object.ts +0 -44
- package/packages/mistralai-azure/src/models/components/codeinterpretertool.ts +0 -44
- package/packages/mistralai-azure/src/models/components/websearchpremiumtool.ts +0 -44
- package/packages/mistralai-azure/src/models/components/websearchtool.ts +0 -40
- package/packages/mistralai-gcp/src/lib/dlv.ts +0 -54
- package/packages/mistralai-gcp/src/lib/is-plain-object.ts +0 -44
- package/packages/mistralai-gcp/src/models/components/codeinterpretertool.ts +0 -44
- package/packages/mistralai-gcp/src/models/components/websearchpremiumtool.ts +0 -44
- package/packages/mistralai-gcp/src/models/components/websearchtool.ts +0 -40
- package/src/models/components/completiontokensdetails.ts +0 -44
- package/src/models/components/messagetokens.ts +0 -47
- package/src/models/components/prompttokensdetails.ts +0 -44
- package/src/models/components/roles.ts +0 -19
- package/src/models/components/usageinfodollardefs.ts +0 -76
|
@@ -0,0 +1,646 @@
|
|
|
1
|
+
import { Buffer } from "node:buffer";
|
|
2
|
+
import WebSocket from "ws";
|
|
3
|
+
import { SDK_METADATA } from "../../lib/config.js";
|
|
4
|
+
import { ClientSDK } from "../../lib/sdks.js";
|
|
5
|
+
import { extractSecurity, resolveGlobalSecurity } from "../../lib/security.js";
|
|
6
|
+
import { bearerHeader, readServiceAccountToken } from "../../hooks/service_account_auth.js";
|
|
7
|
+
import {
|
|
8
|
+
RealtimeSpeechError$inboundSchema,
|
|
9
|
+
type RealtimeSpeechError,
|
|
10
|
+
} from "../../models/components/realtimespeecherror.js";
|
|
11
|
+
import type { RealtimeSpeechSession } from "../../models/components/realtimespeechsession.js";
|
|
12
|
+
import {
|
|
13
|
+
RealtimeSpeechSessionCreated$inboundSchema,
|
|
14
|
+
type RealtimeSpeechSessionCreated,
|
|
15
|
+
} from "../../models/components/realtimespeechsessioncreated.js";
|
|
16
|
+
import {
|
|
17
|
+
RealtimeSpeechSessionUpdated$inboundSchema,
|
|
18
|
+
type RealtimeSpeechSessionUpdated,
|
|
19
|
+
} from "../../models/components/realtimespeechsessionupdated.js";
|
|
20
|
+
import {
|
|
21
|
+
RealtimeSpeechSessionUpdatePayload$outboundSchema,
|
|
22
|
+
} from "../../models/components/realtimespeechsessionupdatepayload.js";
|
|
23
|
+
import type { RealtimeSpeechStreamingMode } from "../../models/components/realtimespeechstreamingmode.js";
|
|
24
|
+
import type { SpeechOutputFormat } from "../../models/components/speechoutputformat.js";
|
|
25
|
+
import {
|
|
26
|
+
SpeechStreamAudioDelta$inboundSchema,
|
|
27
|
+
type SpeechStreamAudioDelta,
|
|
28
|
+
} from "../../models/components/speechstreamaudiodelta.js";
|
|
29
|
+
import {
|
|
30
|
+
SpeechStreamDone$inboundSchema,
|
|
31
|
+
type SpeechStreamDone,
|
|
32
|
+
} from "../../models/components/speechstreamdone.js";
|
|
33
|
+
import type { UnknownRealtimeEvent } from "./connection.js";
|
|
34
|
+
import { RealtimeSpeechException, RealtimeSpeechWSError } from "./errors.js";
|
|
35
|
+
|
|
36
|
+
const WS_OPEN = 1;
|
|
37
|
+
const WS_CLOSING = 2;
|
|
38
|
+
const WS_CLOSED = 3;
|
|
39
|
+
const OK_CLOSE_CODES = new Set([1000, 1001, 1005]);
|
|
40
|
+
|
|
41
|
+
export type KnownRealtimeSpeechEvent =
|
|
42
|
+
| RealtimeSpeechSessionCreated
|
|
43
|
+
| RealtimeSpeechSessionUpdated
|
|
44
|
+
| RealtimeSpeechError
|
|
45
|
+
| SpeechStreamAudioDelta
|
|
46
|
+
| SpeechStreamDone;
|
|
47
|
+
|
|
48
|
+
export type RealtimeSpeechEvent = KnownRealtimeSpeechEvent | UnknownRealtimeEvent;
|
|
49
|
+
|
|
50
|
+
type QueueItem =
|
|
51
|
+
| { kind: "message"; data: unknown }
|
|
52
|
+
| { kind: "close"; code?: number | undefined; reason?: string | undefined }
|
|
53
|
+
| { kind: "error"; error: Error };
|
|
54
|
+
|
|
55
|
+
export type RealtimeSpeechSessionOptions = {
|
|
56
|
+
voiceId?: string | undefined;
|
|
57
|
+
refAudio?: string | undefined;
|
|
58
|
+
responseFormat?: SpeechOutputFormat | undefined;
|
|
59
|
+
streamingMode?: RealtimeSpeechStreamingMode | undefined;
|
|
60
|
+
expressiveness?: number | undefined;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export type RealtimeSpeechConnectOptions = Readonly<
|
|
64
|
+
RealtimeSpeechSessionOptions & {
|
|
65
|
+
serverUrl?: string | undefined;
|
|
66
|
+
timeoutMs?: number | undefined;
|
|
67
|
+
httpHeaders?: Record<string, string> | undefined;
|
|
68
|
+
}
|
|
69
|
+
>;
|
|
70
|
+
|
|
71
|
+
const EVENT_SCHEMAS: Record<
|
|
72
|
+
string,
|
|
73
|
+
{
|
|
74
|
+
safeParse: (
|
|
75
|
+
value: unknown,
|
|
76
|
+
) => { success: true; data: KnownRealtimeSpeechEvent } | { success: false; error: Error };
|
|
77
|
+
}
|
|
78
|
+
> = {
|
|
79
|
+
"session.created": RealtimeSpeechSessionCreated$inboundSchema,
|
|
80
|
+
"session.updated": RealtimeSpeechSessionUpdated$inboundSchema,
|
|
81
|
+
"error": RealtimeSpeechError$inboundSchema,
|
|
82
|
+
"speech.audio.delta": SpeechStreamAudioDelta$inboundSchema,
|
|
83
|
+
"speech.audio.done": SpeechStreamDone$inboundSchema,
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/** @internal */
|
|
87
|
+
export function isUnknownRealtimeSpeechEvent(
|
|
88
|
+
event: RealtimeSpeechEvent,
|
|
89
|
+
): event is UnknownRealtimeEvent {
|
|
90
|
+
return "raw" in event;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** @internal */
|
|
94
|
+
export function parseRealtimeSpeechEvent(payload: unknown): RealtimeSpeechEvent {
|
|
95
|
+
if (typeof payload !== "object" || payload === null || Array.isArray(payload)) {
|
|
96
|
+
return unknownEvent("unknown", payload, new Error("Expected a JSON object."));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const msgType = (payload as Record<string, unknown>)["type"];
|
|
100
|
+
if (typeof msgType !== "string") {
|
|
101
|
+
return unknownEvent("unknown", payload, new Error("Missing `type`."));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const schema = Object.hasOwn(EVENT_SCHEMAS, msgType) ? EVENT_SCHEMAS[msgType] : undefined;
|
|
105
|
+
if (!schema) {
|
|
106
|
+
return unknownEvent(msgType, payload);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const result = schema.safeParse(payload);
|
|
110
|
+
if (result.success) {
|
|
111
|
+
return result.data;
|
|
112
|
+
}
|
|
113
|
+
return unknownEvent(
|
|
114
|
+
msgType,
|
|
115
|
+
payload,
|
|
116
|
+
new Error(`Invalid websocket message payload for ${msgType}.`, { cause: result.error }),
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export function audioBytes(event: SpeechStreamAudioDelta): Uint8Array {
|
|
121
|
+
return new Uint8Array(Buffer.from(event.audioData, "base64"));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export class RealtimeSpeechConnection implements AsyncIterable<RealtimeSpeechEvent> {
|
|
125
|
+
private readonly websocket: WebSocket;
|
|
126
|
+
private closed = false;
|
|
127
|
+
private closedByClient = false;
|
|
128
|
+
private currentSession: RealtimeSpeechSession;
|
|
129
|
+
private initialEvents: RealtimeSpeechEvent[];
|
|
130
|
+
private readonly queue: QueueItem[] = [];
|
|
131
|
+
private resolver: ((item: QueueItem) => void) | null = null;
|
|
132
|
+
private iterating = false;
|
|
133
|
+
|
|
134
|
+
constructor(
|
|
135
|
+
websocket: WebSocket,
|
|
136
|
+
session: RealtimeSpeechSession,
|
|
137
|
+
initialEvents: RealtimeSpeechEvent[] = [],
|
|
138
|
+
) {
|
|
139
|
+
this.websocket = websocket;
|
|
140
|
+
this.currentSession = session;
|
|
141
|
+
this.initialEvents = [...initialEvents];
|
|
142
|
+
websocket.addEventListener("message", this.handleMessage);
|
|
143
|
+
websocket.addEventListener("close", this.handleClose);
|
|
144
|
+
websocket.addEventListener("error", this.handleError);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
get requestId(): string {
|
|
148
|
+
return this.currentSession.requestId;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
get session(): RealtimeSpeechSession {
|
|
152
|
+
return this.currentSession;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
get isClosed(): boolean {
|
|
156
|
+
return (
|
|
157
|
+
this.closed
|
|
158
|
+
|| this.websocket.readyState === WS_CLOSING
|
|
159
|
+
|| this.websocket.readyState === WS_CLOSED
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
[Symbol.asyncIterator](): AsyncIterator<RealtimeSpeechEvent> {
|
|
164
|
+
return this.events();
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
async *events(): AsyncGenerator<RealtimeSpeechEvent> {
|
|
168
|
+
if (this.iterating) {
|
|
169
|
+
throw new Error("Connection events are already being iterated");
|
|
170
|
+
}
|
|
171
|
+
this.iterating = true;
|
|
172
|
+
try {
|
|
173
|
+
yield* this.readEvents();
|
|
174
|
+
} finally {
|
|
175
|
+
this.iterating = false;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
private async *readEvents(): AsyncGenerator<RealtimeSpeechEvent> {
|
|
180
|
+
const queued = this.initialEvents;
|
|
181
|
+
this.initialEvents = [];
|
|
182
|
+
for (const event of queued) {
|
|
183
|
+
this.applySessionEvent(event);
|
|
184
|
+
yield event;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
try {
|
|
188
|
+
while (true) {
|
|
189
|
+
if (this.queue.length === 0 && this.websocket.readyState === WS_CLOSED) {
|
|
190
|
+
break;
|
|
191
|
+
}
|
|
192
|
+
const item = this.queue.length > 0
|
|
193
|
+
? this.queue.shift()!
|
|
194
|
+
: await new Promise<QueueItem>((resolve) => {
|
|
195
|
+
this.resolver = resolve;
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
if (item.kind === "close") {
|
|
199
|
+
// Unknown voices etc. are rejected with a close frame, not an error event.
|
|
200
|
+
if (item.code !== undefined && !OK_CLOSE_CODES.has(item.code)) {
|
|
201
|
+
throw new RealtimeSpeechException(
|
|
202
|
+
item.reason || "Connection closed by the server",
|
|
203
|
+
{ code: item.code },
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (item.kind === "error") {
|
|
210
|
+
yield unknownEvent("unknown", item.error, item.error);
|
|
211
|
+
continue;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
const event = parseRealtimeSpeechEventFromData(item.data);
|
|
215
|
+
this.applySessionEvent(event);
|
|
216
|
+
yield event;
|
|
217
|
+
}
|
|
218
|
+
} finally {
|
|
219
|
+
this.resolver = null;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
async sendText(text: string): Promise<void> {
|
|
224
|
+
if (this.isClosed) {
|
|
225
|
+
throw new Error("Connection is closed");
|
|
226
|
+
}
|
|
227
|
+
await this.sendJson({ type: "input_text.append", text });
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
async flush(text?: string): Promise<void> {
|
|
231
|
+
if (this.isClosed) {
|
|
232
|
+
throw new Error("Connection is closed");
|
|
233
|
+
}
|
|
234
|
+
await this.sendJson(
|
|
235
|
+
text === undefined ? { type: "input_text.flush" } : { type: "input_text.flush", text },
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
async end(): Promise<void> {
|
|
240
|
+
if (this.isClosed) {
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
await this.sendJson({ type: "input_text.end" });
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
async updateSession(options: RealtimeSpeechSessionOptions): Promise<void> {
|
|
247
|
+
if (this.isClosed) {
|
|
248
|
+
throw new Error("Connection is closed");
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
const fields = {
|
|
252
|
+
voice: options.voiceId,
|
|
253
|
+
refAudio: options.refAudio,
|
|
254
|
+
responseFormat: options.responseFormat,
|
|
255
|
+
streamingMode: options.streamingMode,
|
|
256
|
+
expressiveness: options.expressiveness,
|
|
257
|
+
};
|
|
258
|
+
if (Object.values(fields).every((value) => value == null)) {
|
|
259
|
+
throw new Error("At least one session field must be provided");
|
|
260
|
+
}
|
|
261
|
+
const session = RealtimeSpeechSessionUpdatePayload$outboundSchema.parse(fields);
|
|
262
|
+
|
|
263
|
+
await this.sendJson({ type: "session.update", session });
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
async close(code: number = 1000, reason: string = ""): Promise<void> {
|
|
267
|
+
if (!this.closed) {
|
|
268
|
+
this.closed = true;
|
|
269
|
+
this.closedByClient = this.websocket.readyState === WS_OPEN;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
if (this.websocket.readyState === WS_CLOSED) {
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
await new Promise<void>((resolve) => {
|
|
277
|
+
const finalize = () => {
|
|
278
|
+
this.websocket.removeEventListener("close", finalize);
|
|
279
|
+
resolve();
|
|
280
|
+
};
|
|
281
|
+
this.websocket.addEventListener("close", finalize);
|
|
282
|
+
if (this.websocket.readyState !== WS_CLOSING) {
|
|
283
|
+
this.websocket.close(code, reason);
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
private async sendJson(payload: unknown): Promise<void> {
|
|
289
|
+
const message = JSON.stringify(payload);
|
|
290
|
+
await new Promise<void>((resolve, reject) => {
|
|
291
|
+
this.websocket.send(message, (err: Error | undefined) => {
|
|
292
|
+
if (err) {
|
|
293
|
+
reject(err);
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
resolve();
|
|
297
|
+
});
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
private readonly handleMessage = (event: WebSocket.MessageEvent): void => {
|
|
302
|
+
this.push({ kind: "message", data: event.data });
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
private readonly handleClose = (event: WebSocket.CloseEvent): void => {
|
|
306
|
+
this.closed = true;
|
|
307
|
+
this.websocket.removeEventListener("message", this.handleMessage);
|
|
308
|
+
this.websocket.removeEventListener("close", this.handleClose);
|
|
309
|
+
this.websocket.removeEventListener("error", this.handleError);
|
|
310
|
+
this.push(
|
|
311
|
+
this.closedByClient
|
|
312
|
+
? { kind: "close" }
|
|
313
|
+
: { kind: "close", code: event.code, reason: event.reason },
|
|
314
|
+
);
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
private readonly handleError = (event: unknown): void => {
|
|
318
|
+
this.push({ kind: "error", error: normalizeWsError(event) });
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
private push(item: QueueItem): void {
|
|
322
|
+
if (this.resolver) {
|
|
323
|
+
const resolve = this.resolver;
|
|
324
|
+
this.resolver = null;
|
|
325
|
+
resolve(item);
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
this.queue.push(item);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
private applySessionEvent(event: RealtimeSpeechEvent): void {
|
|
332
|
+
if (!isUnknownRealtimeSpeechEvent(event) && "session" in event) {
|
|
333
|
+
this.currentSession = event.session;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
export class RealtimeSpeech extends ClientSDK {
|
|
339
|
+
async connect(
|
|
340
|
+
model: string,
|
|
341
|
+
options: RealtimeSpeechConnectOptions = {},
|
|
342
|
+
): Promise<RealtimeSpeechConnection> {
|
|
343
|
+
const securityInput = await extractSecurity(this._options.apiKey);
|
|
344
|
+
const resolvedSecurity = resolveGlobalSecurity(
|
|
345
|
+
securityInput == null ? {} : { apiKey: securityInput },
|
|
346
|
+
);
|
|
347
|
+
|
|
348
|
+
const headers: Record<string, string> = {};
|
|
349
|
+
|
|
350
|
+
headers["User-Agent"] = this._options.userAgent ?? SDK_METADATA.userAgent;
|
|
351
|
+
|
|
352
|
+
if (resolvedSecurity?.headers) {
|
|
353
|
+
Object.assign(headers, resolvedSecurity.headers);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
// The handshake never runs the SDK's before-request hooks, so apply service-account auth here.
|
|
357
|
+
const callerAuthorization = Object.keys(options.httpHeaders ?? {}).some(
|
|
358
|
+
(name) => name.toLowerCase() === "authorization",
|
|
359
|
+
);
|
|
360
|
+
if (this._options.apiKey == null && !callerAuthorization) {
|
|
361
|
+
const token = await readServiceAccountToken();
|
|
362
|
+
if (token !== null) {
|
|
363
|
+
headers["Authorization"] = bearerHeader(token);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
if (options.httpHeaders) {
|
|
368
|
+
Object.assign(headers, options.httpHeaders);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
const url = this.getWsUrl(model, {
|
|
372
|
+
serverUrl: options.serverUrl,
|
|
373
|
+
queryParams: resolvedSecurity?.queryParams ?? {},
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
let websocket: WebSocket | undefined;
|
|
377
|
+
try {
|
|
378
|
+
websocket = new WebSocket(url, { headers });
|
|
379
|
+
const { session, initialEvents } = await recvSession(
|
|
380
|
+
websocket,
|
|
381
|
+
options.timeoutMs ?? this._options.timeoutMs,
|
|
382
|
+
);
|
|
383
|
+
const connection = new RealtimeSpeechConnection(websocket, session, initialEvents);
|
|
384
|
+
|
|
385
|
+
const sessionOptions: RealtimeSpeechSessionOptions = {
|
|
386
|
+
voiceId: options.voiceId,
|
|
387
|
+
refAudio: options.refAudio,
|
|
388
|
+
responseFormat: options.responseFormat,
|
|
389
|
+
streamingMode: options.streamingMode,
|
|
390
|
+
expressiveness: options.expressiveness,
|
|
391
|
+
};
|
|
392
|
+
if (Object.values(sessionOptions).some((value) => value != null)) {
|
|
393
|
+
await connection.updateSession(sessionOptions);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
return connection;
|
|
397
|
+
} catch (err) {
|
|
398
|
+
if (err instanceof RealtimeSpeechException) {
|
|
399
|
+
throw err;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
if (websocket) {
|
|
403
|
+
closeQuietly(websocket);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
throw new RealtimeSpeechException(
|
|
407
|
+
`Failed to connect to speech service: ${String(err)}`,
|
|
408
|
+
{ cause: err },
|
|
409
|
+
);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
async *speakStream(
|
|
414
|
+
textStream: AsyncIterable<string>,
|
|
415
|
+
model: string,
|
|
416
|
+
options: RealtimeSpeechConnectOptions = {},
|
|
417
|
+
): AsyncIterable<RealtimeSpeechEvent> {
|
|
418
|
+
const connection = await this.connect(model, options);
|
|
419
|
+
|
|
420
|
+
let stopRequested = false;
|
|
421
|
+
let sendError: unknown;
|
|
422
|
+
const textIterator = textStream[Symbol.asyncIterator]();
|
|
423
|
+
void (async () => {
|
|
424
|
+
try {
|
|
425
|
+
while (true) {
|
|
426
|
+
const next = await textIterator.next();
|
|
427
|
+
if (next.done || stopRequested || connection.isClosed) {
|
|
428
|
+
break;
|
|
429
|
+
}
|
|
430
|
+
await connection.sendText(next.value);
|
|
431
|
+
}
|
|
432
|
+
if (!stopRequested) {
|
|
433
|
+
await connection.end();
|
|
434
|
+
}
|
|
435
|
+
} catch (err) {
|
|
436
|
+
if (!stopRequested && !connection.isClosed) {
|
|
437
|
+
sendError = err;
|
|
438
|
+
}
|
|
439
|
+
await connection.close();
|
|
440
|
+
}
|
|
441
|
+
})();
|
|
442
|
+
|
|
443
|
+
try {
|
|
444
|
+
for await (const event of connection) {
|
|
445
|
+
yield event;
|
|
446
|
+
|
|
447
|
+
if (event.type === "speech.audio.done" || event.type === "error") {
|
|
448
|
+
break;
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
} finally {
|
|
452
|
+
stopRequested = true;
|
|
453
|
+
await connection.close();
|
|
454
|
+
void textIterator.return?.()?.catch(() => undefined);
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
if (sendError !== undefined) {
|
|
458
|
+
throw sendError;
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
private getWsUrl(
|
|
463
|
+
model: string,
|
|
464
|
+
options: { serverUrl?: string | undefined; queryParams: Record<string, string> },
|
|
465
|
+
): string {
|
|
466
|
+
const baseUrl = options.serverUrl ?? this._baseURL?.toString();
|
|
467
|
+
if (!baseUrl) {
|
|
468
|
+
throw new RealtimeSpeechException("No server URL configured.");
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
const base = normalizeBaseUrl(baseUrl);
|
|
472
|
+
const wsUrl = new URL("v1/audio/speech/realtime", base);
|
|
473
|
+
|
|
474
|
+
const params = new URLSearchParams(base.search);
|
|
475
|
+
params.set("model", model);
|
|
476
|
+
for (const [key, value] of Object.entries(options.queryParams)) {
|
|
477
|
+
if (value) {
|
|
478
|
+
params.set(key, value);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
wsUrl.search = params.toString();
|
|
482
|
+
|
|
483
|
+
return wsUrl.toString();
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
async function recvSession(
|
|
488
|
+
websocket: WebSocket,
|
|
489
|
+
timeoutMs?: number,
|
|
490
|
+
): Promise<{ session: RealtimeSpeechSession; initialEvents: RealtimeSpeechEvent[] }> {
|
|
491
|
+
let timeoutId: ReturnType<typeof setTimeout> | undefined;
|
|
492
|
+
const initialEvents: RealtimeSpeechEvent[] = [];
|
|
493
|
+
|
|
494
|
+
return new Promise((resolve, reject) => {
|
|
495
|
+
const cleanup = () => {
|
|
496
|
+
websocket.removeEventListener("message", handleMessage);
|
|
497
|
+
websocket.removeEventListener("close", handleClose);
|
|
498
|
+
websocket.removeEventListener("error", handleError);
|
|
499
|
+
if (timeoutId) {
|
|
500
|
+
clearTimeout(timeoutId);
|
|
501
|
+
}
|
|
502
|
+
};
|
|
503
|
+
|
|
504
|
+
const fail = (error: Error) => {
|
|
505
|
+
cleanup();
|
|
506
|
+
closeQuietly(websocket);
|
|
507
|
+
reject(error);
|
|
508
|
+
};
|
|
509
|
+
|
|
510
|
+
const handleMessage = (event: WebSocket.MessageEvent) => {
|
|
511
|
+
const parsed = parseRealtimeSpeechEventFromData(event.data);
|
|
512
|
+
initialEvents.push(parsed);
|
|
513
|
+
|
|
514
|
+
if (parsed.type === "error") {
|
|
515
|
+
if (isUnknownRealtimeSpeechEvent(parsed)) {
|
|
516
|
+
fail(new RealtimeSpeechWSError(
|
|
517
|
+
parsed.error?.message ?? "Realtime speech error during handshake.",
|
|
518
|
+
{ rawPayload: parsed.raw, cause: parsed.error },
|
|
519
|
+
));
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
const payload = parsed as RealtimeSpeechError;
|
|
524
|
+
const errorMessage = typeof payload.error.message === "string"
|
|
525
|
+
? payload.error.message
|
|
526
|
+
: JSON.stringify(payload.error.message);
|
|
527
|
+
fail(new RealtimeSpeechWSError(errorMessage, { payload, code: payload.error.code }));
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
if (
|
|
532
|
+
!isUnknownRealtimeSpeechEvent(parsed)
|
|
533
|
+
&& parsed.type === "session.created"
|
|
534
|
+
&& "session" in parsed
|
|
535
|
+
) {
|
|
536
|
+
cleanup();
|
|
537
|
+
resolve({ session: parsed.session, initialEvents });
|
|
538
|
+
}
|
|
539
|
+
};
|
|
540
|
+
|
|
541
|
+
const handleClose = (event: WebSocket.CloseEvent) => {
|
|
542
|
+
fail(new RealtimeSpeechException(
|
|
543
|
+
event.reason || "Unexpected websocket handshake close.",
|
|
544
|
+
{ code: event.code },
|
|
545
|
+
));
|
|
546
|
+
};
|
|
547
|
+
|
|
548
|
+
const handleError = (event: unknown) => {
|
|
549
|
+
const cause = normalizeWsError(event);
|
|
550
|
+
fail(new RealtimeSpeechException(
|
|
551
|
+
`Failed to connect to speech service: ${cause.message}`,
|
|
552
|
+
{ cause },
|
|
553
|
+
));
|
|
554
|
+
};
|
|
555
|
+
|
|
556
|
+
websocket.addEventListener("message", handleMessage);
|
|
557
|
+
websocket.addEventListener("close", handleClose);
|
|
558
|
+
websocket.addEventListener("error", handleError);
|
|
559
|
+
|
|
560
|
+
if (timeoutMs && timeoutMs > 0) {
|
|
561
|
+
timeoutId = setTimeout(() => {
|
|
562
|
+
fail(new RealtimeSpeechException("Timeout waiting for session creation."));
|
|
563
|
+
}, timeoutMs);
|
|
564
|
+
}
|
|
565
|
+
});
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
function parseRealtimeSpeechEventFromData(data: unknown): RealtimeSpeechEvent {
|
|
569
|
+
let text: string;
|
|
570
|
+
try {
|
|
571
|
+
text = messageDataToString(data);
|
|
572
|
+
} catch (err) {
|
|
573
|
+
return unknownEvent("unknown", data, toError(err, "Failed to read websocket message"));
|
|
574
|
+
}
|
|
575
|
+
let payload: unknown;
|
|
576
|
+
try {
|
|
577
|
+
payload = JSON.parse(text);
|
|
578
|
+
} catch (err) {
|
|
579
|
+
return unknownEvent("unknown", text, toError(err, "Failed to parse websocket JSON"));
|
|
580
|
+
}
|
|
581
|
+
return parseRealtimeSpeechEvent(payload);
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
function unknownEvent(type: string, raw: unknown, error?: Error): UnknownRealtimeEvent {
|
|
585
|
+
return { type, raw, error };
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
function toError(err: unknown, message: string): Error {
|
|
589
|
+
return err instanceof Error ? err : new Error(message, { cause: err });
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
function normalizeWsError(event: unknown): Error {
|
|
593
|
+
if (event instanceof Error) {
|
|
594
|
+
return event;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
if (
|
|
598
|
+
typeof event === "object"
|
|
599
|
+
&& event !== null
|
|
600
|
+
&& "error" in event
|
|
601
|
+
&& (event as { error?: unknown }).error instanceof Error
|
|
602
|
+
) {
|
|
603
|
+
return (event as { error: Error }).error;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
return new Error("WebSocket connection error");
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
function messageDataToString(data: unknown): string {
|
|
610
|
+
if (typeof data === "string") {
|
|
611
|
+
return data;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
if (Buffer.isBuffer(data)) {
|
|
615
|
+
return data.toString("utf8");
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
if (Array.isArray(data) && data.every((item) => Buffer.isBuffer(item))) {
|
|
619
|
+
return Buffer.concat(data).toString("utf8");
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
if (data instanceof ArrayBuffer) {
|
|
623
|
+
return Buffer.from(data).toString("utf8");
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
if (ArrayBuffer.isView(data)) {
|
|
627
|
+
return Buffer.from(data.buffer, data.byteOffset, data.byteLength).toString("utf8");
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
throw new Error("Unsupported websocket message format");
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
function closeQuietly(websocket: WebSocket): void {
|
|
634
|
+
websocket.addEventListener("error", () => undefined);
|
|
635
|
+
try {
|
|
636
|
+
websocket.close();
|
|
637
|
+
} catch (closeError) {
|
|
638
|
+
void closeError;
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
function normalizeBaseUrl(baseUrl: string): URL {
|
|
643
|
+
const url = new URL(baseUrl);
|
|
644
|
+
url.pathname = url.pathname.replace(/\/+$/, "") + "/";
|
|
645
|
+
return url;
|
|
646
|
+
}
|
|
@@ -8,7 +8,7 @@ import type {
|
|
|
8
8
|
RealtimeTranscriptionError,
|
|
9
9
|
} from "../../models/components/realtimetranscriptionerror.js";
|
|
10
10
|
import type { RealtimeTranscriptionSession } from "../../models/components/realtimetranscriptionsession.js";
|
|
11
|
-
import type { RealtimeEvent } from "./connection.js";
|
|
11
|
+
import type { RealtimeEvent, RealtimeSessionOptions } from "./connection.js";
|
|
12
12
|
import {
|
|
13
13
|
RealtimeConnection,
|
|
14
14
|
isUnknownRealtimeEvent,
|
|
@@ -19,12 +19,14 @@ import {
|
|
|
19
19
|
RealtimeTranscriptionWSError,
|
|
20
20
|
} from "./errors.js";
|
|
21
21
|
|
|
22
|
-
export type RealtimeConnectOptions = Readonly<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
export type RealtimeConnectOptions = Readonly<
|
|
23
|
+
RealtimeSessionOptions & {
|
|
24
|
+
audioFormat?: AudioFormat | undefined;
|
|
25
|
+
serverUrl?: string | undefined;
|
|
26
|
+
timeoutMs?: number | undefined;
|
|
27
|
+
httpHeaders?: Record<string, string> | undefined;
|
|
28
|
+
}
|
|
29
|
+
>;
|
|
28
30
|
|
|
29
31
|
/** Client for realtime transcription over WebSocket. */
|
|
30
32
|
export class RealtimeTranscription extends ClientSDK {
|
|
@@ -75,8 +77,19 @@ export class RealtimeTranscription extends ClientSDK {
|
|
|
75
77
|
);
|
|
76
78
|
const connection = new RealtimeConnection(websocket, session, initialEvents);
|
|
77
79
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
+
const sessionOptions: RealtimeSessionOptions = {
|
|
81
|
+
targetStreamingDelayMs: options.targetStreamingDelayMs,
|
|
82
|
+
diarize: options.diarize,
|
|
83
|
+
contextBias: options.contextBias,
|
|
84
|
+
language: options.language,
|
|
85
|
+
speakerReferences: options.speakerReferences,
|
|
86
|
+
turnDetection: options.turnDetection,
|
|
87
|
+
};
|
|
88
|
+
if (
|
|
89
|
+
options.audioFormat != null
|
|
90
|
+
|| Object.values(sessionOptions).some((value) => value != null)
|
|
91
|
+
) {
|
|
92
|
+
await connection.updateSession(options.audioFormat, sessionOptions);
|
|
80
93
|
}
|
|
81
94
|
|
|
82
95
|
return connection;
|
|
@@ -38,6 +38,7 @@ import {
|
|
|
38
38
|
WorkflowContext,
|
|
39
39
|
} from "./models.js";
|
|
40
40
|
import {
|
|
41
|
+
dumpsCompactPythonJson,
|
|
41
42
|
dumpsPythonJson,
|
|
42
43
|
loadsPythonJson,
|
|
43
44
|
parsePythonJson,
|
|
@@ -357,7 +358,7 @@ export class PayloadEncoder {
|
|
|
357
358
|
const plaintext = textEncoder.encode(PayloadEncoder.#fieldData(field));
|
|
358
359
|
field.set("data", bytesToBase64(await this.#encrypt(plaintext)));
|
|
359
360
|
}
|
|
360
|
-
return [
|
|
361
|
+
return [dumpsCompactPythonJson(obj), encryptedFields.length > 0];
|
|
361
362
|
}
|
|
362
363
|
|
|
363
364
|
async #partiallyDecryptFields(
|