@axlsdk/axl 0.22.0 → 0.22.1
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 +7 -5
- package/dist/index.cjs +14 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -11
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1055,13 +1055,12 @@ function unsafeTransportError(surface, remediation, exposedData) {
|
|
|
1055
1055
|
}
|
|
1056
1056
|
|
|
1057
1057
|
// src/providers/openai-compatible.ts
|
|
1058
|
-
var OPENROUTER_IMAGE_MODEL = "openai/gpt-4o-mini";
|
|
1059
1058
|
function compatibleImageBase64(source) {
|
|
1060
1059
|
return source.type === "base64" ? source.data : Buffer.from(source.data.buffer, source.data.byteOffset, source.data.byteLength).toString(
|
|
1061
1060
|
"base64"
|
|
1062
1061
|
);
|
|
1063
1062
|
}
|
|
1064
|
-
function openRouterImageParts(parts) {
|
|
1063
|
+
function openRouterImageParts(parts, model) {
|
|
1065
1064
|
const content = [];
|
|
1066
1065
|
for (const part of parts) {
|
|
1067
1066
|
if (part.type === "text") {
|
|
@@ -1072,7 +1071,7 @@ function openRouterImageParts(parts) {
|
|
|
1072
1071
|
if (source.type === "provider-file") {
|
|
1073
1072
|
throw new UnsupportedModelInputError({
|
|
1074
1073
|
provider: "openrouter",
|
|
1075
|
-
model
|
|
1074
|
+
model,
|
|
1076
1075
|
modality: "image",
|
|
1077
1076
|
source: "provider-file"
|
|
1078
1077
|
});
|
|
@@ -1203,7 +1202,7 @@ function normalizeMessageContent(content) {
|
|
|
1203
1202
|
var OpenAICompatibleProvider = class {
|
|
1204
1203
|
name;
|
|
1205
1204
|
inputCapabilities(model) {
|
|
1206
|
-
return this.name === "openrouter" && model
|
|
1205
|
+
return this.name === "openrouter" && model.trim().length > 0 ? { image: { sources: ["url", "bytes", "base64"] } } : {};
|
|
1207
1206
|
}
|
|
1208
1207
|
validateInput(request) {
|
|
1209
1208
|
const effectiveModel = typeof request.providerOptions?.model === "string" ? request.providerOptions.model : request.model;
|
|
@@ -1216,13 +1215,12 @@ var OpenAICompatibleProvider = class {
|
|
|
1216
1215
|
...feature ? { feature } : {}
|
|
1217
1216
|
});
|
|
1218
1217
|
};
|
|
1219
|
-
if (this.name !== "openrouter" || effectiveModel
|
|
1218
|
+
if (this.name !== "openrouter" || effectiveModel.trim().length === 0) {
|
|
1220
1219
|
fail(void 0, "image input for this model");
|
|
1221
1220
|
}
|
|
1222
1221
|
if (request.providerOptions && "messages" in request.providerOptions) {
|
|
1223
1222
|
fail(void 0, "raw messages providerOptions");
|
|
1224
1223
|
}
|
|
1225
|
-
if (request.hasTools) fail(void 0, "tools with image input");
|
|
1226
1224
|
for (const message of request.history) {
|
|
1227
1225
|
if (!Array.isArray(message.content)) continue;
|
|
1228
1226
|
if (message.role !== "user") fail(void 0, "rich non-user history");
|
|
@@ -1410,7 +1408,7 @@ var OpenAICompatibleProvider = class {
|
|
|
1410
1408
|
formatMessage(msg, model) {
|
|
1411
1409
|
const out = {
|
|
1412
1410
|
role: this.profile.roleFor ? this.profile.roleFor(msg.role, model) : msg.role,
|
|
1413
|
-
content: Array.isArray(msg.content) && this.name === "openrouter"
|
|
1411
|
+
content: Array.isArray(msg.content) && this.name === "openrouter" ? openRouterImageParts(msg.content, model) : msg.content
|
|
1414
1412
|
};
|
|
1415
1413
|
if (msg.name && (this.profile.capabilities?.emitsMessageName ?? true)) out.name = msg.name;
|
|
1416
1414
|
if (msg.tool_calls) out.tool_calls = msg.tool_calls;
|
|
@@ -5561,7 +5559,6 @@ function normalizeTranscriptionAccounting(usageValue, pricingValue) {
|
|
|
5561
5559
|
// src/providers/transcription-utils.ts
|
|
5562
5560
|
var OPENAI_TRANSCRIPTION_MODEL = "gpt-transcribe";
|
|
5563
5561
|
var GEMINI_TRANSCRIPTION_MODEL = "gemini-3.5-transcribe";
|
|
5564
|
-
var OPENROUTER_TRANSCRIPTION_MODEL = "openai/whisper-1";
|
|
5565
5562
|
function requireExactTranscriptionModel(provider, model, expected) {
|
|
5566
5563
|
if (model !== expected) {
|
|
5567
5564
|
throw new UnsupportedTranscriptionInputError({
|
|
@@ -6212,10 +6209,16 @@ var OpenRouterTranscriptionProvider = class {
|
|
|
6212
6209
|
this.governor = options.rateLimit ? new RateLimiter(options.rateLimit) : void 0;
|
|
6213
6210
|
}
|
|
6214
6211
|
capabilities(model) {
|
|
6215
|
-
return model
|
|
6212
|
+
return model.trim().length > 0 ? { sources: ["bytes", "base64"] } : void 0;
|
|
6216
6213
|
}
|
|
6217
6214
|
async transcribe(request) {
|
|
6218
|
-
|
|
6215
|
+
if (request.model.trim().length === 0) {
|
|
6216
|
+
throw new UnsupportedTranscriptionInputError({
|
|
6217
|
+
provider: this.name,
|
|
6218
|
+
model: request.model,
|
|
6219
|
+
feature: "this transcription model"
|
|
6220
|
+
});
|
|
6221
|
+
}
|
|
6219
6222
|
requireNoProviderFile(request.audio, this.name, request.model);
|
|
6220
6223
|
if (request.audio.type === "provider-file")
|
|
6221
6224
|
throw new UnsupportedTranscriptionInputError({
|
|
@@ -6355,7 +6358,7 @@ var TranscriptionProviderRegistry = class {
|
|
|
6355
6358
|
}
|
|
6356
6359
|
resolve(uri, config = {}) {
|
|
6357
6360
|
const colon = typeof uri === "string" ? uri.indexOf(":") : -1;
|
|
6358
|
-
if (colon <= 0 || colon === uri.length - 1
|
|
6361
|
+
if (colon <= 0 || colon === uri.length - 1) {
|
|
6359
6362
|
throw new UnsupportedTranscriptionInputError({
|
|
6360
6363
|
provider: "unknown",
|
|
6361
6364
|
model: "",
|