@posthog/ai 7.9.1 → 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.
@@ -23,7 +23,7 @@ function _interopNamespace(e) {
23
23
 
24
24
  var uuid__namespace = /*#__PURE__*/_interopNamespace(uuid);
25
25
 
26
- var version = "7.9.1";
26
+ var version = "7.9.2";
27
27
 
28
28
  // Type guards for safer type checking
29
29
 
@@ -206,15 +206,6 @@ const withPrivacyMode = (client, privacyMode, input) => {
206
206
  return client.privacy_mode || privacyMode ? null : input;
207
207
  };
208
208
 
209
- //#region rolldown:runtime
210
- var __defProp = Object.defineProperty;
211
- var __export = (target, all) => {
212
- for (var name in all) __defProp(target, name, {
213
- get: all[name],
214
- enumerable: true
215
- });
216
- };
217
-
218
209
  function getDefaultExportFromCjs (x) {
219
210
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
220
211
  }
@@ -458,12 +449,6 @@ function escapeIfNeeded(value, pathSet = /* @__PURE__ */ new WeakSet()) {
458
449
  return value;
459
450
  }
460
451
 
461
- //#region src/load/serializable.ts
462
- var serializable_exports = {};
463
- __export(serializable_exports, {
464
- Serializable: () => Serializable,
465
- get_lc_unique_name: () => get_lc_unique_name
466
- });
467
452
  function shallowCopy(obj) {
468
453
  return Array.isArray(obj) ? [...obj] : { ...obj };
469
454
  }
@@ -491,8 +476,7 @@ function replaceSecrets(root, secretsMap) {
491
476
  */
492
477
  function get_lc_unique_name(serializableClass) {
493
478
  const parentClass = Object.getPrototypeOf(serializableClass);
494
- const lcNameIsSubclassed = typeof serializableClass.lc_name === "function" && (typeof parentClass.lc_name !== "function" || serializableClass.lc_name() !== parentClass.lc_name());
495
- if (lcNameIsSubclassed) return serializableClass.lc_name();
479
+ if (typeof serializableClass.lc_name === "function" && (typeof parentClass.lc_name !== "function" || serializableClass.lc_name() !== parentClass.lc_name())) return serializableClass.lc_name();
496
480
  else return serializableClass.name;
497
481
  }
498
482
  var Serializable = class Serializable {
@@ -518,34 +502,26 @@ var Serializable = class Serializable {
518
502
  * Keys are paths to the secret in constructor args, e.g. "foo.bar.baz".
519
503
  * Values are the secret ids, which will be used when deserializing.
520
504
  */
521
- get lc_secrets() {
522
- return void 0;
523
- }
505
+ get lc_secrets() {}
524
506
  /**
525
507
  * A map of additional attributes to merge with constructor args.
526
508
  * Keys are the attribute names, e.g. "foo".
527
509
  * Values are the attribute values, which will be serialized.
528
510
  * These attributes need to be accepted by the constructor as arguments.
529
511
  */
530
- get lc_attributes() {
531
- return void 0;
532
- }
512
+ get lc_attributes() {}
533
513
  /**
534
514
  * A map of aliases for constructor args.
535
515
  * Keys are the attribute names, e.g. "foo".
536
516
  * Values are the alias that will replace the key in serialization.
537
517
  * This is used to eg. make argument names match Python.
538
518
  */
539
- get lc_aliases() {
540
- return void 0;
541
- }
519
+ get lc_aliases() {}
542
520
  /**
543
521
  * A manual list of keys that should be serialized.
544
522
  * If not overridden, all fields passed into the constructor will be serialized.
545
523
  */
546
- get lc_serializable_keys() {
547
- return void 0;
548
- }
524
+ get lc_serializable_keys() {}
549
525
  constructor(kwargs, ..._args) {
550
526
  if (this.lc_serializable_keys !== void 0) this.lc_kwargs = Object.fromEntries(Object.entries(kwargs || {}).filter(([key]) => this.lc_serializable_keys?.includes(key)));
551
527
  else this.lc_kwargs = kwargs ?? {};
@@ -583,8 +559,7 @@ var Serializable = class Serializable {
583
559
  const pathSet = /* @__PURE__ */ new WeakSet();
584
560
  pathSet.add(this);
585
561
  for (const [key, value] of Object.entries(kwargs)) escapedKwargs[key] = escapeIfNeeded(value, pathSet);
586
- const kwargsWithSecrets = Object.keys(secrets).length ? replaceSecrets(escapedKwargs, secrets) : escapedKwargs;
587
- const processedKwargs = mapKeys(kwargsWithSecrets, keyToJson, aliases);
562
+ const processedKwargs = mapKeys(Object.keys(secrets).length ? replaceSecrets(escapedKwargs, secrets) : escapedKwargs, keyToJson, aliases);
588
563
  return {
589
564
  lc: 1,
590
565
  type: "constructor",
@@ -601,70 +576,23 @@ var Serializable = class Serializable {
601
576
  }
602
577
  };
603
578
 
604
- //#region src/utils/env.ts
605
- var env_exports = {};
606
- __export(env_exports, {
607
- getEnv: () => getEnv,
608
- getEnvironmentVariable: () => getEnvironmentVariable,
609
- getRuntimeEnvironment: () => getRuntimeEnvironment,
610
- isBrowser: () => isBrowser,
611
- isDeno: () => isDeno,
612
- isJsDom: () => isJsDom,
613
- isNode: () => isNode,
614
- isWebWorker: () => isWebWorker
615
- });
616
- const isBrowser = () => typeof window !== "undefined" && typeof window.document !== "undefined";
617
- const isWebWorker = () => typeof globalThis === "object" && globalThis.constructor && globalThis.constructor.name === "DedicatedWorkerGlobalScope";
618
- const isJsDom = () => typeof window !== "undefined" && window.name === "nodejs" || typeof navigator !== "undefined" && navigator.userAgent.includes("jsdom");
619
579
  const isDeno = () => typeof Deno !== "undefined";
620
- const isNode = () => typeof process !== "undefined" && typeof process.versions !== "undefined" && typeof process.versions.node !== "undefined" && !isDeno();
621
- const getEnv = () => {
622
- let env;
623
- if (isBrowser()) env = "browser";
624
- else if (isNode()) env = "node";
625
- else if (isWebWorker()) env = "webworker";
626
- else if (isJsDom()) env = "jsdom";
627
- else if (isDeno()) env = "deno";
628
- else env = "other";
629
- return env;
630
- };
631
- let runtimeEnvironment;
632
- function getRuntimeEnvironment() {
633
- if (runtimeEnvironment === void 0) {
634
- const env = getEnv();
635
- runtimeEnvironment = {
636
- library: "langchain-js",
637
- runtime: env
638
- };
639
- }
640
- return runtimeEnvironment;
641
- }
642
580
  function getEnvironmentVariable(name) {
643
581
  try {
644
582
  if (typeof process !== "undefined") return process.env?.[name];
645
583
  else if (isDeno()) return Deno?.env.get(name);
646
- else return void 0;
584
+ else return;
647
585
  } catch {
648
- return void 0;
586
+ return;
649
587
  }
650
588
  }
651
589
 
652
- //#region src/callbacks/base.ts
653
- var base_exports = {};
654
- __export(base_exports, {
655
- BaseCallbackHandler: () => BaseCallbackHandler,
656
- callbackHandlerPrefersStreaming: () => callbackHandlerPrefersStreaming,
657
- isBaseCallbackHandler: () => isBaseCallbackHandler
658
- });
659
590
  /**
660
591
  * Abstract class that provides a set of optional methods that can be
661
592
  * overridden in derived classes to handle various events during the
662
593
  * execution of a LangChain application.
663
594
  */
664
595
  var BaseCallbackHandlerMethodsClass = class {};
665
- function callbackHandlerPrefersStreaming(x) {
666
- return "lc_prefer_streaming" in x && x.lc_prefer_streaming;
667
- }
668
596
  /**
669
597
  * Abstract base class for creating callback handlers in the LangChain
670
598
  * framework. It provides a set of optional methods that can be overridden
@@ -680,18 +608,10 @@ var BaseCallbackHandler = class extends BaseCallbackHandlerMethodsClass {
680
608
  this.name
681
609
  ];
682
610
  }
683
- get lc_secrets() {
684
- return void 0;
685
- }
686
- get lc_attributes() {
687
- return void 0;
688
- }
689
- get lc_aliases() {
690
- return void 0;
691
- }
692
- get lc_serializable_keys() {
693
- return void 0;
694
- }
611
+ get lc_secrets() {}
612
+ get lc_attributes() {}
613
+ get lc_aliases() {}
614
+ get lc_serializable_keys() {}
695
615
  /**
696
616
  * The name of the serializable. Override to provide an alias or
697
617
  * to preserve the serialized module name in minified environments.
@@ -748,10 +668,6 @@ var BaseCallbackHandler = class extends BaseCallbackHandlerMethodsClass {
748
668
  return new Handler();
749
669
  }
750
670
  };
751
- const isBaseCallbackHandler = (x) => {
752
- const callbackHandler = x;
753
- return callbackHandler !== void 0 && typeof callbackHandler.copy === "function" && typeof callbackHandler.name === "string" && typeof callbackHandler.awaitHandlers === "boolean";
754
- };
755
671
 
756
672
  /** A run may either be a Span or a Generation */
757
673