@openrouter/sdk 1.3.21 → 1.3.23
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/esm/funcs/alphaDecisionsCreate.js +5 -5
- package/esm/funcs/analyticsGetAnalyticsMeta.js +4 -4
- package/esm/funcs/analyticsGetUserActivity.js +5 -5
- package/esm/funcs/analyticsQueryAnalytics.js +4 -4
- package/esm/funcs/apiKeysCreate.js +4 -4
- package/esm/funcs/apiKeysDelete.js +4 -4
- package/esm/funcs/apiKeysGet.js +4 -4
- package/esm/funcs/apiKeysGetCurrentKeyMetadata.js +4 -4
- package/esm/funcs/apiKeysList.js +4 -4
- package/esm/funcs/apiKeysUpdate.js +4 -4
- package/esm/funcs/benchmarksGetBenchmarks.js +5 -5
- package/esm/funcs/byokCreate.js +5 -5
- package/esm/funcs/byokDelete.js +5 -5
- package/esm/funcs/byokGet.js +5 -5
- package/esm/funcs/byokList.js +5 -5
- package/esm/funcs/byokUpdate.js +5 -5
- package/esm/funcs/chatSend.js +4 -4
- package/esm/funcs/classificationsGetTaskClassifications.js +5 -5
- package/esm/funcs/containersDownloadContainerFileContent.js +4 -4
- package/esm/funcs/containersGetContainerFile.js +5 -5
- package/esm/funcs/containersListContainerFiles.js +5 -5
- package/esm/funcs/containersPromoteContainerFile.js +5 -5
- package/esm/funcs/creditsGetCredits.js +4 -4
- package/esm/funcs/datasetsGetAppRankings.js +5 -5
- package/esm/funcs/datasetsGetRankingsDaily.js +5 -5
- package/esm/funcs/datasetsGetSessionCost.js +5 -5
- package/esm/funcs/embeddingsGenerate.js +5 -5
- package/esm/funcs/embeddingsListModels.js +5 -5
- package/esm/funcs/endpointsList.js +4 -4
- package/esm/funcs/endpointsListZdrEndpoints.js +4 -4
- package/esm/funcs/filesDelete.js +5 -5
- package/esm/funcs/filesDownload.js +4 -4
- package/esm/funcs/filesList.js +4 -4
- package/esm/funcs/filesRetrieve.js +5 -5
- package/esm/funcs/filesUpload.js +5 -5
- package/esm/funcs/generationsGetGeneration.js +5 -5
- package/esm/funcs/generationsListGenerationContent.js +5 -5
- package/esm/funcs/generationsSubmitFeedback.js +5 -5
- package/esm/funcs/guardrailsBulkAssignKeys.js +5 -5
- package/esm/funcs/guardrailsBulkAssignMembers.js +5 -5
- package/esm/funcs/guardrailsBulkUnassignKeys.js +5 -5
- package/esm/funcs/guardrailsBulkUnassignMembers.js +5 -5
- package/esm/funcs/guardrailsCreate.js +5 -5
- package/esm/funcs/guardrailsDelete.js +5 -5
- package/esm/funcs/guardrailsGet.js +5 -5
- package/esm/funcs/guardrailsList.js +5 -5
- package/esm/funcs/guardrailsListGuardrailKeyAssignments.js +5 -5
- package/esm/funcs/guardrailsListGuardrailMemberAssignments.js +4 -4
- package/esm/funcs/guardrailsListKeyAssignments.js +5 -5
- package/esm/funcs/guardrailsListMemberAssignments.js +5 -5
- package/esm/funcs/guardrailsUpdate.js +5 -5
- package/esm/funcs/imagesGenerate.js +4 -4
- package/esm/funcs/imagesListModelEndpoints.js +5 -5
- package/esm/funcs/imagesListModels.js +5 -5
- package/esm/funcs/internsChat.js +8 -8
- package/esm/funcs/internsCreateIntern.js +5 -5
- package/esm/funcs/internsDeleteIntern.js +5 -5
- package/esm/funcs/internsGetIntern.js +5 -5
- package/esm/funcs/internsInvoke.js +7 -7
- package/esm/funcs/internsListInterns.js +5 -5
- package/esm/funcs/internsProvisionIntern.js +5 -5
- package/esm/funcs/internsSuspendIntern.js +5 -5
- package/esm/funcs/internsUpdateIntern.js +5 -5
- package/esm/funcs/modelsCount.js +5 -5
- package/esm/funcs/modelsGet.js +5 -5
- package/esm/funcs/modelsList.js +4 -4
- package/esm/funcs/modelsListForUser.js +5 -5
- package/esm/funcs/oAuthCreateAuthCode.js +4 -4
- package/esm/funcs/oAuthCreateOauthToken.js +5 -5
- package/esm/funcs/oAuthExchangeAuthCodeForAPIKey.js +4 -4
- package/esm/funcs/oAuthListOauthJwks.js +5 -5
- package/esm/funcs/observabilityCreate.js +5 -5
- package/esm/funcs/observabilityDelete.js +5 -5
- package/esm/funcs/observabilityGet.js +5 -5
- package/esm/funcs/observabilityList.js +4 -4
- package/esm/funcs/observabilityUpdate.js +5 -5
- package/esm/funcs/organizationListMembers.js +5 -5
- package/esm/funcs/presetsCreatePresetsChatCompletions.js +5 -5
- package/esm/funcs/presetsCreatePresetsMessages.js +5 -5
- package/esm/funcs/presetsCreatePresetsResponses.js +5 -5
- package/esm/funcs/presetsGet.js +5 -5
- package/esm/funcs/presetsGetVersion.js +5 -5
- package/esm/funcs/presetsList.js +5 -5
- package/esm/funcs/presetsListVersions.js +5 -5
- package/esm/funcs/providersList.js +4 -4
- package/esm/funcs/rerankRerank.js +5 -5
- package/esm/funcs/responsesSend.js +4 -4
- package/esm/funcs/scimCreate.js +5 -5
- package/esm/funcs/scimCreateSyncJob.js +5 -5
- package/esm/funcs/scimDelete.js +5 -5
- package/esm/funcs/scimGetSyncJob.js +5 -5
- package/esm/funcs/scimListGroups.js +5 -5
- package/esm/funcs/scimListMappings.js +5 -5
- package/esm/funcs/scimRead.js +5 -5
- package/esm/funcs/scimUpdate.js +5 -5
- package/esm/funcs/sttCreateTranscription.js +5 -5
- package/esm/funcs/sttCreateTranscriptionMultipart.js +5 -5
- package/esm/funcs/systemOneCreate.js +5 -5
- package/esm/funcs/ttsCreateSpeech.js +4 -4
- package/esm/funcs/vaultCopyVaultSecretsToIntern.js +5 -5
- package/esm/funcs/vaultDeleteInternVaultSecret.js +4 -4
- package/esm/funcs/vaultDeleteVaultSecret.js +4 -4
- package/esm/funcs/vaultListInternVaultSecrets.js +5 -5
- package/esm/funcs/vaultListVaultSecrets.js +5 -5
- package/esm/funcs/vaultStoreInternVaultSecret.js +5 -5
- package/esm/funcs/vaultStoreVaultSecret.js +5 -5
- package/esm/funcs/videoGenerationGenerate.js +5 -5
- package/esm/funcs/videoGenerationGetGeneration.js +5 -5
- package/esm/funcs/videoGenerationGetVideoContent.js +4 -4
- package/esm/funcs/videoGenerationListVideosModels.js +5 -5
- package/esm/funcs/workspacesBulkAddMembers.js +5 -5
- package/esm/funcs/workspacesBulkRemoveMembers.js +5 -5
- package/esm/funcs/workspacesCreate.js +5 -5
- package/esm/funcs/workspacesDelete.js +5 -5
- package/esm/funcs/workspacesDeleteBudget.js +5 -5
- package/esm/funcs/workspacesGet.js +5 -5
- package/esm/funcs/workspacesGetBudget.js +5 -5
- package/esm/funcs/workspacesList.js +5 -5
- package/esm/funcs/workspacesListBudgets.js +5 -5
- package/esm/funcs/workspacesListMembers.js +5 -5
- package/esm/funcs/workspacesSetBudget.js +5 -5
- package/esm/funcs/workspacesUpdate.js +5 -5
- package/esm/lib/anthropic-compat.d.ts +2 -2
- package/esm/lib/async-params.d.ts +4 -4
- package/esm/lib/chat-compat.d.ts +3 -2
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/lib/conversation-state.d.ts +7 -5
- package/esm/lib/model-result.d.ts +7 -4
- package/esm/lib/next-turn-params.d.ts +4 -4
- package/esm/lib/stream-transformers.d.ts +26 -17
- package/esm/lib/stream-type-guards.d.ts +41 -21
- package/esm/lib/tool-orchestrator.d.ts +7 -5
- package/esm/lib/tool-types.d.ts +14 -10
- package/esm/lib/turn-context.d.ts +6 -4
- package/esm/lib/turn-context.js +2 -2
- package/esm/models/customtoolcallitem.d.ts +8 -8
- package/esm/models/customtoolcallitem.js +4 -4
- package/esm/models/errors/badgatewayresponseerror.js +2 -2
- package/esm/models/errors/badrequestresponseerror.js +2 -2
- package/esm/models/errors/conflictresponseerror.js +2 -2
- package/esm/models/errors/edgenetworktimeoutresponseerror.js +2 -2
- package/esm/models/errors/forbiddenresponseerror.js +2 -2
- package/esm/models/errors/gatewaytimeoutresponseerror.js +2 -2
- package/esm/models/errors/goneresponseerror.js +2 -2
- package/esm/models/errors/internalserverresponseerror.js +2 -2
- package/esm/models/errors/internchaterrorresponse.js +2 -2
- package/esm/models/errors/internlifecycleerror.js +2 -2
- package/esm/models/errors/notfoundresponseerror.js +2 -2
- package/esm/models/errors/oautherrorresponse.js +2 -2
- package/esm/models/errors/payloadtoolargeresponseerror.js +2 -2
- package/esm/models/errors/paymentrequiredresponseerror.js +2 -2
- package/esm/models/errors/provideroverloadedresponseerror.js +2 -2
- package/esm/models/errors/requesttimeoutresponseerror.js +2 -2
- package/esm/models/errors/serviceunavailableresponseerror.js +2 -2
- package/esm/models/errors/toomanyrequestsresponseerror.js +2 -2
- package/esm/models/errors/unauthorizedresponseerror.js +2 -2
- package/esm/models/errors/unprocessableentityresponseerror.js +2 -2
- package/esm/models/functioncallitem.d.ts +12 -12
- package/esm/models/functioncallitem.js +6 -6
- package/esm/models/inputsunion.d.ts +4 -6
- package/esm/models/inputsunion.js +2 -8
- package/esm/models/operations/bulkaddworkspacemembers.js +2 -2
- package/esm/models/operations/bulkassignkeystoguardrail.js +2 -2
- package/esm/models/operations/bulkassignmemberstoguardrail.js +2 -2
- package/esm/models/operations/bulkremoveworkspacemembers.js +2 -2
- package/esm/models/operations/bulkunassignkeysfromguardrail.js +2 -2
- package/esm/models/operations/bulkunassignmembersfromguardrail.js +2 -2
- package/esm/models/operations/copyvaultsecretstointern.js +2 -2
- package/esm/models/operations/createapialphadecisions.js +2 -2
- package/esm/models/operations/createaudiospeech.js +2 -2
- package/esm/models/operations/createaudiotranscriptions.js +2 -2
- package/esm/models/operations/createbyokkey.js +2 -2
- package/esm/models/operations/createembeddings.js +10 -10
- package/esm/models/operations/createguardrail.js +2 -2
- package/esm/models/operations/createimages.js +4 -4
- package/esm/models/operations/createintern.js +2 -2
- package/esm/models/operations/createinternchatcompletion.js +6 -6
- package/esm/models/operations/createoauthtoken.js +2 -2
- package/esm/models/operations/createobservabilitydestination.js +2 -2
- package/esm/models/operations/createpresetschatcompletions.js +2 -2
- package/esm/models/operations/createpresetsmessages.js +2 -2
- package/esm/models/operations/createpresetsresponses.js +2 -2
- package/esm/models/operations/creatererank.js +3 -3
- package/esm/models/operations/createresponses.js +5 -5
- package/esm/models/operations/createscimgroupmapping.js +2 -2
- package/esm/models/operations/createscimsyncjob.js +2 -2
- package/esm/models/operations/createsystemone.js +2 -2
- package/esm/models/operations/createvideos.js +2 -2
- package/esm/models/operations/createworkspace.js +2 -2
- package/esm/models/operations/deletefile.js +2 -2
- package/esm/models/operations/deleteintern.js +2 -2
- package/esm/models/operations/deleteworkspacebudget.js +2 -2
- package/esm/models/operations/downloadfilecontent.js +2 -2
- package/esm/models/operations/getapprankings.js +2 -2
- package/esm/models/operations/getcurrentkey.js +2 -2
- package/esm/models/operations/getfilemetadata.js +2 -2
- package/esm/models/operations/getmodels.js +2 -2
- package/esm/models/operations/getsessioncost.js +2 -2
- package/esm/models/operations/getworkspacebudget.js +2 -2
- package/esm/models/operations/invokeintern.js +3 -3
- package/esm/models/operations/listbyokkeys.js +2 -2
- package/esm/models/operations/listembeddingsmodels.js +2 -2
- package/esm/models/operations/listendpoints.js +2 -2
- package/esm/models/operations/listendpointszdr.js +2 -2
- package/esm/models/operations/listfiles.js +3 -3
- package/esm/models/operations/listguardrailkeyassignments.js +2 -2
- package/esm/models/operations/listguardrailmemberassignments.js +2 -2
- package/esm/models/operations/listguardrails.js +2 -2
- package/esm/models/operations/listkeyassignments.js +2 -2
- package/esm/models/operations/listmemberassignments.js +2 -2
- package/esm/models/operations/listmodelsuser.js +2 -2
- package/esm/models/operations/listobservabilitydestinations.js +2 -2
- package/esm/models/operations/listpresets.js +2 -2
- package/esm/models/operations/listpresetversions.js +2 -2
- package/esm/models/operations/listscimgroupmappings.js +2 -2
- package/esm/models/operations/listscimgroups.js +2 -2
- package/esm/models/operations/listworkspacemembers.js +2 -2
- package/esm/models/operations/listworkspaces.js +2 -2
- package/esm/models/operations/sendchatcompletionrequest.js +5 -5
- package/esm/models/operations/storeinternvaultsecret.js +2 -2
- package/esm/models/operations/storevaultsecret.js +2 -2
- package/esm/models/operations/submitgenerationfeedback.js +2 -2
- package/esm/models/operations/updatebyokkey.js +2 -2
- package/esm/models/operations/updateguardrail.js +2 -2
- package/esm/models/operations/updateintern.js +2 -2
- package/esm/models/operations/updateobservabilitydestination.js +2 -2
- package/esm/models/operations/updatescimgroupmapping.js +2 -2
- package/esm/models/operations/updateworkspace.js +2 -2
- package/esm/models/operations/uploadfile.js +2 -2
- package/esm/models/operations/upsertworkspacebudget.js +3 -3
- package/esm/models/outputcustomtoolcallitem.d.ts +2 -26
- package/esm/models/outputcustomtoolcallitem.js +1 -28
- package/esm/models/outputfunctioncallitem.d.ts +1 -44
- package/esm/models/outputfunctioncallitem.js +1 -64
- package/esm/models/outputitems.d.ts +2 -6
- package/esm/models/outputitems.js +2 -2
- package/jsr.json +1 -1
- package/package.json +10 -8
- package/scripts/unbarrel-imports.js +296 -0
|
@@ -9,8 +9,8 @@ import { compactMap } from "../lib/primitives.js";
|
|
|
9
9
|
import { safeParse } from "../lib/schemas.js";
|
|
10
10
|
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
11
|
import { pathToFunc } from "../lib/url.js";
|
|
12
|
-
import
|
|
13
|
-
import
|
|
12
|
+
import { ForbiddenResponseError$inboundSchema as errors_ForbiddenResponseError$inboundSchema } from "../models/errors/forbiddenresponseerror.js"; import { InternalServerResponseError$inboundSchema as errors_InternalServerResponseError$inboundSchema } from "../models/errors/internalserverresponseerror.js"; import { NotFoundResponseError$inboundSchema as errors_NotFoundResponseError$inboundSchema } from "../models/errors/notfoundresponseerror.js"; import { UnauthorizedResponseError$inboundSchema as errors_UnauthorizedResponseError$inboundSchema } from "../models/errors/unauthorizedresponseerror.js";
|
|
13
|
+
import { ListWorkspaceMembersRequest$outboundSchema as operations_ListWorkspaceMembersRequest$outboundSchema, ListWorkspaceMembersResponse$inboundSchema as operations_ListWorkspaceMembersResponse$inboundSchema } from "../models/operations/listworkspacemembers.js";
|
|
14
14
|
import { APIPromise } from "../types/async.js";
|
|
15
15
|
import { createPageIterator, haltIterator, } from "../types/operations.js";
|
|
16
16
|
/**
|
|
@@ -23,7 +23,7 @@ export function workspacesListMembers(client, request, options) {
|
|
|
23
23
|
return new APIPromise($do(client, request, options));
|
|
24
24
|
}
|
|
25
25
|
async function $do(client, request, options) {
|
|
26
|
-
const parsed = safeParse(request, (value) =>
|
|
26
|
+
const parsed = safeParse(request, (value) => operations_ListWorkspaceMembersRequest$outboundSchema.parse(value), "Input validation failed");
|
|
27
27
|
if (!parsed.ok) {
|
|
28
28
|
return [haltIterator(parsed), { status: "invalid" }];
|
|
29
29
|
}
|
|
@@ -99,9 +99,9 @@ async function $do(client, request, options) {
|
|
|
99
99
|
const responseFields = {
|
|
100
100
|
HttpMeta: { Response: response, Request: req },
|
|
101
101
|
};
|
|
102
|
-
const [result, raw] = await M.match(M.json(200,
|
|
102
|
+
const [result, raw] = await M.match(M.json(200, operations_ListWorkspaceMembersResponse$inboundSchema, {
|
|
103
103
|
key: "Result",
|
|
104
|
-
}), M.jsonErr(401,
|
|
104
|
+
}), M.jsonErr(401, errors_UnauthorizedResponseError$inboundSchema), M.jsonErr(403, errors_ForbiddenResponseError$inboundSchema), M.jsonErr(404, errors_NotFoundResponseError$inboundSchema), M.jsonErr(500, errors_InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
105
105
|
if (!result.ok) {
|
|
106
106
|
return [haltIterator(result), {
|
|
107
107
|
status: "complete",
|
|
@@ -9,9 +9,9 @@ import { compactMap } from "../lib/primitives.js";
|
|
|
9
9
|
import { safeParse } from "../lib/schemas.js";
|
|
10
10
|
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
11
|
import { pathToFunc } from "../lib/url.js";
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
12
|
+
import { BadRequestResponseError$inboundSchema as errors_BadRequestResponseError$inboundSchema } from "../models/errors/badrequestresponseerror.js"; import { InternalServerResponseError$inboundSchema as errors_InternalServerResponseError$inboundSchema } from "../models/errors/internalserverresponseerror.js"; import { NotFoundResponseError$inboundSchema as errors_NotFoundResponseError$inboundSchema } from "../models/errors/notfoundresponseerror.js"; import { UnauthorizedResponseError$inboundSchema as errors_UnauthorizedResponseError$inboundSchema } from "../models/errors/unauthorizedresponseerror.js";
|
|
13
|
+
import { UpsertWorkspaceBudgetResponse$inboundSchema as models_UpsertWorkspaceBudgetResponse$inboundSchema } from "../models/upsertworkspacebudgetresponse.js";
|
|
14
|
+
import { UpsertWorkspaceBudgetRequest$outboundSchema as operations_UpsertWorkspaceBudgetRequest$outboundSchema } from "../models/operations/upsertworkspacebudget.js";
|
|
15
15
|
import { APIPromise } from "../types/async.js";
|
|
16
16
|
/**
|
|
17
17
|
* Create or update a workspace budget
|
|
@@ -23,7 +23,7 @@ export function workspacesSetBudget(client, request, options) {
|
|
|
23
23
|
return new APIPromise($do(client, request, options));
|
|
24
24
|
}
|
|
25
25
|
async function $do(client, request, options) {
|
|
26
|
-
const parsed = safeParse(request, (value) =>
|
|
26
|
+
const parsed = safeParse(request, (value) => operations_UpsertWorkspaceBudgetRequest$outboundSchema.parse(value), "Input validation failed");
|
|
27
27
|
if (!parsed.ok) {
|
|
28
28
|
return [parsed, { status: "invalid" }];
|
|
29
29
|
}
|
|
@@ -101,7 +101,7 @@ async function $do(client, request, options) {
|
|
|
101
101
|
const responseFields = {
|
|
102
102
|
HttpMeta: { Response: response, Request: req },
|
|
103
103
|
};
|
|
104
|
-
const [result] = await M.match(M.json(200,
|
|
104
|
+
const [result] = await M.match(M.json(200, models_UpsertWorkspaceBudgetResponse$inboundSchema), M.jsonErr(400, errors_BadRequestResponseError$inboundSchema), M.jsonErr(401, errors_UnauthorizedResponseError$inboundSchema), M.jsonErr(404, errors_NotFoundResponseError$inboundSchema), M.jsonErr(500, errors_InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
105
105
|
if (!result.ok) {
|
|
106
106
|
return [result, { status: "complete", request: req, response }];
|
|
107
107
|
}
|
|
@@ -9,9 +9,9 @@ import { compactMap } from "../lib/primitives.js";
|
|
|
9
9
|
import { safeParse } from "../lib/schemas.js";
|
|
10
10
|
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
11
|
import { pathToFunc } from "../lib/url.js";
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
12
|
+
import { BadRequestResponseError$inboundSchema as errors_BadRequestResponseError$inboundSchema } from "../models/errors/badrequestresponseerror.js"; import { ForbiddenResponseError$inboundSchema as errors_ForbiddenResponseError$inboundSchema } from "../models/errors/forbiddenresponseerror.js"; import { InternalServerResponseError$inboundSchema as errors_InternalServerResponseError$inboundSchema } from "../models/errors/internalserverresponseerror.js"; import { NotFoundResponseError$inboundSchema as errors_NotFoundResponseError$inboundSchema } from "../models/errors/notfoundresponseerror.js"; import { UnauthorizedResponseError$inboundSchema as errors_UnauthorizedResponseError$inboundSchema } from "../models/errors/unauthorizedresponseerror.js";
|
|
13
|
+
import { UpdateWorkspaceResponse$inboundSchema as models_UpdateWorkspaceResponse$inboundSchema } from "../models/updateworkspaceresponse.js";
|
|
14
|
+
import { UpdateWorkspaceRequest$outboundSchema as operations_UpdateWorkspaceRequest$outboundSchema } from "../models/operations/updateworkspace.js";
|
|
15
15
|
import { APIPromise } from "../types/async.js";
|
|
16
16
|
/**
|
|
17
17
|
* Update a workspace
|
|
@@ -23,7 +23,7 @@ export function workspacesUpdate(client, request, options) {
|
|
|
23
23
|
return new APIPromise($do(client, request, options));
|
|
24
24
|
}
|
|
25
25
|
async function $do(client, request, options) {
|
|
26
|
-
const parsed = safeParse(request, (value) =>
|
|
26
|
+
const parsed = safeParse(request, (value) => operations_UpdateWorkspaceRequest$outboundSchema.parse(value), "Input validation failed");
|
|
27
27
|
if (!parsed.ok) {
|
|
28
28
|
return [parsed, { status: "invalid" }];
|
|
29
29
|
}
|
|
@@ -97,7 +97,7 @@ async function $do(client, request, options) {
|
|
|
97
97
|
const responseFields = {
|
|
98
98
|
HttpMeta: { Response: response, Request: req },
|
|
99
99
|
};
|
|
100
|
-
const [result] = await M.match(M.json(200,
|
|
100
|
+
const [result] = await M.match(M.json(200, models_UpdateWorkspaceResponse$inboundSchema), M.jsonErr(400, errors_BadRequestResponseError$inboundSchema), M.jsonErr(401, errors_UnauthorizedResponseError$inboundSchema), M.jsonErr(403, errors_ForbiddenResponseError$inboundSchema), M.jsonErr(404, errors_NotFoundResponseError$inboundSchema), M.jsonErr(500, errors_InternalServerResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
101
101
|
if (!result.ok) {
|
|
102
102
|
return [result, { status: "complete", request: req, response }];
|
|
103
103
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { InputsUnion } from '../models/inputsunion.js';
|
|
2
2
|
import type { ClaudeMessageParam } from '../models/claude-message.js';
|
|
3
3
|
import { convertToClaudeMessage } from './stream-transformers.js';
|
|
4
4
|
/**
|
|
@@ -26,7 +26,7 @@ import { convertToClaudeMessage } from './stream-transformers.js';
|
|
|
26
26
|
* });
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
29
|
-
export declare function fromClaudeMessages(messages: ClaudeMessageParam[]):
|
|
29
|
+
export declare function fromClaudeMessages(messages: ClaudeMessageParam[]): InputsUnion;
|
|
30
30
|
/**
|
|
31
31
|
* Convert an OpenResponses response to Anthropic Claude message format.
|
|
32
32
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { OpenResponsesResult } from '../models/openresponsesresult.js';
|
|
2
|
+
import type { ResponsesRequest } from '../models/responsesrequest.js';
|
|
2
3
|
import type { ToolContextMapWithShared, ParsedToolCall, StateAccessor, StopWhen, Tool, TurnContext } from './tool-types.js';
|
|
3
|
-
import type { OpenResponsesResult } from '../models/index.js';
|
|
4
4
|
import type { ContextInput } from './tool-context.js';
|
|
5
5
|
export type { Tool } from './tool-types.js';
|
|
6
6
|
/**
|
|
@@ -11,7 +11,7 @@ export type FieldOrAsyncFunction<T> = T | ((context: TurnContext) => T | Promise
|
|
|
11
11
|
* Base input type for callModel without approval-related fields
|
|
12
12
|
*/
|
|
13
13
|
type BaseCallModelInput<TTools extends readonly Tool[] = readonly Tool[], TShared extends Record<string, unknown> = Record<string, never>> = {
|
|
14
|
-
[K in keyof Omit<
|
|
14
|
+
[K in keyof Omit<ResponsesRequest, 'stream' | 'tools'>]?: FieldOrAsyncFunction<ResponsesRequest[K]>;
|
|
15
15
|
} & {
|
|
16
16
|
tools?: TTools;
|
|
17
17
|
stopWhen?: StopWhen<TTools>;
|
|
@@ -73,7 +73,7 @@ export type CallModelInputWithState<TTools extends readonly Tool[] = readonly To
|
|
|
73
73
|
* Resolved CallModelInput (all functions evaluated to values)
|
|
74
74
|
* This is the type after all async functions have been resolved to their values
|
|
75
75
|
*/
|
|
76
|
-
export type ResolvedCallModelInput = Omit<
|
|
76
|
+
export type ResolvedCallModelInput = Omit<ResponsesRequest, 'stream' | 'tools'> & {
|
|
77
77
|
tools?: never;
|
|
78
78
|
};
|
|
79
79
|
/**
|
package/esm/lib/chat-compat.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { ChatMessages } from "../models/chatmessages.js";
|
|
2
|
+
import type { InputsUnion } from "../models/inputsunion.js";
|
|
2
3
|
import { extractMessageFromResponse } from "./stream-transformers.js";
|
|
3
4
|
/**
|
|
4
5
|
* Convert OpenAI chat-style messages to OpenResponses input format.
|
|
@@ -21,7 +22,7 @@ import { extractMessageFromResponse } from "./stream-transformers.js";
|
|
|
21
22
|
* });
|
|
22
23
|
* ```
|
|
23
24
|
*/
|
|
24
|
-
export declare function fromChatMessages(messages:
|
|
25
|
+
export declare function fromChatMessages(messages: ChatMessages[]): InputsUnion;
|
|
25
26
|
/**
|
|
26
27
|
* Convert an OpenResponses response to OpenAI chat message format.
|
|
27
28
|
*
|
package/esm/lib/config.d.ts
CHANGED
|
@@ -50,8 +50,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
50
50
|
export declare const SDK_METADATA: {
|
|
51
51
|
readonly language: "typescript";
|
|
52
52
|
readonly openapiDocVersion: "1.0.0";
|
|
53
|
-
readonly sdkVersion: "1.3.
|
|
53
|
+
readonly sdkVersion: "1.3.23";
|
|
54
54
|
readonly genVersion: "2.914.0";
|
|
55
|
-
readonly userAgent: "speakeasy-sdk/typescript 1.3.
|
|
55
|
+
readonly userAgent: "speakeasy-sdk/typescript 1.3.23 2.914.0 1.0.0 @openrouter/sdk";
|
|
56
56
|
};
|
|
57
57
|
//# sourceMappingURL=config.d.ts.map
|
package/esm/lib/config.js
CHANGED
|
@@ -29,8 +29,8 @@ export function serverURLFromOptions(options) {
|
|
|
29
29
|
export const SDK_METADATA = {
|
|
30
30
|
language: "typescript",
|
|
31
31
|
openapiDocVersion: "1.0.0",
|
|
32
|
-
sdkVersion: "1.3.
|
|
32
|
+
sdkVersion: "1.3.23",
|
|
33
33
|
genVersion: "2.914.0",
|
|
34
|
-
userAgent: "speakeasy-sdk/typescript 1.3.
|
|
34
|
+
userAgent: "speakeasy-sdk/typescript 1.3.23 2.914.0 1.0.0 @openrouter/sdk",
|
|
35
35
|
};
|
|
36
36
|
//# sourceMappingURL=config.js.map
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { FunctionCallOutputItem } from '../models/functioncalloutputitem.js';
|
|
2
|
+
import type { InputsUnion, InputsUnion1 } from '../models/inputsunion.js';
|
|
3
|
+
import type { OpenResponsesResult } from '../models/openresponsesresult.js';
|
|
2
4
|
import type { ConversationState, ParsedToolCall, Tool, TurnContext, UnsentToolResult } from './tool-types.js';
|
|
3
5
|
/**
|
|
4
6
|
* Generate a unique ID for a conversation
|
|
@@ -18,7 +20,7 @@ export declare function updateState<TTools extends readonly Tool[] = readonly To
|
|
|
18
20
|
/**
|
|
19
21
|
* Append new items to the message history
|
|
20
22
|
*/
|
|
21
|
-
export declare function appendToMessages(current:
|
|
23
|
+
export declare function appendToMessages(current: InputsUnion, newItems: InputsUnion1[]): InputsUnion;
|
|
22
24
|
/**
|
|
23
25
|
* Check if a tool call requires approval
|
|
24
26
|
* @param toolCall - The tool call to check
|
|
@@ -49,13 +51,13 @@ export declare function createRejectedResult<TTools extends readonly Tool[] = re
|
|
|
49
51
|
/**
|
|
50
52
|
* Convert unsent tool results to API format for sending to the model
|
|
51
53
|
*/
|
|
52
|
-
export declare function unsentResultsToAPIFormat(results: UnsentToolResult[]):
|
|
54
|
+
export declare function unsentResultsToAPIFormat(results: UnsentToolResult[]): FunctionCallOutputItem[];
|
|
53
55
|
/**
|
|
54
56
|
* Extract text content from a response
|
|
55
57
|
*/
|
|
56
|
-
export declare function extractTextFromResponse(response:
|
|
58
|
+
export declare function extractTextFromResponse(response: OpenResponsesResult): string;
|
|
57
59
|
/**
|
|
58
60
|
* Extract tool calls from a response
|
|
59
61
|
*/
|
|
60
|
-
export declare function extractToolCallsFromResponse<TTools extends readonly Tool[]>(response:
|
|
62
|
+
export declare function extractToolCallsFromResponse<TTools extends readonly Tool[]>(response: OpenResponsesResult): ParsedToolCall<TTools[number]>[];
|
|
61
63
|
//# sourceMappingURL=conversation-state.d.ts.map
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { OpenRouterCore } from '../core.js';
|
|
2
|
-
import type
|
|
2
|
+
import type { FunctionCallOutputItem } from '../models/functioncalloutputitem.js';
|
|
3
|
+
import type { OpenResponsesResult } from '../models/openresponsesresult.js';
|
|
4
|
+
import type { OutputFunctionCallItem } from '../models/outputfunctioncallitem.js';
|
|
5
|
+
import type { OutputMessage } from '../models/outputmessage.js';
|
|
3
6
|
import type { CallModelInput } from './async-params.js';
|
|
4
7
|
import type { RequestOptions } from './sdks.js';
|
|
5
8
|
import type { $ZodObject, $ZodShape } from 'zod/v4/core';
|
|
@@ -27,7 +30,7 @@ export interface GetResponseOptions<TTools extends readonly Tool[], TShared exte
|
|
|
27
30
|
/** Callback invoked at the start of each tool execution turn */
|
|
28
31
|
onTurnStart?: (context: TurnContext) => void | Promise<void>;
|
|
29
32
|
/** Callback invoked at the end of each tool execution turn */
|
|
30
|
-
onTurnEnd?: (context: TurnContext, response:
|
|
33
|
+
onTurnEnd?: (context: TurnContext, response: OpenResponsesResult) => void | Promise<void>;
|
|
31
34
|
}
|
|
32
35
|
/**
|
|
33
36
|
* A wrapper around a streaming response that provides multiple consumption patterns.
|
|
@@ -267,7 +270,7 @@ export declare class ModelResult<TTools extends readonly Tool[], TShared extends
|
|
|
267
270
|
* This will consume the stream until completion and execute any tools.
|
|
268
271
|
* Returns the full OpenResponsesResult with usage data (inputTokens, outputTokens, cachedTokens, etc.)
|
|
269
272
|
*/
|
|
270
|
-
getResponse(): Promise<
|
|
273
|
+
getResponse(): Promise<OpenResponsesResult>;
|
|
271
274
|
/**
|
|
272
275
|
* Stream all response events as they arrive across all turns.
|
|
273
276
|
* Multiple consumers can iterate over this stream concurrently.
|
|
@@ -306,7 +309,7 @@ export declare class ModelResult<TTools extends readonly Tool[], TShared extends
|
|
|
306
309
|
* Returns OutputMessage, OutputFunctionCallItem, or FunctionCallOutputItem
|
|
307
310
|
* compatible with OpenAI Responses API format.
|
|
308
311
|
*/
|
|
309
|
-
getNewMessagesStream(): AsyncIterableIterator<
|
|
312
|
+
getNewMessagesStream(): AsyncIterableIterator<OutputMessage | FunctionCallOutputItem | OutputFunctionCallItem>;
|
|
310
313
|
/**
|
|
311
314
|
* Stream only reasoning deltas as they arrive from all turns.
|
|
312
315
|
* This filters the full event stream to only yield reasoning content,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { ResponsesRequest } from '../models/responsesrequest.js';
|
|
2
2
|
import type { NextTurnParamsContext, ParsedToolCall, Tool } from './tool-types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Build a NextTurnParamsContext from the current request
|
|
@@ -7,7 +7,7 @@ import type { NextTurnParamsContext, ParsedToolCall, Tool } from './tool-types.j
|
|
|
7
7
|
* @param request - The current ResponsesRequest
|
|
8
8
|
* @returns Context object with current parameter values
|
|
9
9
|
*/
|
|
10
|
-
export declare function buildNextTurnParamsContext(request:
|
|
10
|
+
export declare function buildNextTurnParamsContext(request: ResponsesRequest): NextTurnParamsContext;
|
|
11
11
|
/**
|
|
12
12
|
* Execute nextTurnParams functions for all called tools
|
|
13
13
|
* Composes functions when multiple tools modify the same parameter
|
|
@@ -17,7 +17,7 @@ export declare function buildNextTurnParamsContext(request: models.ResponsesRequ
|
|
|
17
17
|
* @param currentRequest - The current request
|
|
18
18
|
* @returns Object with computed parameter values
|
|
19
19
|
*/
|
|
20
|
-
export declare function executeNextTurnParamsFunctions(toolCalls: ParsedToolCall<Tool>[], tools: readonly Tool[], currentRequest:
|
|
20
|
+
export declare function executeNextTurnParamsFunctions(toolCalls: ParsedToolCall<Tool>[], tools: readonly Tool[], currentRequest: ResponsesRequest): Promise<Partial<NextTurnParamsContext>>;
|
|
21
21
|
/**
|
|
22
22
|
* Apply computed nextTurnParams to the current request
|
|
23
23
|
* Returns a new request object with updated parameters
|
|
@@ -26,5 +26,5 @@ export declare function executeNextTurnParamsFunctions(toolCalls: ParsedToolCall
|
|
|
26
26
|
* @param computedParams - Computed parameter values from nextTurnParams functions
|
|
27
27
|
* @returns New request with updated parameters
|
|
28
28
|
*/
|
|
29
|
-
export declare function applyNextTurnParamsToRequest(request:
|
|
29
|
+
export declare function applyNextTurnParamsToRequest(request: ResponsesRequest, computedParams: Partial<NextTurnParamsContext>): ResponsesRequest;
|
|
30
30
|
//# sourceMappingURL=next-turn-params.d.ts.map
|
|
@@ -1,30 +1,39 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { ChatAssistantMessage } from '../models/chatassistantmessage.js';
|
|
2
|
+
import type { FunctionCallOutputItem } from '../models/functioncalloutputitem.js';
|
|
3
|
+
import type { OpenResponsesResult } from '../models/openresponsesresult.js';
|
|
4
|
+
import type { OutputFileSearchCallItem } from '../models/outputfilesearchcallitem.js';
|
|
5
|
+
import type { OutputFunctionCallItem } from '../models/outputfunctioncallitem.js';
|
|
6
|
+
import type { OutputImageGenerationCallItem } from '../models/outputimagegenerationcallitem.js';
|
|
7
|
+
import type { OutputMessage } from '../models/outputmessage.js';
|
|
8
|
+
import type { OutputReasoningItem } from '../models/outputreasoningitem.js';
|
|
9
|
+
import type { OutputWebSearchCallItem } from '../models/outputwebsearchcallitem.js';
|
|
10
|
+
import type { StreamEvents } from '../models/streamevents.js';
|
|
2
11
|
import type { ClaudeMessage, UnsupportedContent } from '../models/claude-message.js';
|
|
3
12
|
import type { ReusableReadableStream } from './reusable-stream.js';
|
|
4
13
|
import type { ParsedToolCall, Tool } from './tool-types.js';
|
|
5
14
|
/**
|
|
6
15
|
* Extract text deltas from responses stream events
|
|
7
16
|
*/
|
|
8
|
-
export declare function extractTextDeltas(stream: ReusableReadableStream<
|
|
17
|
+
export declare function extractTextDeltas(stream: ReusableReadableStream<StreamEvents>): AsyncIterableIterator<string>;
|
|
9
18
|
/**
|
|
10
19
|
* Extract reasoning deltas from responses stream events
|
|
11
20
|
*/
|
|
12
|
-
export declare function extractReasoningDeltas(stream: ReusableReadableStream<
|
|
21
|
+
export declare function extractReasoningDeltas(stream: ReusableReadableStream<StreamEvents>): AsyncIterableIterator<string>;
|
|
13
22
|
/**
|
|
14
23
|
* Extract tool call argument deltas from responses stream events
|
|
15
24
|
*/
|
|
16
|
-
export declare function extractToolDeltas(stream: ReusableReadableStream<
|
|
25
|
+
export declare function extractToolDeltas(stream: ReusableReadableStream<StreamEvents>): AsyncIterableIterator<string>;
|
|
17
26
|
/**
|
|
18
27
|
* Build incremental message updates from responses stream events
|
|
19
28
|
* Returns OutputMessage (assistant/responses format)
|
|
20
29
|
*/
|
|
21
|
-
export declare function buildResponsesMessageStream(stream: ReusableReadableStream<
|
|
30
|
+
export declare function buildResponsesMessageStream(stream: ReusableReadableStream<StreamEvents>): AsyncIterableIterator<OutputMessage>;
|
|
22
31
|
/**
|
|
23
32
|
* Output item types that can be streamed from a response.
|
|
24
33
|
* This is the union of all item types that appear in response output,
|
|
25
34
|
* plus function_call_output for tool results.
|
|
26
35
|
*/
|
|
27
|
-
export type StreamableOutputItem =
|
|
36
|
+
export type StreamableOutputItem = OutputMessage | OutputFunctionCallItem | OutputReasoningItem | OutputWebSearchCallItem | OutputFileSearchCallItem | OutputImageGenerationCallItem | FunctionCallOutputItem;
|
|
28
37
|
/**
|
|
29
38
|
* Discriminated union for tracking items in progress.
|
|
30
39
|
* Each variant has only the fields relevant to that item type.
|
|
@@ -44,7 +53,7 @@ export type ItemInProgress = {
|
|
|
44
53
|
id: string;
|
|
45
54
|
reasoningContent: string;
|
|
46
55
|
};
|
|
47
|
-
type ItemsStreamHandler = (event:
|
|
56
|
+
type ItemsStreamHandler = (event: StreamEvents, itemsInProgress: Map<string, ItemInProgress>) => StreamableOutputItem | undefined;
|
|
48
57
|
export declare const itemsStreamHandlers: Record<string, ItemsStreamHandler>;
|
|
49
58
|
export declare const streamTerminationEvents: Set<string>;
|
|
50
59
|
/**
|
|
@@ -52,47 +61,47 @@ export declare const streamTerminationEvents: Set<string>;
|
|
|
52
61
|
* Yields all item types cumulatively - same item may be emitted multiple times
|
|
53
62
|
* with the same ID but progressively updated content as streaming progresses.
|
|
54
63
|
*/
|
|
55
|
-
export declare function buildItemsStream(stream: ReusableReadableStream<
|
|
64
|
+
export declare function buildItemsStream(stream: ReusableReadableStream<StreamEvents>): AsyncIterableIterator<StreamableOutputItem>;
|
|
56
65
|
/**
|
|
57
66
|
* Build incremental message updates from responses stream events
|
|
58
67
|
* Returns ChatAssistantMessage (chat format) instead of OutputMessage
|
|
59
68
|
*/
|
|
60
|
-
export declare function buildMessageStream(stream: ReusableReadableStream<
|
|
69
|
+
export declare function buildMessageStream(stream: ReusableReadableStream<StreamEvents>): AsyncIterableIterator<ChatAssistantMessage>;
|
|
61
70
|
/**
|
|
62
71
|
* Consume stream until completion and return the complete response
|
|
63
72
|
*/
|
|
64
|
-
export declare function consumeStreamForCompletion(stream: ReusableReadableStream<
|
|
73
|
+
export declare function consumeStreamForCompletion(stream: ReusableReadableStream<StreamEvents>): Promise<OpenResponsesResult>;
|
|
65
74
|
/**
|
|
66
75
|
* Extract the first message from a completed response (chat format)
|
|
67
76
|
*/
|
|
68
|
-
export declare function extractMessageFromResponse(response:
|
|
77
|
+
export declare function extractMessageFromResponse(response: OpenResponsesResult): ChatAssistantMessage;
|
|
69
78
|
/**
|
|
70
79
|
* Extract the first message from a completed response (responses format)
|
|
71
80
|
*/
|
|
72
|
-
export declare function extractResponsesMessageFromResponse(response:
|
|
81
|
+
export declare function extractResponsesMessageFromResponse(response: OpenResponsesResult): OutputMessage;
|
|
73
82
|
/**
|
|
74
83
|
* Extract text from a response, either from outputText or by concatenating message content
|
|
75
84
|
*/
|
|
76
|
-
export declare function extractTextFromResponse(response:
|
|
85
|
+
export declare function extractTextFromResponse(response: OpenResponsesResult): string;
|
|
77
86
|
/**
|
|
78
87
|
* Extract all tool calls from a completed response
|
|
79
88
|
* Returns parsed tool calls with arguments as objects (not JSON strings)
|
|
80
89
|
*/
|
|
81
|
-
export declare function extractToolCallsFromResponse(response:
|
|
90
|
+
export declare function extractToolCallsFromResponse(response: OpenResponsesResult): ParsedToolCall<Tool>[];
|
|
82
91
|
/**
|
|
83
92
|
* Build incremental tool call updates from responses stream events
|
|
84
93
|
* Yields structured tool call objects as they're built from deltas
|
|
85
94
|
*/
|
|
86
|
-
export declare function buildToolCallStream(stream: ReusableReadableStream<
|
|
95
|
+
export declare function buildToolCallStream(stream: ReusableReadableStream<StreamEvents>): AsyncIterableIterator<ParsedToolCall<Tool>>;
|
|
87
96
|
/**
|
|
88
97
|
* Check if a response contains any tool calls
|
|
89
98
|
*/
|
|
90
|
-
export declare function responseHasToolCalls(response:
|
|
99
|
+
export declare function responseHasToolCalls(response: OpenResponsesResult): boolean;
|
|
91
100
|
/**
|
|
92
101
|
* Convert OpenResponsesResult to ClaudeMessage format
|
|
93
102
|
* Compatible with the Anthropic SDK BetaMessage type
|
|
94
103
|
*/
|
|
95
|
-
export declare function convertToClaudeMessage(response:
|
|
104
|
+
export declare function convertToClaudeMessage(response: OpenResponsesResult): ClaudeMessage;
|
|
96
105
|
/**
|
|
97
106
|
* Extract unsupported content by original type
|
|
98
107
|
*/
|
|
@@ -1,28 +1,48 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { FileCitation } from '../models/filecitation.js';
|
|
2
|
+
import type { FilePath } from '../models/filepath.js';
|
|
3
|
+
import type { FunctionCallArgsDeltaEvent } from '../models/functioncallargsdeltaevent.js';
|
|
4
|
+
import type { FunctionCallArgsDoneEvent } from '../models/functioncallargsdoneevent.js';
|
|
5
|
+
import type { OpenAIResponsesRefusalContent } from '../models/openairesponsesrefusalcontent.js';
|
|
6
|
+
import type { OutputFileSearchCallItem } from '../models/outputfilesearchcallitem.js';
|
|
7
|
+
import type { OutputFunctionCallItem } from '../models/outputfunctioncallitem.js';
|
|
8
|
+
import type { OutputImageGenerationCallItem } from '../models/outputimagegenerationcallitem.js';
|
|
9
|
+
import type { OutputMessage } from '../models/outputmessage.js';
|
|
10
|
+
import type { OutputReasoningItem } from '../models/outputreasoningitem.js';
|
|
11
|
+
import type { OutputWebSearchCallItem } from '../models/outputwebsearchcallitem.js';
|
|
12
|
+
import type { ReasoningDeltaEvent } from '../models/reasoningdeltaevent.js';
|
|
13
|
+
import type { ResponseOutputText } from '../models/responseoutputtext.js';
|
|
14
|
+
import type { StreamEvents } from '../models/streamevents.js';
|
|
15
|
+
import type { StreamEventsResponseCompleted } from '../models/streameventsresponsecompleted.js';
|
|
16
|
+
import type { StreamEventsResponseFailed } from '../models/streameventsresponsefailed.js';
|
|
17
|
+
import type { StreamEventsResponseIncomplete } from '../models/streameventsresponseincomplete.js';
|
|
18
|
+
import type { StreamEventsResponseOutputItemAdded } from '../models/streameventsresponseoutputitemadded.js';
|
|
19
|
+
import type { StreamEventsResponseOutputItemDone } from '../models/streameventsresponseoutputitemdone.js';
|
|
20
|
+
import type { TextDeltaEvent } from '../models/textdeltaevent.js';
|
|
21
|
+
import type { URLCitation } from '../models/urlcitation.js';
|
|
2
22
|
/**
|
|
3
23
|
* Type guards for OpenResponses stream events
|
|
4
24
|
* These enable proper TypeScript narrowing without type casts
|
|
5
25
|
*/
|
|
6
|
-
export declare function isOutputTextDeltaEvent(event:
|
|
7
|
-
export declare function isReasoningDeltaEvent(event:
|
|
8
|
-
export declare function isFunctionCallArgumentsDeltaEvent(event:
|
|
9
|
-
export declare function isOutputItemAddedEvent(event:
|
|
10
|
-
export declare function isOutputItemDoneEvent(event:
|
|
11
|
-
export declare function isResponseCompletedEvent(event:
|
|
12
|
-
export declare function isResponseFailedEvent(event:
|
|
13
|
-
export declare function isResponseIncompleteEvent(event:
|
|
14
|
-
export declare function isFunctionCallArgumentsDoneEvent(event:
|
|
15
|
-
export declare function isOutputMessage(item: unknown): item is
|
|
16
|
-
export declare function isFunctionCallItem(item: unknown): item is
|
|
17
|
-
export declare function isReasoningOutputItem(item: unknown): item is
|
|
18
|
-
export declare function isWebSearchCallOutputItem(item: unknown): item is
|
|
19
|
-
export declare function isFileSearchCallOutputItem(item: unknown): item is
|
|
20
|
-
export declare function isImageGenerationCallOutputItem(item: unknown): item is
|
|
21
|
-
export declare function isOutputTextPart(part: unknown): part is
|
|
22
|
-
export declare function isRefusalPart(part: unknown): part is
|
|
23
|
-
export declare function isFileCitationAnnotation(annotation: unknown): annotation is
|
|
24
|
-
export declare function isURLCitationAnnotation(annotation: unknown): annotation is
|
|
25
|
-
export declare function isFilePathAnnotation(annotation: unknown): annotation is
|
|
26
|
+
export declare function isOutputTextDeltaEvent(event: StreamEvents): event is TextDeltaEvent;
|
|
27
|
+
export declare function isReasoningDeltaEvent(event: StreamEvents): event is ReasoningDeltaEvent;
|
|
28
|
+
export declare function isFunctionCallArgumentsDeltaEvent(event: StreamEvents): event is FunctionCallArgsDeltaEvent;
|
|
29
|
+
export declare function isOutputItemAddedEvent(event: StreamEvents): event is StreamEventsResponseOutputItemAdded;
|
|
30
|
+
export declare function isOutputItemDoneEvent(event: StreamEvents): event is StreamEventsResponseOutputItemDone;
|
|
31
|
+
export declare function isResponseCompletedEvent(event: StreamEvents): event is StreamEventsResponseCompleted;
|
|
32
|
+
export declare function isResponseFailedEvent(event: StreamEvents): event is StreamEventsResponseFailed;
|
|
33
|
+
export declare function isResponseIncompleteEvent(event: StreamEvents): event is StreamEventsResponseIncomplete;
|
|
34
|
+
export declare function isFunctionCallArgumentsDoneEvent(event: StreamEvents): event is FunctionCallArgsDoneEvent;
|
|
35
|
+
export declare function isOutputMessage(item: unknown): item is OutputMessage;
|
|
36
|
+
export declare function isFunctionCallItem(item: unknown): item is OutputFunctionCallItem;
|
|
37
|
+
export declare function isReasoningOutputItem(item: unknown): item is OutputReasoningItem;
|
|
38
|
+
export declare function isWebSearchCallOutputItem(item: unknown): item is OutputWebSearchCallItem;
|
|
39
|
+
export declare function isFileSearchCallOutputItem(item: unknown): item is OutputFileSearchCallItem;
|
|
40
|
+
export declare function isImageGenerationCallOutputItem(item: unknown): item is OutputImageGenerationCallItem;
|
|
41
|
+
export declare function isOutputTextPart(part: unknown): part is ResponseOutputText;
|
|
42
|
+
export declare function isRefusalPart(part: unknown): part is OpenAIResponsesRefusalContent;
|
|
43
|
+
export declare function isFileCitationAnnotation(annotation: unknown): annotation is FileCitation;
|
|
44
|
+
export declare function isURLCitationAnnotation(annotation: unknown): annotation is URLCitation;
|
|
45
|
+
export declare function isFilePathAnnotation(annotation: unknown): annotation is FilePath;
|
|
26
46
|
export declare function hasTypeProperty(item: unknown): item is {
|
|
27
47
|
type: string;
|
|
28
48
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import type { InputsUnion } from '../models/inputsunion.js';
|
|
2
|
+
import type { OpenResponsesResult } from '../models/openresponsesresult.js';
|
|
3
|
+
import type { ResponsesRequest } from '../models/responsesrequest.js';
|
|
2
4
|
import type { APITool, Tool, ToolExecutionResult } from './tool-types.js';
|
|
3
5
|
/**
|
|
4
6
|
* Options for tool execution
|
|
@@ -10,10 +12,10 @@ export interface ToolExecutionOptions {
|
|
|
10
12
|
* Result of the tool execution loop
|
|
11
13
|
*/
|
|
12
14
|
export interface ToolOrchestrationResult {
|
|
13
|
-
finalResponse:
|
|
14
|
-
allResponses:
|
|
15
|
+
finalResponse: OpenResponsesResult;
|
|
16
|
+
allResponses: OpenResponsesResult[];
|
|
15
17
|
toolExecutionResults: ToolExecutionResult<Tool>[];
|
|
16
|
-
conversationInput:
|
|
18
|
+
conversationInput: InputsUnion;
|
|
17
19
|
}
|
|
18
20
|
/**
|
|
19
21
|
* Execute tool calls and manage multi-turn conversations
|
|
@@ -27,7 +29,7 @@ export interface ToolOrchestrationResult {
|
|
|
27
29
|
* @param options - Execution options
|
|
28
30
|
* @returns Result containing final response and all execution data
|
|
29
31
|
*/
|
|
30
|
-
export declare function executeToolLoop(sendRequest: (input:
|
|
32
|
+
export declare function executeToolLoop(sendRequest: (input: InputsUnion, tools: APITool[]) => Promise<OpenResponsesResult>, initialInput: InputsUnion, initialRequest: ResponsesRequest, tools: Tool[], apiTools: APITool[], options?: ToolExecutionOptions): Promise<ToolOrchestrationResult>;
|
|
31
33
|
/**
|
|
32
34
|
* Convert tool execution results to a map for easy lookup
|
|
33
35
|
*/
|
package/esm/lib/tool-types.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { $ZodObject, $ZodShape, $ZodType, infer as zodInfer } from 'zod/v4/core';
|
|
2
|
-
import type
|
|
3
|
-
import type {
|
|
2
|
+
import type { FunctionCallItem } from '../models/functioncallitem.js';
|
|
3
|
+
import type { FunctionCallOutputItem } from '../models/functioncalloutputitem.js';
|
|
4
|
+
import type { InputsUnion } from '../models/inputsunion.js';
|
|
5
|
+
import type { OpenResponsesResult, Usage } from '../models/openresponsesresult.js';
|
|
6
|
+
import type { ResponsesRequest } from '../models/responsesrequest.js';
|
|
7
|
+
import type { StreamEvents } from '../models/streamevents.js';
|
|
4
8
|
import type { ModelResult } from './model-result.js';
|
|
5
9
|
/**
|
|
6
10
|
* Tool type enum for enhanced tools
|
|
@@ -14,11 +18,11 @@ export declare enum ToolType {
|
|
|
14
18
|
*/
|
|
15
19
|
export interface TurnContext {
|
|
16
20
|
/** The specific tool call being executed (only available during tool execution) */
|
|
17
|
-
toolCall?:
|
|
21
|
+
toolCall?: FunctionCallItem;
|
|
18
22
|
/** Number of tool execution turns so far (1-indexed: first turn = 1, 0 = initial request) */
|
|
19
23
|
numberOfTurns: number;
|
|
20
24
|
/** The full request being sent to the API (only available during tool execution) */
|
|
21
|
-
turnRequest?:
|
|
25
|
+
turnRequest?: ResponsesRequest;
|
|
22
26
|
}
|
|
23
27
|
/**
|
|
24
28
|
* Extract context schema type from a tool definition
|
|
@@ -83,7 +87,7 @@ export declare const SHARED_CONTEXT_KEY: "shared";
|
|
|
83
87
|
*/
|
|
84
88
|
export type NextTurnParamsContext = {
|
|
85
89
|
/** Current input (messages) */
|
|
86
|
-
input:
|
|
90
|
+
input: InputsUnion;
|
|
87
91
|
/** Current model selection */
|
|
88
92
|
model: string;
|
|
89
93
|
/** Current models array */
|
|
@@ -315,8 +319,8 @@ export interface StepResult<TTools extends readonly Tool[] = readonly Tool[]> {
|
|
|
315
319
|
readonly text: string;
|
|
316
320
|
readonly toolCalls: TypedToolCallUnion<TTools>[];
|
|
317
321
|
readonly toolResults: ToolExecutionResultUnion<TTools>[];
|
|
318
|
-
readonly response:
|
|
319
|
-
readonly usage?:
|
|
322
|
+
readonly response: OpenResponsesResult;
|
|
323
|
+
readonly usage?: Usage | null | undefined;
|
|
320
324
|
readonly finishReason?: string | undefined;
|
|
321
325
|
readonly warnings?: Warning[] | undefined;
|
|
322
326
|
readonly experimental_providerMetadata?: Record<string, unknown> | undefined;
|
|
@@ -388,7 +392,7 @@ export type ToolResultEvent<TResult = unknown, TPreliminaryResults = unknown> =
|
|
|
388
392
|
*/
|
|
389
393
|
export type ToolCallOutputEvent = {
|
|
390
394
|
type: 'tool.call_output';
|
|
391
|
-
output:
|
|
395
|
+
output: FunctionCallOutputItem;
|
|
392
396
|
timestamp: number;
|
|
393
397
|
};
|
|
394
398
|
/**
|
|
@@ -459,7 +463,7 @@ export type ChatStreamEvent<TEvent = unknown> = {
|
|
|
459
463
|
delta: string;
|
|
460
464
|
} | {
|
|
461
465
|
type: 'message.complete';
|
|
462
|
-
response:
|
|
466
|
+
response: OpenResponsesResult;
|
|
463
467
|
} | {
|
|
464
468
|
type: 'tool.preliminary_result';
|
|
465
469
|
toolCallId: string;
|
|
@@ -505,7 +509,7 @@ export interface ConversationState<TTools extends readonly Tool[] = readonly Too
|
|
|
505
509
|
/** Unique identifier for this conversation */
|
|
506
510
|
id: string;
|
|
507
511
|
/** Full message history */
|
|
508
|
-
messages:
|
|
512
|
+
messages: InputsUnion;
|
|
509
513
|
/** Previous response ID for chaining (OpenRouter server-side optimization) */
|
|
510
514
|
previousResponseId?: string;
|
|
511
515
|
/** Tool calls awaiting human approval */
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { FunctionCallItem } from '../models/functioncallitem.js';
|
|
2
|
+
import type { InputsUnion, InputsUnion1 } from '../models/inputsunion.js';
|
|
3
|
+
import type { ResponsesRequest } from '../models/responsesrequest.js';
|
|
2
4
|
import type { TurnContext } from './tool-types.js';
|
|
3
5
|
/**
|
|
4
6
|
* Options for building a turn context
|
|
@@ -7,9 +9,9 @@ export interface BuildTurnContextOptions {
|
|
|
7
9
|
/** Number of turns so far (1-indexed for tool execution, 0 for initial request) */
|
|
8
10
|
numberOfTurns: number;
|
|
9
11
|
/** The specific tool call being executed (optional for initial/async resolution contexts) */
|
|
10
|
-
toolCall?:
|
|
12
|
+
toolCall?: FunctionCallItem;
|
|
11
13
|
/** The full request being sent to the API (optional for initial/async resolution contexts) */
|
|
12
|
-
turnRequest?:
|
|
14
|
+
turnRequest?: ResponsesRequest;
|
|
13
15
|
}
|
|
14
16
|
/**
|
|
15
17
|
* Build a turn context for tool execution or async parameter resolution
|
|
@@ -46,5 +48,5 @@ export declare function buildTurnContext(options: BuildTurnContextOptions): Turn
|
|
|
46
48
|
* // Returns: [{ role: "user", content: "Hello!" }]
|
|
47
49
|
* ```
|
|
48
50
|
*/
|
|
49
|
-
export declare function normalizeInputToArray(input:
|
|
51
|
+
export declare function normalizeInputToArray(input: InputsUnion): Array<InputsUnion1>;
|
|
50
52
|
//# sourceMappingURL=turn-context.d.ts.map
|
package/esm/lib/turn-context.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { EasyInputMessageRoleUser } from '../models/easyinputmessage.js';
|
|
2
2
|
/**
|
|
3
3
|
* Build a turn context for tool execution or async parameter resolution
|
|
4
4
|
*
|
|
@@ -49,7 +49,7 @@ export function normalizeInputToArray(input) {
|
|
|
49
49
|
if (typeof input === 'string') {
|
|
50
50
|
// Construct object with all required fields - type is optional
|
|
51
51
|
const message = {
|
|
52
|
-
role:
|
|
52
|
+
role: EasyInputMessageRoleUser.User,
|
|
53
53
|
content: input,
|
|
54
54
|
};
|
|
55
55
|
return [message];
|