{"version":3,"file":"embedding-vector-count-mismatch-error.mjs","names":[],"sources":["../../../../../../../ai/src/errors/embedding-vector-count-mismatch-error.ts"],"sourcesContent":["import type { AIErrorOptions } from \"./ai-error\";\nimport { ProviderError } from \"./provider-error\";\n\n/** Details of an embedding provider response that did not preserve its input order. */\nexport type EmbeddingVectorCountMismatchErrorOptions = AIErrorOptions & {\n  provider: string;\n  expectedCount: number;\n  receivedCount: number;\n  record: string;\n};\n\n/**\n * An embedding provider returned a vector count other than the number of\n * inputs it accepted. Indexing or scoring that response would silently leave\n * a record without a vector, so callers must stop and surface the provider\n * contract violation.\n */\nexport class EmbeddingVectorCountMismatchError extends ProviderError {\n  public readonly provider: string;\n  public readonly expectedCount: number;\n  public readonly receivedCount: number;\n  public readonly record: string;\n\n  public constructor(options: EmbeddingVectorCountMismatchErrorOptions) {\n    super(\n      `Embedding provider \"${options.provider}\" returned ${options.receivedCount} vectors for ${options.expectedCount} records; record \"${options.record}\" was left without a vector.`,\n      options,\n      \"PROVIDER_EMBEDDING_VECTOR_COUNT_MISMATCH\",\n    );\n    this.name = \"EmbeddingVectorCountMismatchError\";\n    this.provider = options.provider;\n    this.expectedCount = options.expectedCount;\n    this.receivedCount = options.receivedCount;\n    this.record = options.record;\n  }\n}\n"],"mappings":";;;;;;;;;AAiBA,IAAa,oCAAb,cAAuD,cAAc;CAMnE,AAAO,YAAY,SAAmD;EACpE,MACE,uBAAuB,QAAQ,SAAS,aAAa,QAAQ,cAAc,eAAe,QAAQ,cAAc,oBAAoB,QAAQ,OAAO,+BACnJ,SACA,0CACF;EACA,KAAK,OAAO;EACZ,KAAK,WAAW,QAAQ;EACxB,KAAK,gBAAgB,QAAQ;EAC7B,KAAK,gBAAgB,QAAQ;EAC7B,KAAK,SAAS,QAAQ;CACxB;AACF"}