@deepagents/text2sql 0.23.0 → 0.24.0

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.
@@ -431,9 +431,11 @@ var InfoGrounding = class extends AbstractGrounding {
431
431
  // packages/text2sql/src/lib/adapters/groundings/column-values.grounding.ts
432
432
  var ColumnValuesGrounding = class extends AbstractGrounding {
433
433
  lowCardinalityLimit;
434
+ maxValueLength;
434
435
  constructor(config = {}) {
435
436
  super("columnValues");
436
437
  this.lowCardinalityLimit = config.lowCardinalityLimit ?? 20;
438
+ this.maxValueLength = config.maxValueLength ?? 100;
437
439
  }
438
440
  /**
439
441
  * Get values for native ENUM type columns.
@@ -538,24 +540,27 @@ var ColumnValuesGrounding = class extends AbstractGrounding {
538
540
  }
539
541
  }
540
542
  }
543
+ exceedsMaxValueLength(values) {
544
+ return values.some((v) => v.length > this.maxValueLength);
545
+ }
541
546
  /**
542
547
  * Resolve column values from all sources in priority order.
543
548
  */
544
549
  async resolveColumnValues(tableName, column2, constraints2) {
545
550
  const enumValues = await this.collectEnumValues(tableName, column2);
546
- if (enumValues?.length) {
551
+ if (enumValues?.length && !this.exceedsMaxValueLength(enumValues)) {
547
552
  return { kind: "Enum", values: enumValues };
548
553
  }
549
554
  if (constraints2) {
550
555
  for (const constraint2 of constraints2) {
551
556
  const checkValues = this.parseCheckConstraint(constraint2, column2.name);
552
- if (checkValues?.length) {
557
+ if (checkValues?.length && !this.exceedsMaxValueLength(checkValues)) {
553
558
  return { kind: "Enum", values: checkValues };
554
559
  }
555
560
  }
556
561
  }
557
562
  const lowCardValues = await this.collectLowCardinality(tableName, column2);
558
- if (lowCardValues?.length) {
563
+ if (lowCardValues?.length && !this.exceedsMaxValueLength(lowCardValues)) {
559
564
  return { kind: "LowCardinality", values: lowCardValues };
560
565
  }
561
566
  return void 0;