@visibe.ai/node 0.1.23 → 0.1.24
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/dist/cjs/client.js +13 -4
- package/dist/esm/client.js +13 -4
- package/package.json +1 -1
package/dist/cjs/client.js
CHANGED
|
@@ -224,19 +224,28 @@ function applyIntegration(client, name, visibe) {
|
|
|
224
224
|
// Integrations are loaded lazily to avoid import errors when the peer
|
|
225
225
|
// dependency is not installed. Each integration module exports a
|
|
226
226
|
// `patchClient(client, name, visibe)` that returns a restore function.
|
|
227
|
-
|
|
227
|
+
// Walk the prototype chain to collect all ancestor class names.
|
|
228
|
+
// This handles subclasses (including our own PatchedOpenAI wrapper) without
|
|
229
|
+
// requiring the direct constructor to have a specific name.
|
|
230
|
+
const ancestorNames = new Set();
|
|
231
|
+
let ctor = client?.constructor;
|
|
232
|
+
while (ctor && ctor.name) {
|
|
233
|
+
ancestorNames.add(ctor.name);
|
|
234
|
+
ctor = Object.getPrototypeOf(ctor);
|
|
235
|
+
}
|
|
236
|
+
const has = (name) => ancestorNames.has(name);
|
|
228
237
|
try {
|
|
229
|
-
if (
|
|
238
|
+
if (has('OpenAI')) {
|
|
230
239
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
231
240
|
const { patchOpenAIClient } = require('./integrations/openai');
|
|
232
241
|
return patchOpenAIClient(client, name, visibe);
|
|
233
242
|
}
|
|
234
|
-
if (
|
|
243
|
+
if (has('Anthropic')) {
|
|
235
244
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
236
245
|
const { patchAnthropicClient } = require('./integrations/anthropic');
|
|
237
246
|
return patchAnthropicClient(client, name, visibe);
|
|
238
247
|
}
|
|
239
|
-
if (
|
|
248
|
+
if (has('BedrockRuntimeClient')) {
|
|
240
249
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
241
250
|
const { patchBedrockClient } = require('./integrations/bedrock');
|
|
242
251
|
return patchBedrockClient(client, name, visibe);
|
package/dist/esm/client.js
CHANGED
|
@@ -220,19 +220,28 @@ function applyIntegration(client, name, visibe) {
|
|
|
220
220
|
// Integrations are loaded lazily to avoid import errors when the peer
|
|
221
221
|
// dependency is not installed. Each integration module exports a
|
|
222
222
|
// `patchClient(client, name, visibe)` that returns a restore function.
|
|
223
|
-
|
|
223
|
+
// Walk the prototype chain to collect all ancestor class names.
|
|
224
|
+
// This handles subclasses (including our own PatchedOpenAI wrapper) without
|
|
225
|
+
// requiring the direct constructor to have a specific name.
|
|
226
|
+
const ancestorNames = new Set();
|
|
227
|
+
let ctor = client?.constructor;
|
|
228
|
+
while (ctor && ctor.name) {
|
|
229
|
+
ancestorNames.add(ctor.name);
|
|
230
|
+
ctor = Object.getPrototypeOf(ctor);
|
|
231
|
+
}
|
|
232
|
+
const has = (name) => ancestorNames.has(name);
|
|
224
233
|
try {
|
|
225
|
-
if (
|
|
234
|
+
if (has('OpenAI')) {
|
|
226
235
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
227
236
|
const { patchOpenAIClient } = require('./integrations/openai');
|
|
228
237
|
return patchOpenAIClient(client, name, visibe);
|
|
229
238
|
}
|
|
230
|
-
if (
|
|
239
|
+
if (has('Anthropic')) {
|
|
231
240
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
232
241
|
const { patchAnthropicClient } = require('./integrations/anthropic');
|
|
233
242
|
return patchAnthropicClient(client, name, visibe);
|
|
234
243
|
}
|
|
235
|
-
if (
|
|
244
|
+
if (has('BedrockRuntimeClient')) {
|
|
236
245
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
237
246
|
const { patchBedrockClient } = require('./integrations/bedrock');
|
|
238
247
|
return patchBedrockClient(client, name, visibe);
|
package/package.json
CHANGED