@devilsdev/rag-core 3.7.0 → 3.8.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.
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.8.0",
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",
@@ -1586,17 +1586,9 @@ var require_package = __commonJS({
1586
1586
  "@octokit/rest": "^21.1.1",
1587
1587
  "@opentelemetry/api": "^1.9.1",
1588
1588
  "@opentelemetry/api-logs": "^0.223.0",
1589
- "@opentelemetry/auto-instrumentations-node": "^0.52.1",
1590
1589
  "@opentelemetry/context-async-hooks": "^2.12.0",
1591
- "@opentelemetry/exporter-jaeger": "^1.26.0",
1592
- "@opentelemetry/exporter-prometheus": "^0.53.0",
1593
- "@opentelemetry/exporter-trace-otlp-http": "^0.53.0",
1594
- "@opentelemetry/resources": "^1.26.0",
1595
1590
  "@opentelemetry/sdk-logs": "^0.223.0",
1596
- "@opentelemetry/sdk-metrics": "^1.26.0",
1597
- "@opentelemetry/sdk-node": "^0.53.0",
1598
1591
  "@opentelemetry/sdk-trace-base": "^2.12.0",
1599
- "@opentelemetry/semantic-conventions": "^1.27.0",
1600
1592
  "@types/jest": "^29.5.14",
1601
1593
  "@types/node": "22.14.1",
1602
1594
  acorn: "8.15.0",
@@ -1611,7 +1603,6 @@ var require_package = __commonJS({
1611
1603
  "docusaurus-plugin-llms": "0.6.1",
1612
1604
  esbuild: "^0.25.2",
1613
1605
  eslint: "^8.57.1",
1614
- "eslint-plugin-storybook": "^0.12.0",
1615
1606
  events: "3.3.0",
1616
1607
  "framer-motion": "^12.7.4",
1617
1608
  husky: "^8.0.3",
@@ -1638,10 +1629,10 @@ var require_package = __commonJS({
1638
1629
  "why-is-node-running": "^3.2.2"
1639
1630
  },
1640
1631
  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",
1632
+ "@devilsdev/rag-connectors": "3.8.0",
1633
+ "@devilsdev/rag-core": "3.8.0",
1634
+ "@devilsdev/rag-eval": "3.8.0",
1635
+ "@devilsdev/rag-guardrails": "3.8.0",
1645
1636
  ajv: "^8.17.1",
1646
1637
  axios: "^1.21.0",
1647
1638
  chokidar: "^4.0.3",
@@ -5670,13 +5661,14 @@ var require_connector_utils = __commonJS({
5670
5661
  return process.env[envVar] || "";
5671
5662
  }
5672
5663
  function missingApiKeyError(provider, envVar) {
5673
- const err = new Error(
5674
- `${provider} API key required. Set ${envVar} or pass the apiKey option.`
5664
+ return Object.assign(
5665
+ new Error(
5666
+ `${provider} API key required. Set ${envVar} or pass the apiKey option.`
5667
+ ),
5668
+ // provider and envVar: for callers that word their own message, e.g.
5669
+ // the CLI
5670
+ { code: "MISSING_API_KEY", provider, envVar }
5675
5671
  );
5676
- err.code = "MISSING_API_KEY";
5677
- err.provider = provider;
5678
- err.envVar = envVar;
5679
- return err;
5680
5672
  }
5681
5673
  function signalOptions(signal) {
5682
5674
  return signal ? { signal } : {};
@@ -5734,7 +5726,10 @@ var require_connector_utils = __commonJS({
5734
5726
  } else {
5735
5727
  message = `${provider} request failed: ${err.message}`;
5736
5728
  }
5737
- const error = new Error(message);
5729
+ const error = (
5730
+ /** @type {Error & { provider?: string, code?: string, status?: number, response?: Object }} */
5731
+ new Error(message)
5732
+ );
5738
5733
  error.provider = provider;
5739
5734
  if (err.code) error.code = err.code;
5740
5735
  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.8.0",
4
4
  "description": "createRagPipeline and its building blocks: retrieval, reranking, caching, cost tracking and model routing.",
5
5
  "keywords": [
6
6
  "rag",