@devilsdev/rag-core 3.7.0 → 3.7.1

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/index.cjs CHANGED
@@ -1370,7 +1370,7 @@ var require_package = __commonJS({
1370
1370
  "package.json"(exports2, module2) {
1371
1371
  module2.exports = {
1372
1372
  name: "@devilsdev/rag-pipeline-utils",
1373
- version: "3.7.0",
1373
+ version: "3.7.1",
1374
1374
  description: "Composable retrieval-augmented generation (RAG) for Node.js: grounded citations, evaluation, guardrails, hybrid retrieval and a CLI.",
1375
1375
  main: "dist/index.cjs",
1376
1376
  type: "commonjs",
@@ -1638,10 +1638,10 @@ var require_package = __commonJS({
1638
1638
  "why-is-node-running": "^3.2.2"
1639
1639
  },
1640
1640
  dependencies: {
1641
- "@devilsdev/rag-connectors": "3.7.0",
1642
- "@devilsdev/rag-core": "3.7.0",
1643
- "@devilsdev/rag-eval": "3.7.0",
1644
- "@devilsdev/rag-guardrails": "3.7.0",
1641
+ "@devilsdev/rag-connectors": "3.7.1",
1642
+ "@devilsdev/rag-core": "3.7.1",
1643
+ "@devilsdev/rag-eval": "3.7.1",
1644
+ "@devilsdev/rag-guardrails": "3.7.1",
1645
1645
  ajv: "^8.17.1",
1646
1646
  axios: "^1.21.0",
1647
1647
  chokidar: "^4.0.3",
@@ -5670,13 +5670,14 @@ var require_connector_utils = __commonJS({
5670
5670
  return process.env[envVar] || "";
5671
5671
  }
5672
5672
  function missingApiKeyError(provider, envVar) {
5673
- const err = new Error(
5674
- `${provider} API key required. Set ${envVar} or pass the apiKey option.`
5673
+ return Object.assign(
5674
+ new Error(
5675
+ `${provider} API key required. Set ${envVar} or pass the apiKey option.`
5676
+ ),
5677
+ // provider and envVar: for callers that word their own message, e.g.
5678
+ // the CLI
5679
+ { code: "MISSING_API_KEY", provider, envVar }
5675
5680
  );
5676
- err.code = "MISSING_API_KEY";
5677
- err.provider = provider;
5678
- err.envVar = envVar;
5679
- return err;
5680
5681
  }
5681
5682
  function signalOptions(signal) {
5682
5683
  return signal ? { signal } : {};
@@ -5734,7 +5735,10 @@ var require_connector_utils = __commonJS({
5734
5735
  } else {
5735
5736
  message = `${provider} request failed: ${err.message}`;
5736
5737
  }
5737
- const error = new Error(message);
5738
+ const error = (
5739
+ /** @type {Error & { provider?: string, code?: string, status?: number, response?: Object }} */
5740
+ new Error(message)
5741
+ );
5738
5742
  error.provider = provider;
5739
5743
  if (err.code) error.code = err.code;
5740
5744
  if (response) {
@@ -47,12 +47,16 @@ export function computeSupportScore(claimTokens: string[], docTokens: string[] |
47
47
  *
48
48
  * @param {string} claimText
49
49
  * @param {string} docText
50
- * @returns {{ consistent: boolean, claimNumbers: string[], missing: string[] }}
50
+ * @returns {{ consistent: boolean, claimNumbers: string[], missing: string[], matchedWords: string[] }}
51
+ * `matchedWords`: the words of a claim quantity or time the source states
52
+ * another way ("90 minutes" for "one and a half hours"); computeSupportScore
53
+ * counts them as matched
51
54
  */
52
55
  export function checkNumericConsistency(claimText: string, docText: string): {
53
56
  consistent: boolean;
54
57
  claimNumbers: string[];
55
58
  missing: string[];
59
+ matchedWords: string[];
56
60
  };
57
61
  /**
58
62
  * Polarity consistency between a claim and a document. Word overlap alone
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devilsdev/rag-core",
3
- "version": "3.7.0",
3
+ "version": "3.7.1",
4
4
  "description": "createRagPipeline and its building blocks: retrieval, reranking, caching, cost tracking and model routing.",
5
5
  "keywords": [
6
6
  "rag",