@warlock.js/ai-openai 4.1.7 → 4.1.8
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/cjs/index.cjs +8 -8
- package/esm/config.type.d.mts +1 -1
- package/esm/embedder.d.mts +1 -1
- package/esm/embedder.mjs +1 -1
- package/esm/known-vision-models.mjs +1 -1
- package/esm/model.mjs +1 -1
- package/esm/sdk.d.mts +1 -1
- package/esm/sdk.mjs +1 -1
- package/esm/utils/map-finish-reason.mjs +1 -1
- package/esm/utils/to-openai-messages.mjs +1 -1
- package/esm/utils/to-openai-tools.mjs +1 -1
- package/esm/utils/wrap-openai-error.mjs +1 -1
- package/package.json +3 -3
package/cjs/index.cjs
CHANGED
|
@@ -31,7 +31,7 @@ openai = __toESM(openai, 1);
|
|
|
31
31
|
let _warlock_js_ai = require("@warlock.js/ai");
|
|
32
32
|
let _warlock_js_logger = require("@warlock.js/logger");
|
|
33
33
|
|
|
34
|
-
//#region
|
|
34
|
+
//#region ../@warlock.js/ai-openai/src/utils/map-finish-reason.ts
|
|
35
35
|
const finishReasonMap = {
|
|
36
36
|
stop: "stop",
|
|
37
37
|
tool_calls: "tool_calls",
|
|
@@ -51,7 +51,7 @@ function mapFinishReason(raw) {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
//#endregion
|
|
54
|
-
//#region
|
|
54
|
+
//#region ../@warlock.js/ai-openai/src/utils/to-openai-messages.ts
|
|
55
55
|
/**
|
|
56
56
|
* Convert vendor-neutral Message[] to OpenAI's chat message shape.
|
|
57
57
|
* Handles the `tool` role (requires `tool_call_id`) and assistant messages
|
|
@@ -127,7 +127,7 @@ function toOpenAIContentPart(part) {
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
//#endregion
|
|
130
|
-
//#region
|
|
130
|
+
//#region ../@warlock.js/ai-openai/src/utils/to-openai-tools.ts
|
|
131
131
|
/**
|
|
132
132
|
* Convert vendor-neutral ToolConfig[] to OpenAI's tools array.
|
|
133
133
|
* Uses the shared `extractJsonSchema` helper; falls back to an empty-object
|
|
@@ -164,7 +164,7 @@ function toParameters(input) {
|
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
//#endregion
|
|
167
|
-
//#region
|
|
167
|
+
//#region ../@warlock.js/ai-openai/src/utils/wrap-openai-error.ts
|
|
168
168
|
/**
|
|
169
169
|
* Wrap any thrown value caught inside the OpenAI adapter into the
|
|
170
170
|
* appropriate `@warlock.js/ai` `AIError` subclass.
|
|
@@ -306,7 +306,7 @@ function parseRetryAfter(headers) {
|
|
|
306
306
|
}
|
|
307
307
|
|
|
308
308
|
//#endregion
|
|
309
|
-
//#region
|
|
309
|
+
//#region ../@warlock.js/ai-openai/src/embedder.ts
|
|
310
310
|
const LOG_MODULE$1 = "ai.openai";
|
|
311
311
|
/**
|
|
312
312
|
* OpenAI-backed implementation of `EmbedderContract`.
|
|
@@ -405,7 +405,7 @@ var OpenAIEmbedder = class {
|
|
|
405
405
|
};
|
|
406
406
|
|
|
407
407
|
//#endregion
|
|
408
|
-
//#region
|
|
408
|
+
//#region ../@warlock.js/ai-openai/src/known-vision-models.ts
|
|
409
409
|
/**
|
|
410
410
|
* Model-name prefixes for OpenAI families that support vision input
|
|
411
411
|
* (image attachments) on the Chat Completions API.
|
|
@@ -445,7 +445,7 @@ function inferVisionCapability(modelName) {
|
|
|
445
445
|
}
|
|
446
446
|
|
|
447
447
|
//#endregion
|
|
448
|
-
//#region
|
|
448
|
+
//#region ../@warlock.js/ai-openai/src/model.ts
|
|
449
449
|
const LOG_MODULE = "ai.openai";
|
|
450
450
|
/**
|
|
451
451
|
* Map an explicit `responseFormat` override to the default
|
|
@@ -743,7 +743,7 @@ var OpenAIModel = class {
|
|
|
743
743
|
};
|
|
744
744
|
|
|
745
745
|
//#endregion
|
|
746
|
-
//#region
|
|
746
|
+
//#region ../@warlock.js/ai-openai/src/sdk.ts
|
|
747
747
|
/**
|
|
748
748
|
* OpenAI-backed implementation of `SDKAdapterContract`.
|
|
749
749
|
*
|
package/esm/config.type.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ClientOptions } from "openai";
|
|
2
2
|
import { EmbedderConfig, ModelConfig, ModelPricing } from "@warlock.js/ai";
|
|
3
3
|
|
|
4
|
-
//#region
|
|
4
|
+
//#region ../@warlock.js/ai-openai/src/config.type.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Configuration for the OpenAI SDK adapter.
|
|
7
7
|
*
|
package/esm/embedder.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import { OpenAIEmbedderConfig } from "./config.type.mjs";
|
|
|
2
2
|
import OpenAI from "openai";
|
|
3
3
|
import { EmbedderContract, EmbeddingBatchResult, EmbeddingResult } from "@warlock.js/ai";
|
|
4
4
|
|
|
5
|
-
//#region
|
|
5
|
+
//#region ../@warlock.js/ai-openai/src/embedder.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* OpenAI-backed implementation of `EmbedderContract`.
|
|
8
8
|
*
|
package/esm/embedder.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { wrapOpenAIError } from "./utils/wrap-openai-error.mjs";
|
|
|
2
2
|
import "./utils/index.mjs";
|
|
3
3
|
import { log } from "@warlock.js/logger";
|
|
4
4
|
|
|
5
|
-
//#region
|
|
5
|
+
//#region ../@warlock.js/ai-openai/src/embedder.ts
|
|
6
6
|
const LOG_MODULE = "ai.openai";
|
|
7
7
|
/**
|
|
8
8
|
* OpenAI-backed implementation of `EmbedderContract`.
|
package/esm/model.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { inferVisionCapability } from "./known-vision-models.mjs";
|
|
|
7
7
|
import { safeJsonParse } from "@warlock.js/ai";
|
|
8
8
|
import { log } from "@warlock.js/logger";
|
|
9
9
|
|
|
10
|
-
//#region
|
|
10
|
+
//#region ../@warlock.js/ai-openai/src/model.ts
|
|
11
11
|
const LOG_MODULE = "ai.openai";
|
|
12
12
|
/**
|
|
13
13
|
* Map an explicit `responseFormat` override to the default
|
package/esm/sdk.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenAIEmbedderConfig, OpenAIModelConfig, OpenAISDKConfig } from "./config.type.mjs";
|
|
2
2
|
import { EmbedderContract, ModelContract, SDKAdapterContract } from "@warlock.js/ai";
|
|
3
3
|
|
|
4
|
-
//#region
|
|
4
|
+
//#region ../@warlock.js/ai-openai/src/sdk.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* OpenAI-backed implementation of `SDKAdapterContract`.
|
|
7
7
|
*
|
package/esm/sdk.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { OpenAIModel } from "./model.mjs";
|
|
|
3
3
|
import OpenAI from "openai";
|
|
4
4
|
import { approximateTokenCount } from "@warlock.js/ai";
|
|
5
5
|
|
|
6
|
-
//#region
|
|
6
|
+
//#region ../@warlock.js/ai-openai/src/sdk.ts
|
|
7
7
|
/**
|
|
8
8
|
* OpenAI-backed implementation of `SDKAdapterContract`.
|
|
9
9
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region
|
|
1
|
+
//#region ../@warlock.js/ai-openai/src/utils/to-openai-messages.ts
|
|
2
2
|
/**
|
|
3
3
|
* Convert vendor-neutral Message[] to OpenAI's chat message shape.
|
|
4
4
|
* Handles the `tool` role (requires `tool_call_id`) and assistant messages
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { extractJsonSchema } from "@warlock.js/ai";
|
|
2
2
|
|
|
3
|
-
//#region
|
|
3
|
+
//#region ../@warlock.js/ai-openai/src/utils/to-openai-tools.ts
|
|
4
4
|
/**
|
|
5
5
|
* Convert vendor-neutral ToolConfig[] to OpenAI's tools array.
|
|
6
6
|
* Uses the shared `extractJsonSchema` helper; falls back to an empty-object
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import OpenAI from "openai";
|
|
2
2
|
import { AIError, ContentFilterError, ContextLengthExceededError, InvalidRequestError, ProviderAuthError, ProviderError, ProviderRateLimitError, ProviderTimeoutError, QuotaExceededError } from "@warlock.js/ai";
|
|
3
3
|
|
|
4
|
-
//#region
|
|
4
|
+
//#region ../@warlock.js/ai-openai/src/utils/wrap-openai-error.ts
|
|
5
5
|
/**
|
|
6
6
|
* Wrap any thrown value caught inside the OpenAI adapter into the
|
|
7
7
|
* appropriate `@warlock.js/ai` `AIError` subclass.
|
package/package.json
CHANGED
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"openai": "^6.34.0",
|
|
17
|
-
"@warlock.js/logger": "
|
|
17
|
+
"@warlock.js/logger": "*"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"@warlock.js/ai": "
|
|
20
|
+
"@warlock.js/ai": "*"
|
|
21
21
|
},
|
|
22
|
-
"version": "4.1.
|
|
22
|
+
"version": "4.1.8",
|
|
23
23
|
"main": "./cjs/index.cjs",
|
|
24
24
|
"module": "./esm/index.mjs",
|
|
25
25
|
"types": "./esm/index.d.mts",
|