@posthog/ai 7.9.0 → 7.9.2
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/anthropic/index.cjs +1 -1
- package/dist/anthropic/index.mjs +1 -1
- package/dist/gemini/index.cjs +1 -1
- package/dist/gemini/index.mjs +1 -1
- package/dist/index.cjs +13 -97
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +13 -97
- package/dist/index.mjs.map +1 -1
- package/dist/langchain/index.cjs +13 -97
- package/dist/langchain/index.cjs.map +1 -1
- package/dist/langchain/index.mjs +13 -97
- package/dist/langchain/index.mjs.map +1 -1
- package/dist/openai/index.cjs +1 -1
- package/dist/openai/index.mjs +1 -1
- package/dist/otel/index.cjs +1 -1
- package/dist/otel/index.mjs +1 -1
- package/dist/vercel/index.cjs +1 -1
- package/dist/vercel/index.mjs +1 -1
- package/package.json +7 -7
package/dist/anthropic/index.cjs
CHANGED
|
@@ -10,7 +10,7 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
10
10
|
|
|
11
11
|
var AnthropicOriginal__default = /*#__PURE__*/_interopDefault(AnthropicOriginal);
|
|
12
12
|
|
|
13
|
-
var version = "7.9.
|
|
13
|
+
var version = "7.9.2";
|
|
14
14
|
|
|
15
15
|
// Type guards for safer type checking
|
|
16
16
|
|
package/dist/anthropic/index.mjs
CHANGED
package/dist/gemini/index.cjs
CHANGED
package/dist/gemini/index.mjs
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -29,7 +29,7 @@ function _interopNamespace(e) {
|
|
|
29
29
|
var uuid__namespace = /*#__PURE__*/_interopNamespace(uuid);
|
|
30
30
|
var AnthropicOriginal__default = /*#__PURE__*/_interopDefault(AnthropicOriginal);
|
|
31
31
|
|
|
32
|
-
var version = "7.9.
|
|
32
|
+
var version = "7.9.2";
|
|
33
33
|
|
|
34
34
|
// Type guards for safer type checking
|
|
35
35
|
const isString = value => {
|
|
@@ -4107,15 +4107,6 @@ function calculateGoogleWebSearchCount(response) {
|
|
|
4107
4107
|
return hasGrounding ? 1 : 0;
|
|
4108
4108
|
}
|
|
4109
4109
|
|
|
4110
|
-
//#region rolldown:runtime
|
|
4111
|
-
var __defProp = Object.defineProperty;
|
|
4112
|
-
var __export = (target, all) => {
|
|
4113
|
-
for (var name in all) __defProp(target, name, {
|
|
4114
|
-
get: all[name],
|
|
4115
|
-
enumerable: true
|
|
4116
|
-
});
|
|
4117
|
-
};
|
|
4118
|
-
|
|
4119
4110
|
function getDefaultExportFromCjs (x) {
|
|
4120
4111
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
4121
4112
|
}
|
|
@@ -4359,12 +4350,6 @@ function escapeIfNeeded(value, pathSet = /* @__PURE__ */ new WeakSet()) {
|
|
|
4359
4350
|
return value;
|
|
4360
4351
|
}
|
|
4361
4352
|
|
|
4362
|
-
//#region src/load/serializable.ts
|
|
4363
|
-
var serializable_exports = {};
|
|
4364
|
-
__export(serializable_exports, {
|
|
4365
|
-
Serializable: () => Serializable,
|
|
4366
|
-
get_lc_unique_name: () => get_lc_unique_name
|
|
4367
|
-
});
|
|
4368
4353
|
function shallowCopy(obj) {
|
|
4369
4354
|
return Array.isArray(obj) ? [...obj] : { ...obj };
|
|
4370
4355
|
}
|
|
@@ -4392,8 +4377,7 @@ function replaceSecrets(root, secretsMap) {
|
|
|
4392
4377
|
*/
|
|
4393
4378
|
function get_lc_unique_name(serializableClass) {
|
|
4394
4379
|
const parentClass = Object.getPrototypeOf(serializableClass);
|
|
4395
|
-
|
|
4396
|
-
if (lcNameIsSubclassed) return serializableClass.lc_name();
|
|
4380
|
+
if (typeof serializableClass.lc_name === "function" && (typeof parentClass.lc_name !== "function" || serializableClass.lc_name() !== parentClass.lc_name())) return serializableClass.lc_name();
|
|
4397
4381
|
else return serializableClass.name;
|
|
4398
4382
|
}
|
|
4399
4383
|
var Serializable = class Serializable {
|
|
@@ -4419,34 +4403,26 @@ var Serializable = class Serializable {
|
|
|
4419
4403
|
* Keys are paths to the secret in constructor args, e.g. "foo.bar.baz".
|
|
4420
4404
|
* Values are the secret ids, which will be used when deserializing.
|
|
4421
4405
|
*/
|
|
4422
|
-
get lc_secrets() {
|
|
4423
|
-
return void 0;
|
|
4424
|
-
}
|
|
4406
|
+
get lc_secrets() {}
|
|
4425
4407
|
/**
|
|
4426
4408
|
* A map of additional attributes to merge with constructor args.
|
|
4427
4409
|
* Keys are the attribute names, e.g. "foo".
|
|
4428
4410
|
* Values are the attribute values, which will be serialized.
|
|
4429
4411
|
* These attributes need to be accepted by the constructor as arguments.
|
|
4430
4412
|
*/
|
|
4431
|
-
get lc_attributes() {
|
|
4432
|
-
return void 0;
|
|
4433
|
-
}
|
|
4413
|
+
get lc_attributes() {}
|
|
4434
4414
|
/**
|
|
4435
4415
|
* A map of aliases for constructor args.
|
|
4436
4416
|
* Keys are the attribute names, e.g. "foo".
|
|
4437
4417
|
* Values are the alias that will replace the key in serialization.
|
|
4438
4418
|
* This is used to eg. make argument names match Python.
|
|
4439
4419
|
*/
|
|
4440
|
-
get lc_aliases() {
|
|
4441
|
-
return void 0;
|
|
4442
|
-
}
|
|
4420
|
+
get lc_aliases() {}
|
|
4443
4421
|
/**
|
|
4444
4422
|
* A manual list of keys that should be serialized.
|
|
4445
4423
|
* If not overridden, all fields passed into the constructor will be serialized.
|
|
4446
4424
|
*/
|
|
4447
|
-
get lc_serializable_keys() {
|
|
4448
|
-
return void 0;
|
|
4449
|
-
}
|
|
4425
|
+
get lc_serializable_keys() {}
|
|
4450
4426
|
constructor(kwargs, ..._args) {
|
|
4451
4427
|
if (this.lc_serializable_keys !== void 0) this.lc_kwargs = Object.fromEntries(Object.entries(kwargs || {}).filter(([key]) => this.lc_serializable_keys?.includes(key)));
|
|
4452
4428
|
else this.lc_kwargs = kwargs ?? {};
|
|
@@ -4484,8 +4460,7 @@ var Serializable = class Serializable {
|
|
|
4484
4460
|
const pathSet = /* @__PURE__ */ new WeakSet();
|
|
4485
4461
|
pathSet.add(this);
|
|
4486
4462
|
for (const [key, value] of Object.entries(kwargs)) escapedKwargs[key] = escapeIfNeeded(value, pathSet);
|
|
4487
|
-
const
|
|
4488
|
-
const processedKwargs = mapKeys(kwargsWithSecrets, keyToJson, aliases);
|
|
4463
|
+
const processedKwargs = mapKeys(Object.keys(secrets).length ? replaceSecrets(escapedKwargs, secrets) : escapedKwargs, keyToJson, aliases);
|
|
4489
4464
|
return {
|
|
4490
4465
|
lc: 1,
|
|
4491
4466
|
type: "constructor",
|
|
@@ -4502,70 +4477,23 @@ var Serializable = class Serializable {
|
|
|
4502
4477
|
}
|
|
4503
4478
|
};
|
|
4504
4479
|
|
|
4505
|
-
//#region src/utils/env.ts
|
|
4506
|
-
var env_exports = {};
|
|
4507
|
-
__export(env_exports, {
|
|
4508
|
-
getEnv: () => getEnv,
|
|
4509
|
-
getEnvironmentVariable: () => getEnvironmentVariable,
|
|
4510
|
-
getRuntimeEnvironment: () => getRuntimeEnvironment,
|
|
4511
|
-
isBrowser: () => isBrowser,
|
|
4512
|
-
isDeno: () => isDeno,
|
|
4513
|
-
isJsDom: () => isJsDom,
|
|
4514
|
-
isNode: () => isNode,
|
|
4515
|
-
isWebWorker: () => isWebWorker
|
|
4516
|
-
});
|
|
4517
|
-
const isBrowser = () => typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
4518
|
-
const isWebWorker = () => typeof globalThis === "object" && globalThis.constructor && globalThis.constructor.name === "DedicatedWorkerGlobalScope";
|
|
4519
|
-
const isJsDom = () => typeof window !== "undefined" && window.name === "nodejs" || typeof navigator !== "undefined" && navigator.userAgent.includes("jsdom");
|
|
4520
4480
|
const isDeno = () => typeof Deno !== "undefined";
|
|
4521
|
-
const isNode = () => typeof process !== "undefined" && typeof process.versions !== "undefined" && typeof process.versions.node !== "undefined" && !isDeno();
|
|
4522
|
-
const getEnv = () => {
|
|
4523
|
-
let env;
|
|
4524
|
-
if (isBrowser()) env = "browser";
|
|
4525
|
-
else if (isNode()) env = "node";
|
|
4526
|
-
else if (isWebWorker()) env = "webworker";
|
|
4527
|
-
else if (isJsDom()) env = "jsdom";
|
|
4528
|
-
else if (isDeno()) env = "deno";
|
|
4529
|
-
else env = "other";
|
|
4530
|
-
return env;
|
|
4531
|
-
};
|
|
4532
|
-
let runtimeEnvironment;
|
|
4533
|
-
function getRuntimeEnvironment() {
|
|
4534
|
-
if (runtimeEnvironment === void 0) {
|
|
4535
|
-
const env = getEnv();
|
|
4536
|
-
runtimeEnvironment = {
|
|
4537
|
-
library: "langchain-js",
|
|
4538
|
-
runtime: env
|
|
4539
|
-
};
|
|
4540
|
-
}
|
|
4541
|
-
return runtimeEnvironment;
|
|
4542
|
-
}
|
|
4543
4481
|
function getEnvironmentVariable(name) {
|
|
4544
4482
|
try {
|
|
4545
4483
|
if (typeof process !== "undefined") return process.env?.[name];
|
|
4546
4484
|
else if (isDeno()) return Deno?.env.get(name);
|
|
4547
|
-
else return
|
|
4485
|
+
else return;
|
|
4548
4486
|
} catch {
|
|
4549
|
-
return
|
|
4487
|
+
return;
|
|
4550
4488
|
}
|
|
4551
4489
|
}
|
|
4552
4490
|
|
|
4553
|
-
//#region src/callbacks/base.ts
|
|
4554
|
-
var base_exports = {};
|
|
4555
|
-
__export(base_exports, {
|
|
4556
|
-
BaseCallbackHandler: () => BaseCallbackHandler,
|
|
4557
|
-
callbackHandlerPrefersStreaming: () => callbackHandlerPrefersStreaming,
|
|
4558
|
-
isBaseCallbackHandler: () => isBaseCallbackHandler
|
|
4559
|
-
});
|
|
4560
4491
|
/**
|
|
4561
4492
|
* Abstract class that provides a set of optional methods that can be
|
|
4562
4493
|
* overridden in derived classes to handle various events during the
|
|
4563
4494
|
* execution of a LangChain application.
|
|
4564
4495
|
*/
|
|
4565
4496
|
var BaseCallbackHandlerMethodsClass = class {};
|
|
4566
|
-
function callbackHandlerPrefersStreaming(x) {
|
|
4567
|
-
return "lc_prefer_streaming" in x && x.lc_prefer_streaming;
|
|
4568
|
-
}
|
|
4569
4497
|
/**
|
|
4570
4498
|
* Abstract base class for creating callback handlers in the LangChain
|
|
4571
4499
|
* framework. It provides a set of optional methods that can be overridden
|
|
@@ -4581,18 +4509,10 @@ var BaseCallbackHandler = class extends BaseCallbackHandlerMethodsClass {
|
|
|
4581
4509
|
this.name
|
|
4582
4510
|
];
|
|
4583
4511
|
}
|
|
4584
|
-
get lc_secrets() {
|
|
4585
|
-
|
|
4586
|
-
}
|
|
4587
|
-
get
|
|
4588
|
-
return void 0;
|
|
4589
|
-
}
|
|
4590
|
-
get lc_aliases() {
|
|
4591
|
-
return void 0;
|
|
4592
|
-
}
|
|
4593
|
-
get lc_serializable_keys() {
|
|
4594
|
-
return void 0;
|
|
4595
|
-
}
|
|
4512
|
+
get lc_secrets() {}
|
|
4513
|
+
get lc_attributes() {}
|
|
4514
|
+
get lc_aliases() {}
|
|
4515
|
+
get lc_serializable_keys() {}
|
|
4596
4516
|
/**
|
|
4597
4517
|
* The name of the serializable. Override to provide an alias or
|
|
4598
4518
|
* to preserve the serialized module name in minified environments.
|
|
@@ -4649,10 +4569,6 @@ var BaseCallbackHandler = class extends BaseCallbackHandlerMethodsClass {
|
|
|
4649
4569
|
return new Handler();
|
|
4650
4570
|
}
|
|
4651
4571
|
};
|
|
4652
|
-
const isBaseCallbackHandler = (x) => {
|
|
4653
|
-
const callbackHandler = x;
|
|
4654
|
-
return callbackHandler !== void 0 && typeof callbackHandler.copy === "function" && typeof callbackHandler.name === "string" && typeof callbackHandler.awaitHandlers === "boolean";
|
|
4655
|
-
};
|
|
4656
4572
|
|
|
4657
4573
|
class LangChainCallbackHandler extends BaseCallbackHandler {
|
|
4658
4574
|
constructor(options) {
|