@proposit/proposit-core 1.3.0 → 1.3.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/README.md +9 -0
- package/dist/extensions/argument-ingestion/index.d.ts +4 -2
- package/dist/extensions/argument-ingestion/index.d.ts.map +1 -1
- package/dist/extensions/argument-ingestion/index.js +2 -1
- package/dist/extensions/argument-ingestion/index.js.map +1 -1
- package/dist/extensions/argument-ingestion/shared/resolve-llm-stage-options.d.ts +19 -0
- package/dist/extensions/argument-ingestion/shared/resolve-llm-stage-options.d.ts.map +1 -0
- package/dist/extensions/argument-ingestion/shared/resolve-llm-stage-options.js +44 -0
- package/dist/extensions/argument-ingestion/shared/resolve-llm-stage-options.js.map +1 -0
- package/dist/extensions/argument-ingestion/shared/types.d.ts +39 -0
- package/dist/extensions/argument-ingestion/shared/types.d.ts.map +1 -1
- package/dist/extensions/argument-ingestion/stages/axiom-indicator-detection.d.ts +6 -0
- package/dist/extensions/argument-ingestion/stages/axiom-indicator-detection.d.ts.map +1 -1
- package/dist/extensions/argument-ingestion/stages/axiom-indicator-detection.js +16 -7
- package/dist/extensions/argument-ingestion/stages/axiom-indicator-detection.js.map +1 -1
- package/dist/extensions/argument-ingestion/stages/citation-source-detection.d.ts +6 -0
- package/dist/extensions/argument-ingestion/stages/citation-source-detection.d.ts.map +1 -1
- package/dist/extensions/argument-ingestion/stages/citation-source-detection.js +16 -7
- package/dist/extensions/argument-ingestion/stages/citation-source-detection.js.map +1 -1
- package/dist/extensions/argument-ingestion/stages/claim-canonicalization.d.ts +8 -2
- package/dist/extensions/argument-ingestion/stages/claim-canonicalization.d.ts.map +1 -1
- package/dist/extensions/argument-ingestion/stages/claim-canonicalization.js +11 -2
- package/dist/extensions/argument-ingestion/stages/claim-canonicalization.js.map +1 -1
- package/dist/extensions/argument-ingestion/stages/claim-mention-extraction.d.ts +6 -0
- package/dist/extensions/argument-ingestion/stages/claim-mention-extraction.d.ts.map +1 -1
- package/dist/extensions/argument-ingestion/stages/claim-mention-extraction.js +16 -7
- package/dist/extensions/argument-ingestion/stages/claim-mention-extraction.js.map +1 -1
- package/dist/extensions/argument-ingestion/stages/claim-type-classification.d.ts +6 -0
- package/dist/extensions/argument-ingestion/stages/claim-type-classification.d.ts.map +1 -1
- package/dist/extensions/argument-ingestion/stages/claim-type-classification.js +20 -11
- package/dist/extensions/argument-ingestion/stages/claim-type-classification.js.map +1 -1
- package/dist/extensions/argument-ingestion/stages/conclusion-selection.d.ts +14 -7
- package/dist/extensions/argument-ingestion/stages/conclusion-selection.d.ts.map +1 -1
- package/dist/extensions/argument-ingestion/stages/conclusion-selection.js +47 -37
- package/dist/extensions/argument-ingestion/stages/conclusion-selection.js.map +1 -1
- package/dist/extensions/argument-ingestion/stages/index.d.ts +8 -8
- package/dist/extensions/argument-ingestion/stages/index.d.ts.map +1 -1
- package/dist/extensions/argument-ingestion/stages/index.js +8 -8
- package/dist/extensions/argument-ingestion/stages/index.js.map +1 -1
- package/dist/extensions/argument-ingestion/stages/relation-extraction.d.ts +6 -0
- package/dist/extensions/argument-ingestion/stages/relation-extraction.d.ts.map +1 -1
- package/dist/extensions/argument-ingestion/stages/relation-extraction.js +21 -11
- package/dist/extensions/argument-ingestion/stages/relation-extraction.js.map +1 -1
- package/dist/extensions/argument-ingestion/stages/segmentation.d.ts +20 -0
- package/dist/extensions/argument-ingestion/stages/segmentation.d.ts.map +1 -1
- package/dist/extensions/argument-ingestion/stages/segmentation.js +51 -7
- package/dist/extensions/argument-ingestion/stages/segmentation.js.map +1 -1
- package/dist/extensions/argument-ingestion/v1-single-shot.d.ts +9 -1
- package/dist/extensions/argument-ingestion/v1-single-shot.d.ts.map +1 -1
- package/dist/extensions/argument-ingestion/v1-single-shot.js +13 -6
- package/dist/extensions/argument-ingestion/v1-single-shot.js.map +1 -1
- package/dist/extensions/argument-ingestion/v2-multi-stage.d.ts +25 -2
- package/dist/extensions/argument-ingestion/v2-multi-stage.d.ts.map +1 -1
- package/dist/extensions/argument-ingestion/v2-multi-stage.js +12 -3
- package/dist/extensions/argument-ingestion/v2-multi-stage.js.map +1 -1
- package/dist/extensions/openai/provider.d.ts.map +1 -1
- package/dist/extensions/openai/provider.js +136 -1
- package/dist/extensions/openai/provider.js.map +1 -1
- package/dist/extensions/openai/types.d.ts +19 -0
- package/dist/extensions/openai/types.d.ts.map +1 -1
- package/dist/lib/index.d.ts +2 -2
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +1 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/pipelines/debug-log.d.ts +96 -0
- package/dist/lib/pipelines/debug-log.d.ts.map +1 -0
- package/dist/lib/pipelines/debug-log.js +144 -0
- package/dist/lib/pipelines/debug-log.js.map +1 -0
- package/dist/lib/pipelines/execute.d.ts.map +1 -1
- package/dist/lib/pipelines/execute.js +84 -54
- package/dist/lib/pipelines/execute.js.map +1 -1
- package/dist/lib/pipelines/index.d.ts +1 -0
- package/dist/lib/pipelines/index.d.ts.map +1 -1
- package/dist/lib/pipelines/index.js +1 -0
- package/dist/lib/pipelines/index.js.map +1 -1
- package/package.json +2 -3
|
@@ -48,47 +48,57 @@ function buildPrompt(ctx) {
|
|
|
48
48
|
const user = `Per-claim types:\n${typeLines}\n\nRelations:\n${relationLines}\n\nSelect the conclusion (or return null).`;
|
|
49
49
|
return { system: markedSystem, user };
|
|
50
50
|
}
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
id: STAGE_IDS.conclusionSelection,
|
|
54
|
-
dependsOn: [
|
|
55
|
-
STAGE_IDS.claimTypeClassification,
|
|
56
|
-
STAGE_IDS.relationExtraction,
|
|
57
|
-
],
|
|
58
|
-
outputSchema: ConclusionSelectionOutputSchema,
|
|
59
|
-
model: CONCLUSION_SELECTION_MODEL,
|
|
51
|
+
/** Internal default knobs for the conclusion-selection stage. */
|
|
52
|
+
export const CONCLUSION_SELECTION_STAGE_DEFAULTS = {
|
|
60
53
|
reasoningEffort: CONCLUSION_SELECTION_REASONING,
|
|
61
|
-
|
|
62
|
-
});
|
|
54
|
+
};
|
|
63
55
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
56
|
+
* Build the conclusion-selection stage with optional caller
|
|
57
|
+
* overrides. The stage wraps an inner `llmStage` so that when the LLM
|
|
58
|
+
* returns `conclusionMiniId: null`, it also emits a
|
|
66
59
|
* `ProcessingFailure` with code `NO_SINGLE_CONCLUSION` via
|
|
67
60
|
* `ctx.addFailure` (spec §7.2 row 10). The stage still completes
|
|
68
61
|
* successfully — the null output flows through `formula-compilation`
|
|
69
|
-
* (which emits `conclusionPremiseMiniId: null`) into
|
|
70
|
-
* (which assembles `{ argument: null,
|
|
71
|
-
* conclusion could be selected." }`). The
|
|
72
|
-
* UI-rendering hint, not a task-outcome signal;
|
|
73
|
-
* to match the informational-only role of
|
|
62
|
+
* (which emits `conclusionPremiseMiniId: null`) into
|
|
63
|
+
* `finalize-response-v2` (which assembles `{ argument: null,
|
|
64
|
+
* failureText: "No single conclusion could be selected." }`). The
|
|
65
|
+
* added failure is a UI-rendering hint, not a task-outcome signal;
|
|
66
|
+
* severity is `warning` to match the informational-only role of
|
|
67
|
+
* finalize's failureText path.
|
|
74
68
|
*/
|
|
75
|
-
export
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
69
|
+
export function createConclusionSelectionStage(options) {
|
|
70
|
+
const innerStage = llmStage({
|
|
71
|
+
id: STAGE_IDS.conclusionSelection,
|
|
72
|
+
dependsOn: [
|
|
73
|
+
STAGE_IDS.claimTypeClassification,
|
|
74
|
+
STAGE_IDS.relationExtraction,
|
|
75
|
+
],
|
|
76
|
+
outputSchema: ConclusionSelectionOutputSchema,
|
|
77
|
+
model: CONCLUSION_SELECTION_MODEL,
|
|
78
|
+
maxOutputTokens: options?.maxOutputTokens,
|
|
79
|
+
reasoningEffort: options?.reasoningEffort ?? CONCLUSION_SELECTION_REASONING,
|
|
80
|
+
buildPrompt,
|
|
81
|
+
});
|
|
82
|
+
return {
|
|
83
|
+
id: innerStage.id,
|
|
84
|
+
dependsOn: innerStage.dependsOn,
|
|
85
|
+
outputSchema: innerStage.outputSchema,
|
|
86
|
+
run: async (ctx) => {
|
|
87
|
+
const output = await innerStage.run(ctx);
|
|
88
|
+
if (output.conclusionMiniId === null) {
|
|
89
|
+
ctx.addFailure({
|
|
90
|
+
code: CONCLUSION_SELECTION_NO_CONCLUSION_FAILURE_CODE,
|
|
91
|
+
message: output.rationale.length > 0
|
|
92
|
+
? output.rationale
|
|
93
|
+
: "No single conclusion could be selected.",
|
|
94
|
+
severity: "warning",
|
|
95
|
+
context: { rationale: output.rationale },
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
return output;
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/** Backward-compatible default-options stage. */
|
|
103
|
+
export const conclusionSelectionStage = createConclusionSelectionStage();
|
|
94
104
|
//# sourceMappingURL=conclusion-selection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conclusion-selection.js","sourceRoot":"","sources":["../../../../src/extensions/argument-ingestion/stages/conclusion-selection.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,uEAAuE;AACvE,oEAAoE;AACpE,iEAAiE;AACjE,kEAAkE;AAClE,mEAAmE;AACnE,iDAAiD;AACjD,EAAE;AACF,+DAA+D;AAC/D,2BAA2B;AAE3B,OAAO,EACH,SAAS,EACT,+BAA+B,GAIlC,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAA;
|
|
1
|
+
{"version":3,"file":"conclusion-selection.js","sourceRoot":"","sources":["../../../../src/extensions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wBACvB,CAAC,CAAC,MAAM,CAAC,SAAS;wBAClB,CAAC,CAAC,yCAAyC;oBACnD,QAAQ,EAAE,SAAS;oBACnB,OAAO,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE;iBAC3C,CAAC,CAAA;YACN,CAAC;YACD,OAAO,MAAM,CAAA;QACjB,CAAC;KACJ,CAAA;AACL,CAAC;AAED,iDAAiD;AACjD,MAAM,CAAC,MAAM,wBAAwB,GACjC,8BAA8B,EAAE,CAAA"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
export { STAGE_IDS } from "./schemas.js";
|
|
2
2
|
export * from "./schemas.js";
|
|
3
|
-
export { segmentationStage } from "./segmentation.js";
|
|
4
|
-
export { claimMentionExtractionStage } from "./claim-mention-extraction.js";
|
|
5
|
-
export { citationSourceDetectionStage } from "./citation-source-detection.js";
|
|
6
|
-
export { axiomIndicatorDetectionStage } from "./axiom-indicator-detection.js";
|
|
7
|
-
export { createClaimCanonicalizationStage } from "./claim-canonicalization.js";
|
|
8
|
-
export { claimTypeClassificationStage } from "./claim-type-classification.js";
|
|
3
|
+
export { segmentationStage, createSegmentationStage, SEGMENTATION_MAX_OUTPUT_TOKENS, SEGMENTATION_STAGE_DEFAULTS, } from "./segmentation.js";
|
|
4
|
+
export { claimMentionExtractionStage, createClaimMentionExtractionStage, CLAIM_MENTION_EXTRACTION_STAGE_DEFAULTS, } from "./claim-mention-extraction.js";
|
|
5
|
+
export { citationSourceDetectionStage, createCitationSourceDetectionStage, CITATION_SOURCE_DETECTION_STAGE_DEFAULTS, } from "./citation-source-detection.js";
|
|
6
|
+
export { axiomIndicatorDetectionStage, createAxiomIndicatorDetectionStage, AXIOM_INDICATOR_DETECTION_STAGE_DEFAULTS, } from "./axiom-indicator-detection.js";
|
|
7
|
+
export { createClaimCanonicalizationStage, CLAIM_CANONICALIZATION_STAGE_DEFAULTS, } from "./claim-canonicalization.js";
|
|
8
|
+
export { claimTypeClassificationStage, createClaimTypeClassificationStage, CLAIM_TYPE_CLASSIFICATION_STAGE_DEFAULTS, } from "./claim-type-classification.js";
|
|
9
9
|
export { claimReferenceValidationStage, validateClaimReferences, CLAIM_REFERENCE_FAILURE_CODES, } from "./claim-reference-validation.js";
|
|
10
10
|
export { variableAssignmentStage, assignVariables, isValidVariableSymbol, } from "./variable-assignment.js";
|
|
11
|
-
export { relationExtractionStage } from "./relation-extraction.js";
|
|
12
|
-
export { conclusionSelectionStage } from "./conclusion-selection.js";
|
|
11
|
+
export { relationExtractionStage, createRelationExtractionStage, RELATION_EXTRACTION_STAGE_DEFAULTS, } from "./relation-extraction.js";
|
|
12
|
+
export { conclusionSelectionStage, createConclusionSelectionStage, CONCLUSION_SELECTION_STAGE_DEFAULTS, } from "./conclusion-selection.js";
|
|
13
13
|
export { formulaCompilationStage, compileFormulas, FORMULA_COMPILATION_FAILURE_CODES, } from "./formula-compilation.js";
|
|
14
14
|
export { formulaValidationStage, validateFormulas, FORMULA_VALIDATION_FAILURE_CODES, } from "./formula-validation.js";
|
|
15
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/extensions/argument-ingestion/stages/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,cAAc,cAAc,CAAA;AAE5B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/extensions/argument-ingestion/stages/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,cAAc,cAAc,CAAA;AAE5B,OAAO,EACH,iBAAiB,EACjB,uBAAuB,EACvB,8BAA8B,EAC9B,2BAA2B,GAC9B,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EACH,2BAA2B,EAC3B,iCAAiC,EACjC,uCAAuC,GAC1C,MAAM,+BAA+B,CAAA;AACtC,OAAO,EACH,4BAA4B,EAC5B,kCAAkC,EAClC,wCAAwC,GAC3C,MAAM,gCAAgC,CAAA;AACvC,OAAO,EACH,4BAA4B,EAC5B,kCAAkC,EAClC,wCAAwC,GAC3C,MAAM,gCAAgC,CAAA;AACvC,OAAO,EACH,gCAAgC,EAChC,qCAAqC,GACxC,MAAM,6BAA6B,CAAA;AACpC,OAAO,EACH,4BAA4B,EAC5B,kCAAkC,EAClC,wCAAwC,GAC3C,MAAM,gCAAgC,CAAA;AACvC,OAAO,EACH,6BAA6B,EAC7B,uBAAuB,EACvB,6BAA6B,GAChC,MAAM,iCAAiC,CAAA;AACxC,OAAO,EACH,uBAAuB,EACvB,eAAe,EACf,qBAAqB,GACxB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACH,uBAAuB,EACvB,6BAA6B,EAC7B,kCAAkC,GACrC,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACH,wBAAwB,EACxB,8BAA8B,EAC9B,mCAAmC,GACtC,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACH,uBAAuB,EACvB,eAAe,EACf,iCAAiC,GACpC,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACH,sBAAsB,EACtB,gBAAgB,EAChB,gCAAgC,GACnC,MAAM,yBAAyB,CAAA"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// Barrel for the 12 v2-multi-stage ingestion stages.
|
|
2
2
|
export { STAGE_IDS } from "./schemas.js";
|
|
3
3
|
export * from "./schemas.js";
|
|
4
|
-
export { segmentationStage } from "./segmentation.js";
|
|
5
|
-
export { claimMentionExtractionStage } from "./claim-mention-extraction.js";
|
|
6
|
-
export { citationSourceDetectionStage } from "./citation-source-detection.js";
|
|
7
|
-
export { axiomIndicatorDetectionStage } from "./axiom-indicator-detection.js";
|
|
8
|
-
export { createClaimCanonicalizationStage } from "./claim-canonicalization.js";
|
|
9
|
-
export { claimTypeClassificationStage } from "./claim-type-classification.js";
|
|
4
|
+
export { segmentationStage, createSegmentationStage, SEGMENTATION_MAX_OUTPUT_TOKENS, SEGMENTATION_STAGE_DEFAULTS, } from "./segmentation.js";
|
|
5
|
+
export { claimMentionExtractionStage, createClaimMentionExtractionStage, CLAIM_MENTION_EXTRACTION_STAGE_DEFAULTS, } from "./claim-mention-extraction.js";
|
|
6
|
+
export { citationSourceDetectionStage, createCitationSourceDetectionStage, CITATION_SOURCE_DETECTION_STAGE_DEFAULTS, } from "./citation-source-detection.js";
|
|
7
|
+
export { axiomIndicatorDetectionStage, createAxiomIndicatorDetectionStage, AXIOM_INDICATOR_DETECTION_STAGE_DEFAULTS, } from "./axiom-indicator-detection.js";
|
|
8
|
+
export { createClaimCanonicalizationStage, CLAIM_CANONICALIZATION_STAGE_DEFAULTS, } from "./claim-canonicalization.js";
|
|
9
|
+
export { claimTypeClassificationStage, createClaimTypeClassificationStage, CLAIM_TYPE_CLASSIFICATION_STAGE_DEFAULTS, } from "./claim-type-classification.js";
|
|
10
10
|
export { claimReferenceValidationStage, validateClaimReferences, CLAIM_REFERENCE_FAILURE_CODES, } from "./claim-reference-validation.js";
|
|
11
11
|
export { variableAssignmentStage, assignVariables, isValidVariableSymbol, } from "./variable-assignment.js";
|
|
12
|
-
export { relationExtractionStage } from "./relation-extraction.js";
|
|
13
|
-
export { conclusionSelectionStage } from "./conclusion-selection.js";
|
|
12
|
+
export { relationExtractionStage, createRelationExtractionStage, RELATION_EXTRACTION_STAGE_DEFAULTS, } from "./relation-extraction.js";
|
|
13
|
+
export { conclusionSelectionStage, createConclusionSelectionStage, CONCLUSION_SELECTION_STAGE_DEFAULTS, } from "./conclusion-selection.js";
|
|
14
14
|
export { formulaCompilationStage, compileFormulas, FORMULA_COMPILATION_FAILURE_CODES, } from "./formula-compilation.js";
|
|
15
15
|
export { formulaValidationStage, validateFormulas, FORMULA_VALIDATION_FAILURE_CODES, } from "./formula-validation.js";
|
|
16
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/extensions/argument-ingestion/stages/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;AAErD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,cAAc,cAAc,CAAA;AAE5B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/extensions/argument-ingestion/stages/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;AAErD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,cAAc,cAAc,CAAA;AAE5B,OAAO,EACH,iBAAiB,EACjB,uBAAuB,EACvB,8BAA8B,EAC9B,2BAA2B,GAC9B,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EACH,2BAA2B,EAC3B,iCAAiC,EACjC,uCAAuC,GAC1C,MAAM,+BAA+B,CAAA;AACtC,OAAO,EACH,4BAA4B,EAC5B,kCAAkC,EAClC,wCAAwC,GAC3C,MAAM,gCAAgC,CAAA;AACvC,OAAO,EACH,4BAA4B,EAC5B,kCAAkC,EAClC,wCAAwC,GAC3C,MAAM,gCAAgC,CAAA;AACvC,OAAO,EACH,gCAAgC,EAChC,qCAAqC,GACxC,MAAM,6BAA6B,CAAA;AACpC,OAAO,EACH,4BAA4B,EAC5B,kCAAkC,EAClC,wCAAwC,GAC3C,MAAM,gCAAgC,CAAA;AACvC,OAAO,EACH,6BAA6B,EAC7B,uBAAuB,EACvB,6BAA6B,GAChC,MAAM,iCAAiC,CAAA;AACxC,OAAO,EACH,uBAAuB,EACvB,eAAe,EACf,qBAAqB,GACxB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACH,uBAAuB,EACvB,6BAA6B,EAC7B,kCAAkC,GACrC,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACH,wBAAwB,EACxB,8BAA8B,EAC9B,mCAAmC,GACtC,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACH,uBAAuB,EACvB,eAAe,EACf,iCAAiC,GACpC,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACH,sBAAsB,EACtB,gBAAgB,EAChB,gCAAgC,GACnC,MAAM,yBAAyB,CAAA"}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { type TRelationExtractionOutput } from "./schemas.js";
|
|
2
2
|
import type { TStage } from "../../../lib/pipelines/types.js";
|
|
3
|
+
import type { TLlmStageOptionsOverride } from "../shared/types.js";
|
|
3
4
|
export declare const RELATION_EXTRACTION_MODEL = "gpt-5.5";
|
|
4
5
|
export declare const RELATION_EXTRACTION_REASONING: "minimal" | "low" | "medium" | "high";
|
|
5
6
|
export declare const RELATION_EXTRACTION_SYSTEM_PROMPT = "You identify support relationships between canonical claims in an argument.\n\nGiven the canonical claim set, the per-claim type map, and the original segments, emit one entry per supporting relationship. Return an object with a single key `relations` whose value is the array. There are three relation kinds:\n\n- `\"support\"` \u2014 a single claim S supports another claim T. Use this for ordinary \"P, therefore Q\" support edges where the supporting evidence is a single normal-typed proposition.\n- `\"joint-support\"` \u2014 multiple claims S1, S2, ... jointly support T. Use this when the author commits to a syllogistic step that requires ALL of the sources to hold (e.g. major premise + minor premise \u2192 conclusion).\n- `\"derivation-support\"` \u2014 a citation-typed or axiomatic-typed claim S supports a normal-typed claim T. Use this exclusively for relations whose source is \"citation\" or \"axiomatic\". The shape is otherwise identical to `\"support\"`.\n\nFor each relation emit:\n- a fresh `relationId` (r1, r2, ...)\n- the `type`\n- `sources` \u2014 an array of supporting claim miniIds (length 1 for support and derivation-support; length \u2265 2 for joint-support)\n- `target` \u2014 the supported claim's miniId\n- `evidence.segmentIds` \u2014 the segments that ground the relation (often a single segment containing a \"therefore\", \"so\", \"because\")\n- `evidence.quote` \u2014 a short verbatim quote from the input that justifies the relation\n\n## Conservatism rules\n\n- Do not invent relations. If the author doesn't actually argue from S to T, don't emit a relation between them.\n- Do not double-count. If two claims share an axiomatic backing, that's one derivation-support relation per claim, not a joint-support pair.\n- The conclusion of the argument is identified in a separate stage; do NOT emit a special \"conclusion\" relation here. Just emit the support edges you see; the conclusion stage selects from your output.\n- Avoid attack/rebuttal relations entirely in this MVP \u2014 the pipeline does not yet handle them.\n\nIf there are no relations to emit, return `{ \"relations\": [] }`.";
|
|
7
|
+
/** Internal default knobs for the relation-extraction stage. */
|
|
8
|
+
export declare const RELATION_EXTRACTION_STAGE_DEFAULTS: TLlmStageOptionsOverride;
|
|
9
|
+
/** Build the relation-extraction stage with optional caller overrides. */
|
|
10
|
+
export declare function createRelationExtractionStage(options?: TLlmStageOptionsOverride): TStage<TRelationExtractionOutput>;
|
|
11
|
+
/** Backward-compatible default-options stage. */
|
|
6
12
|
export declare const relationExtractionStage: TStage<TRelationExtractionOutput>;
|
|
7
13
|
//# sourceMappingURL=relation-extraction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relation-extraction.d.ts","sourceRoot":"","sources":["../../../../src/extensions/argument-ingestion/stages/relation-extraction.ts"],"names":[],"mappings":"AASA,OAAO,EAMH,KAAK,yBAAyB,EAEjC,MAAM,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,iCAAiC,CAAA;
|
|
1
|
+
{"version":3,"file":"relation-extraction.d.ts","sourceRoot":"","sources":["../../../../src/extensions/argument-ingestion/stages/relation-extraction.ts"],"names":[],"mappings":"AASA,OAAO,EAMH,KAAK,yBAAyB,EAEjC,MAAM,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,iCAAiC,CAAA;AAC5E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAA;AAElE,eAAO,MAAM,yBAAyB,YAAY,CAAA;AAClD,eAAO,MAAM,6BAA6B,EACpC,SAAS,GACT,KAAK,GACL,QAAQ,GACR,MAAe,CAAA;AAErB,eAAO,MAAM,iCAAiC,6lEAuBqB,CAAA;AAuCnE,gEAAgE;AAChE,eAAO,MAAM,kCAAkC,EAAE,wBAEhD,CAAA;AAED,0EAA0E;AAC1E,wBAAgB,6BAA6B,CACzC,OAAO,CAAC,EAAE,wBAAwB,GACnC,MAAM,CAAC,yBAAyB,CAAC,CAenC;AAED,iDAAiD;AACjD,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,yBAAyB,CACnC,CAAA"}
|
|
@@ -62,16 +62,26 @@ function buildPrompt(ctx) {
|
|
|
62
62
|
const user = `Canonical claims (with refined types):\n${claimLines}\n\nSegments:\n${segmentLines}\n\nEmit every support relationship as a relations array.`;
|
|
63
63
|
return { system: markedSystem, user };
|
|
64
64
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
dependsOn: [
|
|
68
|
-
STAGE_IDS.claimCanonicalization,
|
|
69
|
-
STAGE_IDS.claimTypeClassification,
|
|
70
|
-
STAGE_IDS.segmentation,
|
|
71
|
-
],
|
|
72
|
-
outputSchema: RelationExtractionOutputSchema,
|
|
73
|
-
model: RELATION_EXTRACTION_MODEL,
|
|
65
|
+
/** Internal default knobs for the relation-extraction stage. */
|
|
66
|
+
export const RELATION_EXTRACTION_STAGE_DEFAULTS = {
|
|
74
67
|
reasoningEffort: RELATION_EXTRACTION_REASONING,
|
|
75
|
-
|
|
76
|
-
|
|
68
|
+
};
|
|
69
|
+
/** Build the relation-extraction stage with optional caller overrides. */
|
|
70
|
+
export function createRelationExtractionStage(options) {
|
|
71
|
+
return llmStage({
|
|
72
|
+
id: STAGE_IDS.relationExtraction,
|
|
73
|
+
dependsOn: [
|
|
74
|
+
STAGE_IDS.claimCanonicalization,
|
|
75
|
+
STAGE_IDS.claimTypeClassification,
|
|
76
|
+
STAGE_IDS.segmentation,
|
|
77
|
+
],
|
|
78
|
+
outputSchema: RelationExtractionOutputSchema,
|
|
79
|
+
model: RELATION_EXTRACTION_MODEL,
|
|
80
|
+
maxOutputTokens: options?.maxOutputTokens,
|
|
81
|
+
reasoningEffort: options?.reasoningEffort ?? RELATION_EXTRACTION_REASONING,
|
|
82
|
+
buildPrompt,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
/** Backward-compatible default-options stage. */
|
|
86
|
+
export const relationExtractionStage = createRelationExtractionStage();
|
|
77
87
|
//# sourceMappingURL=relation-extraction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relation-extraction.js","sourceRoot":"","sources":["../../../../src/extensions/argument-ingestion/stages/relation-extraction.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,kEAAkE;AAClE,qDAAqD;AACrD,EAAE;AACF,qEAAqE;AACrE,qEAAqE;AACrE,wDAAwD;AACxD,6CAA6C;AAE7C,OAAO,EACH,SAAS,EACT,8BAA8B,GAMjC,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAA;
|
|
1
|
+
{"version":3,"file":"relation-extraction.js","sourceRoot":"","sources":["../../../../src/extensions/argument-ingestion/stages/relation-extraction.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,kEAAkE;AAClE,qDAAqD;AACrD,EAAE;AACF,qEAAqE;AACrE,qEAAqE;AACrE,wDAAwD;AACxD,6CAA6C;AAE7C,OAAO,EACH,SAAS,EACT,8BAA8B,GAMjC,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAA;AAIlE,MAAM,CAAC,MAAM,yBAAyB,GAAG,SAAS,CAAA;AAClD,MAAM,CAAC,MAAM,6BAA6B,GAI3B,MAAM,CAAA;AAErB,MAAM,CAAC,MAAM,iCAAiC,GAAG;;;;;;;;;;;;;;;;;;;;;;;mEAuBkB,CAAA;AAEnE,SAAS,WAAW,CAAC,GAAkB;IACnC,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CACjB,SAAS,CAAC,qBAAqB,CAClC,CAAA;IACD,MAAM,YAAY,GAAG,GAAG,CAAC,GAAG,CACxB,SAAS,CAAC,uBAAuB,CACpC,CAAA;IACD,MAAM,YAAY,GAAG,IAAI,GAAG,EAAyC,CAAA;IACrE,KAAK,M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AED,gEAAgE;AAChE,MAAM,CAAC,MAAM,kCAAkC,GAA6B;IACxE,eAAe,EAAE,6BAA6B;CACjD,CAAA;AAED,0EAA0E;AAC1E,MAAM,UAAU,6BAA6B,CACzC,OAAkC;IAElC,OAAO,QAAQ,CAA4B;QACvC,EAAE,EAAE,SAAS,CAAC,kBAAkB;QAChC,SAAS,EAAE;YACP,SAAS,CAAC,qBAAqB;YAC/B,SAAS,CAAC,uBAAuB;YACjC,SAAS,CAAC,YAAY;SACzB;QACD,YAAY,EAAE,8BAA8B;QAC5C,KAAK,EAAE,yBAAyB;QAChC,eAAe,EAAE,OAAO,EAAE,eAAe;QACzC,eAAe,EACX,OAAO,EAAE,eAAe,IAAI,6BAA6B;QAC7D,WAAW;KACd,CAAC,CAAA;AACN,CAAC;AAED,iDAAiD;AACjD,MAAM,CAAC,MAAM,uBAAuB,GAChC,6BAA6B,EAAE,CAAA"}
|
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
import { type TSegmentationOutput } from "./schemas.js";
|
|
2
2
|
import type { TStage } from "../../../lib/pipelines/types.js";
|
|
3
|
+
import type { TLlmStageOptionsOverride } from "../shared/types.js";
|
|
3
4
|
export declare const SEGMENTATION_MODEL = "gpt-5.4-mini";
|
|
5
|
+
export declare const SEGMENTATION_MAX_OUTPUT_TOKENS = 8192;
|
|
4
6
|
export declare const SEGMENTATION_SYSTEM_PROMPT = "You are the first stage of an argument-ingestion pipeline. Your job is to split the supplied input text into a list of segments.\n\nReturn an object with a single key `segments` whose value is the array of segments.\n\nA segment is a sentence-or-thereabouts span of text \u2014 a self-contained clause that a human could read on its own. Sentence-final punctuation usually marks segment boundaries; bullet items in a list count as separate segments; multi-clause sentences split into one segment per major clause when the clauses each carry their own assertion.\n\nAssign each segment a short stable id like \"s1\", \"s2\", ... in left-to-right order, copy the segment's text verbatim (no rewriting), and record the character \"span\" as an object with \"start\" (inclusive) and \"end\" (exclusive) character offsets into the input. Whitespace between segments is owned by neither segment.\n\nCover the input completely: every non-whitespace character must fall inside some segment's span. Do not invent text. Do not classify segments \u2014 that is a later stage's job.";
|
|
7
|
+
/**
|
|
8
|
+
* Internal default knobs for the segmentation stage. Exported so the
|
|
9
|
+
* pipeline factory can compose `resolveLlmStageOptions` over them.
|
|
10
|
+
*/
|
|
11
|
+
export declare const SEGMENTATION_STAGE_DEFAULTS: TLlmStageOptionsOverride;
|
|
12
|
+
/**
|
|
13
|
+
* Build the segmentation stage with optional caller overrides. The
|
|
14
|
+
* pipeline factory threads `TLlmStageOptionsOverride` through this
|
|
15
|
+
* factory; standalone consumers can call it with no args to get the
|
|
16
|
+
* default-options stage.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createSegmentationStage(options?: TLlmStageOptionsOverride): TStage<TSegmentationOutput>;
|
|
19
|
+
/**
|
|
20
|
+
* Backward-compatible default-options stage. Existing consumers
|
|
21
|
+
* (tests, the v2 factory's pre-1.3.1 path) keep importing this and
|
|
22
|
+
* see the new internal defaults — same as if they had called
|
|
23
|
+
* `createSegmentationStage()` with no args.
|
|
24
|
+
*/
|
|
5
25
|
export declare const segmentationStage: TStage<TSegmentationOutput>;
|
|
6
26
|
//# sourceMappingURL=segmentation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"segmentation.d.ts","sourceRoot":"","sources":["../../../../src/extensions/argument-ingestion/stages/segmentation.ts"],"names":[],"mappings":"AAYA,OAAO,EAGH,KAAK,mBAAmB,EAC3B,MAAM,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,iCAAiC,CAAA;
|
|
1
|
+
{"version":3,"file":"segmentation.d.ts","sourceRoot":"","sources":["../../../../src/extensions/argument-ingestion/stages/segmentation.ts"],"names":[],"mappings":"AAYA,OAAO,EAGH,KAAK,mBAAmB,EAC3B,MAAM,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,iCAAiC,CAAA;AAC5E,OAAO,KAAK,EAER,wBAAwB,EAC3B,MAAM,oBAAoB,CAAA;AAE3B,eAAO,MAAM,kBAAkB,iBAAiB,CAAA;AAqBhD,eAAO,MAAM,8BAA8B,OAAO,CAAA;AAElD,eAAO,MAAM,0BAA0B,mjCAQsI,CAAA;AAY7K;;;GAGG;AACH,eAAO,MAAM,2BAA2B,EAAE,wBAEzC,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACnC,OAAO,CAAC,EAAE,wBAAwB,GACnC,MAAM,CAAC,mBAAmB,CAAC,CAW7B;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,mBAAmB,CAC7B,CAAA"}
|
|
@@ -12,6 +12,26 @@
|
|
|
12
12
|
import { STAGE_IDS, SegmentationOutputSchema, } from "./schemas.js";
|
|
13
13
|
import { llmStage } from "../../../lib/pipelines/stage-helpers.js";
|
|
14
14
|
export const SEGMENTATION_MODEL = "gpt-5.4-mini";
|
|
15
|
+
// **Output cap (v1.3.1 fix for the segmentation-truncation
|
|
16
|
+
// regression).** Segmentation emits an array of `{ segmentId, text,
|
|
17
|
+
// span }` records — each segment's `text` is copied verbatim from
|
|
18
|
+
// the input (per the prompt). For a 15 KB input the model
|
|
19
|
+
// legitimately wants 30–50 segments at ~80–150 tokens of JSON each,
|
|
20
|
+
// so the output budget needs to comfortably exceed 5 k tokens.
|
|
21
|
+
// Without an explicit cap the Responses API's default
|
|
22
|
+
// `max_output_tokens` for `gpt-5.4-mini` kicks in mid-string and
|
|
23
|
+
// the model returns `status: "incomplete"` + partial JSON; v1.3.0
|
|
24
|
+
// reproduced this against Singer's "Solution to World Poverty"
|
|
25
|
+
// (15.5 KB / ~4 k input tokens). 8192 tokens is roughly 2× the
|
|
26
|
+
// expected upper bound on realistic input sizes and stays well below
|
|
27
|
+
// any per-model context-window limit — comfortable headroom without
|
|
28
|
+
// burning tokens on an over-spec'd cap.
|
|
29
|
+
//
|
|
30
|
+
// Callers that ingest larger inputs can raise the cap further via
|
|
31
|
+
// `createIngestionV2Pipeline(extension, { llm: { overrides: {
|
|
32
|
+
// segmentation: { maxOutputTokens: N } } } })` — see
|
|
33
|
+
// `shared/types.ts`.
|
|
34
|
+
export const SEGMENTATION_MAX_OUTPUT_TOKENS = 8192;
|
|
15
35
|
export const SEGMENTATION_SYSTEM_PROMPT = `You are the first stage of an argument-ingestion pipeline. Your job is to split the supplied input text into a list of segments.
|
|
16
36
|
|
|
17
37
|
Return an object with a single key \`segments\` whose value is the array of segments.
|
|
@@ -27,11 +47,35 @@ function buildSegmentationPrompt(ctx) {
|
|
|
27
47
|
const user = `Input text:\n\n${input.text}`;
|
|
28
48
|
return { system: markedSystem, user };
|
|
29
49
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
50
|
+
/**
|
|
51
|
+
* Internal default knobs for the segmentation stage. Exported so the
|
|
52
|
+
* pipeline factory can compose `resolveLlmStageOptions` over them.
|
|
53
|
+
*/
|
|
54
|
+
export const SEGMENTATION_STAGE_DEFAULTS = {
|
|
55
|
+
maxOutputTokens: SEGMENTATION_MAX_OUTPUT_TOKENS,
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Build the segmentation stage with optional caller overrides. The
|
|
59
|
+
* pipeline factory threads `TLlmStageOptionsOverride` through this
|
|
60
|
+
* factory; standalone consumers can call it with no args to get the
|
|
61
|
+
* default-options stage.
|
|
62
|
+
*/
|
|
63
|
+
export function createSegmentationStage(options) {
|
|
64
|
+
return llmStage({
|
|
65
|
+
id: STAGE_IDS.segmentation,
|
|
66
|
+
dependsOn: [],
|
|
67
|
+
outputSchema: SegmentationOutputSchema,
|
|
68
|
+
model: SEGMENTATION_MODEL,
|
|
69
|
+
maxOutputTokens: options?.maxOutputTokens ?? SEGMENTATION_MAX_OUTPUT_TOKENS,
|
|
70
|
+
reasoningEffort: options?.reasoningEffort,
|
|
71
|
+
buildPrompt: buildSegmentationPrompt,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Backward-compatible default-options stage. Existing consumers
|
|
76
|
+
* (tests, the v2 factory's pre-1.3.1 path) keep importing this and
|
|
77
|
+
* see the new internal defaults — same as if they had called
|
|
78
|
+
* `createSegmentationStage()` with no args.
|
|
79
|
+
*/
|
|
80
|
+
export const segmentationStage = createSegmentationStage();
|
|
37
81
|
//# sourceMappingURL=segmentation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"segmentation.js","sourceRoot":"","sources":["../../../../src/extensions/argument-ingestion/stages/segmentation.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,kEAAkE;AAClE,mEAAmE;AACnE,kCAAkC;AAClC,EAAE;AACF,+DAA+D;AAC/D,mEAAmE;AACnE,qEAAqE;AACrE,qEAAqE;AACrE,qEAAqE;AACrE,gBAAgB;AAEhB,OAAO,EACH,SAAS,EACT,wBAAwB,GAE3B,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAA;
|
|
1
|
+
{"version":3,"file":"segmentation.js","sourceRoot":"","sources":["../../../../src/extensions/argument-ingestion/stages/segmentation.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,kEAAkE;AAClE,mEAAmE;AACnE,kCAAkC;AAClC,EAAE;AACF,+DAA+D;AAC/D,mEAAmE;AACnE,qEAAqE;AACrE,qEAAqE;AACrE,qEAAqE;AACrE,gBAAgB;AAEhB,OAAO,EACH,SAAS,EACT,wBAAwB,GAE3B,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAA;AAOlE,MAAM,CAAC,MAAM,kBAAkB,GAAG,cAAc,CAAA;AAEhD,2DAA2D;AAC3D,oEAAoE;AACpE,kEAAkE;AAClE,0DAA0D;AAC1D,oEAAoE;AACpE,+DAA+D;AAC/D,sDAAsD;AACtD,iEAAiE;AACjE,kEAAkE;AAClE,+DAA+D;AAC/D,+DAA+D;AAC/D,qEAAqE;AACrE,oEAAoE;AACpE,wCAAwC;AACxC,EAAE;AACF,kEAAkE;AAClE,8DAA8D;AAC9D,qDAAqD;AACrD,qBAAqB;AACrB,MAAM,CAAC,MAAM,8BAA8B,GAAG,IAAI,CAAA;AAElD,MAAM,CAAC,MAAM,0BAA0B,GAAG;;;;;;;;6KAQmI,CAAA;AAE7K,SAAS,uBAAuB,CAAC,GAAkB;IAI/C,MAAM,KAAK,GAAG,GAAG,CAAC,KAAwB,CAAA;IAC1C,MAAM,YAAY,GAAG,kBAAkB,SAAS,CAAC,YAAY,SAAS,0BAA0B,EAAE,CAAA;IAClG,MAAM,IAAI,GAAG,kBAAkB,KAAK,CAAC,IAAI,EAAE,CAAA;IAC3C,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,CAAA;AACzC,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAA6B;IACjE,eAAe,EAAE,8BAA8B;CAClD,CAAA;AAED;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CACnC,OAAkC;IAElC,OAAO,QAAQ,CAAsB;QACjC,EAAE,EAAE,SAAS,CAAC,YAAY;QAC1B,SAAS,EAAE,EAAE;QACb,YAAY,EAAE,wBAAwB;QACtC,KAAK,EAAE,kBAAkB;QACzB,eAAe,EACX,OAAO,EAAE,eAAe,IAAI,8BAA8B;QAC9D,eAAe,EAAE,OAAO,EAAE,eAAe;QACzC,WAAW,EAAE,uBAAuB;KACvC,CAAC,CAAA;AACN,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAC1B,uBAAuB,EAAE,CAAA"}
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import type { TPipeline } from "../../lib/pipelines/index.js";
|
|
2
2
|
import type { TParsedArgumentResponse } from "../../lib/parsing/index.js";
|
|
3
|
-
import type { TIngestionExtension, TIngestionInput } from "./shared/types.js";
|
|
3
|
+
import type { TIngestionExtension, TIngestionInput, TIngestionLlmOptions } from "./shared/types.js";
|
|
4
|
+
export declare const V1_PARSE_STAGE_ID = "parse-argument";
|
|
4
5
|
export type TCreateIngestionV1PipelineOptions = {
|
|
5
6
|
/** Override the default `gpt-5.4` model. */
|
|
6
7
|
model?: string;
|
|
7
8
|
/** Optional caller-supplied custom-instructions appendix. */
|
|
8
9
|
customInstructions?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Per-stage LLM-knob overrides. v1 has a single LLM stage
|
|
12
|
+
* (`V1_PARSE_STAGE_ID === "parse-argument"`); both `defaults`
|
|
13
|
+
* and an entry under `overrides[V1_PARSE_STAGE_ID]` apply to it,
|
|
14
|
+
* with the per-stage entry winning over `defaults`.
|
|
15
|
+
*/
|
|
16
|
+
llm?: TIngestionLlmOptions;
|
|
9
17
|
};
|
|
10
18
|
/**
|
|
11
19
|
* Build the v1 ingestion pipeline for the supplied extension.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v1-single-shot.d.ts","sourceRoot":"","sources":["../../../src/extensions/argument-ingestion/v1-single-shot.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAE7D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"v1-single-shot.d.ts","sourceRoot":"","sources":["../../../src/extensions/argument-ingestion/v1-single-shot.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAE7D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAA;AAGzE,OAAO,KAAK,EACR,mBAAmB,EACnB,eAAe,EACf,oBAAoB,EACvB,MAAM,mBAAmB,CAAA;AAI1B,eAAO,MAAM,iBAAiB,mBAAmB,CAAA;AAIjD,MAAM,MAAM,iCAAiC,GAAG;IAC5C,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,6DAA6D;IAC7D,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B;;;;;OAKG;IACH,GAAG,CAAC,EAAE,oBAAoB,CAAA;CAC7B,CAAA;AAMD;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACrC,SAAS,EAAE,mBAAmB,EAC9B,OAAO,CAAC,EAAE,iCAAiC,GAC5C,SAAS,CAAC,eAAe,EAAE,uBAAuB,CAAC,CA8ErD"}
|
|
@@ -26,9 +26,10 @@ import Type from "typebox";
|
|
|
26
26
|
import { llmStage } from "../../lib/pipelines/index.js";
|
|
27
27
|
import { buildParsingPrompt } from "../../lib/parsing/index.js";
|
|
28
28
|
import { finalizeResponse } from "./shared/finalize-response.js";
|
|
29
|
+
import { resolveLlmStageOptions } from "./shared/resolve-llm-stage-options.js";
|
|
29
30
|
const PIPELINE_ID = "argument-ingestion-v1";
|
|
30
31
|
const PIPELINE_VERSION = "1.0.0";
|
|
31
|
-
const
|
|
32
|
+
export const V1_PARSE_STAGE_ID = "parse-argument";
|
|
32
33
|
const DEFAULT_PARSE_MODEL = "gpt-5.4";
|
|
33
34
|
const INGESTION_INPUT_SCHEMA = Type.Object({
|
|
34
35
|
text: Type.String({ minLength: 1 }),
|
|
@@ -49,12 +50,18 @@ export function createIngestionV1Pipeline(extension, options) {
|
|
|
49
50
|
// RecordingLlmProvider) can key replays by stage. The OpenAI
|
|
50
51
|
// provider treats this as an inert HTML comment in the system
|
|
51
52
|
// message.
|
|
52
|
-
const markedSystemPrompt = `<!-- stage-id: ${
|
|
53
|
+
const markedSystemPrompt = `<!-- stage-id: ${V1_PARSE_STAGE_ID} -->\n${systemPrompt}`;
|
|
54
|
+
// v1 has no internal LLM-knob defaults (the single stage shipped
|
|
55
|
+
// 1.1.0 without a `maxOutputTokens` cap or `reasoningEffort` —
|
|
56
|
+
// any caller overrides land directly on the request).
|
|
57
|
+
const parseStageLlmOptions = resolveLlmStageOptions(V1_PARSE_STAGE_ID, {}, options?.llm);
|
|
53
58
|
const parseStage = llmStage({
|
|
54
|
-
id:
|
|
59
|
+
id: V1_PARSE_STAGE_ID,
|
|
55
60
|
dependsOn: [],
|
|
56
61
|
outputSchema: extension.responseSchema,
|
|
57
62
|
model,
|
|
63
|
+
maxOutputTokens: parseStageLlmOptions.maxOutputTokens,
|
|
64
|
+
reasoningEffort: parseStageLlmOptions.reasoningEffort,
|
|
58
65
|
buildPrompt: (ctx) => {
|
|
59
66
|
const input = ctx.input;
|
|
60
67
|
return {
|
|
@@ -83,16 +90,16 @@ export function createIngestionV1Pipeline(extension, options) {
|
|
|
83
90
|
outputSchema: extension.responseSchema,
|
|
84
91
|
stages: [parseStage],
|
|
85
92
|
finalize: {
|
|
86
|
-
dependsOn: [
|
|
93
|
+
dependsOn: [V1_PARSE_STAGE_ID],
|
|
87
94
|
run: (ctx) => {
|
|
88
|
-
const parsed = ctx.get(
|
|
95
|
+
const parsed = ctx.get(V1_PARSE_STAGE_ID);
|
|
89
96
|
if (!parsed) {
|
|
90
97
|
// Defensive: finalize.dependsOn is required, so
|
|
91
98
|
// the executor only invokes us when the upstream
|
|
92
99
|
// stage completed. If we still got here without
|
|
93
100
|
// an output, the framework is misbehaving — throw
|
|
94
101
|
// rather than emit a half-built response.
|
|
95
|
-
throw new Error(`Pipeline "${PIPELINE_ID}" finalize invoked without a "${
|
|
102
|
+
throw new Error(`Pipeline "${PIPELINE_ID}" finalize invoked without a "${V1_PARSE_STAGE_ID}" output.`);
|
|
96
103
|
}
|
|
97
104
|
return finalizeResponse({
|
|
98
105
|
parsedResponse: parsed,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v1-single-shot.js","sourceRoot":"","sources":["../../../src/extensions/argument-ingestion/v1-single-shot.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,EAAE;AACF,sEAAsE;AACtE,qEAAqE;AACrE,qEAAqE;AACrE,oEAAoE;AACpE,+DAA+D;AAC/D,uDAAuD;AACvD,sBAAsB;AACtB,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,mEAAmE;AACnE,qEAAqE;AACrE,6DAA6D;AAC7D,qEAAqE;AACrE,gEAAgE;AAChE,gEAAgE;AAChE,+DAA+D;AAC/D,kEAAkE;AAClE,EAAE;AACF,oEAAoE;AACpE,mEAAmE;AACnE,8CAA8C;AAE9C,OAAO,IAAI,MAAM,SAAS,CAAA;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAE/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;
|
|
1
|
+
{"version":3,"file":"v1-single-shot.js","sourceRoot":"","sources":["../../../src/extensions/argument-ingestion/v1-single-shot.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,EAAE;AACF,sEAAsE;AACtE,qEAAqE;AACrE,qEAAqE;AACrE,oEAAoE;AACpE,+DAA+D;AAC/D,uDAAuD;AACvD,sBAAsB;AACtB,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,mEAAmE;AACnE,qEAAqE;AACrE,6DAA6D;AAC7D,qEAAqE;AACrE,gEAAgE;AAChE,gEAAgE;AAChE,+DAA+D;AAC/D,kEAAkE;AAClE,EAAE;AACF,oEAAoE;AACpE,mEAAmE;AACnE,8CAA8C;AAE9C,OAAO,IAAI,MAAM,SAAS,CAAA;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAA;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAE/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAA;AAO9E,MAAM,WAAW,GAAG,uBAAuB,CAAA;AAC3C,MAAM,gBAAgB,GAAG,OAAO,CAAA;AAChC,MAAM,CAAC,MAAM,iBAAiB,GAAG,gBAA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nC,4DAA4D;QAC5D,2DAA2D;QAC3D,sDAAsD;QACtD,8DAA8D;QAC9D,8DAA8D;QAC9D,oDAAoD;QACpD,2DAA2D;QAC3D,yDAAyD;QACzD,4DAA4D;QAC5D,yDAAyD;QACzD,4DAA4D;QAC5D,4DAA4D;QAC5D,mBAAmB;QACnB,YAAY,EAAE,SAAS,CAAC,cAAc;QACtC,MAAM,EAAE,CAAC,UAAU,CAAC;QACpB,QAAQ,EAAE;YACN,SAAS,EAAE,CAAC,iBAAiB,CAAC;YAC9B,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE;gBACT,MAAM,MAAM,GACR,GAAG,CAAC,GAAG,CAA0B,iBAAiB,CAAC,CAAA;gBACvD,IAAI,CAAC,MAAM,EAAE,CAAC;oBACV,gDAAgD;oBAChD,iDAAiD;oBACjD,gDAAgD;oBAChD,kDAAkD;oBAClD,0CAA0C;oBAC1C,MAAM,IAAI,KAAK,CACX,aAAa,WAAW,iCAAiC,iBAAiB,WAAW,CACxF,CAAA;gBACL,CAAC;gBACD,OAAO,gBAAgB,CAAC;oBACpB,cAAc,EAAE,MAAM;oBACtB,QAAQ,EAAE,EAAE;iBACf,CAAC,CAAA;YACN,CAAC;SACJ;KACJ,CAAA;AACL,CAAC"}
|
|
@@ -1,6 +1,29 @@
|
|
|
1
1
|
import type { TPipeline } from "../../lib/pipelines/index.js";
|
|
2
2
|
import type { TParsedArgumentResponse } from "../../lib/parsing/index.js";
|
|
3
|
-
import type { TIngestionExtension, TIngestionInput } from "./shared/types.js";
|
|
3
|
+
import type { TIngestionExtension, TIngestionInput, TIngestionLlmOptions } from "./shared/types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Options for `createIngestionV2Pipeline`.
|
|
6
|
+
*
|
|
7
|
+
* `llm.defaults` applies to every LLM stage that doesn't have a
|
|
8
|
+
* per-stage entry under `llm.overrides`; per-stage entries are keyed
|
|
9
|
+
* by stage id (`STAGE_IDS.segmentation`, etc.). The effective knobs
|
|
10
|
+
* compose stage-override > pipeline-default > internal stage default.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* createIngestionV2Pipeline(basicsExtension, {
|
|
15
|
+
* llm: {
|
|
16
|
+
* defaults: { maxOutputTokens: 16_384 },
|
|
17
|
+
* overrides: {
|
|
18
|
+
* [STAGE_IDS.segmentation]: { maxOutputTokens: 32_768 },
|
|
19
|
+
* },
|
|
20
|
+
* },
|
|
21
|
+
* })
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export type TCreateIngestionV2PipelineOptions = {
|
|
25
|
+
llm?: TIngestionLlmOptions;
|
|
26
|
+
};
|
|
4
27
|
/**
|
|
5
28
|
* Build the v2 multi-stage ingestion pipeline for the supplied
|
|
6
29
|
* extension. Returns a `TPipeline` whose stages match the 12-stage
|
|
@@ -11,5 +34,5 @@ import type { TIngestionExtension, TIngestionInput } from "./shared/types.js";
|
|
|
11
34
|
* descriptor and returns immediately. Stage execution happens inside
|
|
12
35
|
* `executePipeline`.
|
|
13
36
|
*/
|
|
14
|
-
export declare function createIngestionV2Pipeline(extension: TIngestionExtension): TPipeline<TIngestionInput, TParsedArgumentResponse>;
|
|
37
|
+
export declare function createIngestionV2Pipeline(extension: TIngestionExtension, options?: TCreateIngestionV2PipelineOptions): TPipeline<TIngestionInput, TParsedArgumentResponse>;
|
|
15
38
|
//# sourceMappingURL=v2-multi-stage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v2-multi-stage.d.ts","sourceRoot":"","sources":["../../../src/extensions/argument-ingestion/v2-multi-stage.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"v2-multi-stage.d.ts","sourceRoot":"","sources":["../../../src/extensions/argument-ingestion/v2-multi-stage.ts"],"names":[],"mappings":"AAwDA,OAAO,KAAK,EAAE,SAAS,EAAU,MAAM,8BAA8B,CAAA;AACrE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAA;AAGzE,OAAO,KAAK,EACR,mBAAmB,EACnB,eAAe,EACf,oBAAoB,EACvB,MAAM,mBAAmB,CAAA;AAS1B;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,iCAAiC,GAAG;IAC5C,GAAG,CAAC,EAAE,oBAAoB,CAAA;CAC7B,CAAA;AAED;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACrC,SAAS,EAAE,mBAAmB,EAC9B,OAAO,CAAC,EAAE,iCAAiC,GAC5C,SAAS,CAAC,eAAe,EAAE,uBAAuB,CAAC,CAkGrD"}
|
|
@@ -29,9 +29,10 @@
|
|
|
29
29
|
// 4 deterministic stages (claim-reference-validation, variable-assignment,
|
|
30
30
|
// formula-compilation, formula-validation) + 8 LLM stages.
|
|
31
31
|
import Type from "typebox";
|
|
32
|
-
import { STAGE_IDS,
|
|
32
|
+
import { STAGE_IDS, claimReferenceValidationStage, createAxiomIndicatorDetectionStage, createCitationSourceDetectionStage, createClaimCanonicalizationStage, createClaimMentionExtractionStage, createClaimTypeClassificationStage, createConclusionSelectionStage, createRelationExtractionStage, createSegmentationStage, formulaCompilationStage, formulaValidationStage, variableAssignmentStage, SEGMENTATION_STAGE_DEFAULTS, CLAIM_MENTION_EXTRACTION_STAGE_DEFAULTS, CITATION_SOURCE_DETECTION_STAGE_DEFAULTS, AXIOM_INDICATOR_DETECTION_STAGE_DEFAULTS, CLAIM_CANONICALIZATION_STAGE_DEFAULTS, CLAIM_TYPE_CLASSIFICATION_STAGE_DEFAULTS, RELATION_EXTRACTION_STAGE_DEFAULTS, CONCLUSION_SELECTION_STAGE_DEFAULTS, } from "./stages/index.js";
|
|
33
33
|
import { optional } from "../../lib/pipelines/index.js";
|
|
34
34
|
import { finalizeResponseV2 } from "./shared/finalize-response-v2.js";
|
|
35
|
+
import { resolveLlmStageOptions } from "./shared/resolve-llm-stage-options.js";
|
|
35
36
|
const PIPELINE_ID = "argument-ingestion-v2";
|
|
36
37
|
const PIPELINE_VERSION = "1.0.0";
|
|
37
38
|
const INGESTION_INPUT_SCHEMA = Type.Object({
|
|
@@ -47,8 +48,16 @@ const INGESTION_INPUT_SCHEMA = Type.Object({
|
|
|
47
48
|
* descriptor and returns immediately. Stage execution happens inside
|
|
48
49
|
* `executePipeline`.
|
|
49
50
|
*/
|
|
50
|
-
export function createIngestionV2Pipeline(extension) {
|
|
51
|
-
const
|
|
51
|
+
export function createIngestionV2Pipeline(extension, options) {
|
|
52
|
+
const llm = options?.llm;
|
|
53
|
+
const segmentationStage = createSegmentationStage(resolveLlmStageOptions(STAGE_IDS.segmentation, SEGMENTATION_STAGE_DEFAULTS, llm));
|
|
54
|
+
const claimMentionExtractionStage = createClaimMentionExtractionStage(resolveLlmStageOptions(STAGE_IDS.claimMentionExtraction, CLAIM_MENTION_EXTRACTION_STAGE_DEFAULTS, llm));
|
|
55
|
+
const citationSourceDetectionStage = createCitationSourceDetectionStage(resolveLlmStageOptions(STAGE_IDS.citationSourceDetection, CITATION_SOURCE_DETECTION_STAGE_DEFAULTS, llm));
|
|
56
|
+
const axiomIndicatorDetectionStage = createAxiomIndicatorDetectionStage(resolveLlmStageOptions(STAGE_IDS.axiomIndicatorDetection, AXIOM_INDICATOR_DETECTION_STAGE_DEFAULTS, llm));
|
|
57
|
+
const canonicalizationStage = createClaimCanonicalizationStage(extension, resolveLlmStageOptions(STAGE_IDS.claimCanonicalization, CLAIM_CANONICALIZATION_STAGE_DEFAULTS, llm));
|
|
58
|
+
const claimTypeClassificationStage = createClaimTypeClassificationStage(resolveLlmStageOptions(STAGE_IDS.claimTypeClassification, CLAIM_TYPE_CLASSIFICATION_STAGE_DEFAULTS, llm));
|
|
59
|
+
const relationExtractionStage = createRelationExtractionStage(resolveLlmStageOptions(STAGE_IDS.relationExtraction, RELATION_EXTRACTION_STAGE_DEFAULTS, llm));
|
|
60
|
+
const conclusionSelectionStage = createConclusionSelectionStage(resolveLlmStageOptions(STAGE_IDS.conclusionSelection, CONCLUSION_SELECTION_STAGE_DEFAULTS, llm));
|
|
52
61
|
const stages = [
|
|
53
62
|
segmentationStage,
|
|
54
63
|
claimMentionExtractionStage,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v2-multi-stage.js","sourceRoot":"","sources":["../../../src/extensions/argument-ingestion/v2-multi-stage.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,EAAE;AACF,iEAAiE;AACjE,yEAAyE;AACzE,kEAAkE;AAClE,wEAAwE;AACxE,kEAAkE;AAClE,EAAE;AACF,mBAAmB;AACnB,EAAE;AACF,iBAAiB;AACjB,gEAAgE;AAChE,+DAA+D;AAC/D,+DAA+D;AAC/D,+DAA+D;AAC/D,+DAA+D;AAC/D,+DAA+D;AAC/D,+DAA+D;AAC/D,+DAA+D;AAC/D,qEAAqE;AACrE,8DAA8D;AAC9D,sEAAsE;AACtE,8DAA8D;AAC9D,qEAAqE;AACrE,8DAA8D;AAC9D,oEAAoE;AACpE,iEAAiE;AACjE,EAAE;AACF,2EAA2E;AAC3E,2DAA2D;AAE3D,OAAO,IAAI,MAAM,SAAS,CAAA;AAC1B,OAAO,EACH,SAAS,EACT,
|
|
1
|
+
{"version":3,"file":"v2-multi-stage.js","sourceRoot":"","sources":["../../../src/extensions/argument-ingestion/v2-multi-stage.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,EAAE;AACF,iEAAiE;AACjE,yEAAyE;AACzE,kEAAkE;AAClE,wEAAwE;AACxE,kEAAkE;AAClE,EAAE;AACF,mBAAmB;AACnB,EAAE;AACF,iBAAiB;AACjB,gEAAgE;AAChE,+DAA+D;AAC/D,+DAA+D;AAC/D,+DAA+D;AAC/D,+DAA+D;AAC/D,+DAA+D;AAC/D,+DAA+D;AAC/D,+DAA+D;AAC/D,qEAAqE;AACrE,8DAA8D;AAC9D,sEAAsE;AACtE,8DAA8D;AAC9D,qEAAqE;AACrE,8DAA8D;AAC9D,oEAAoE;AACpE,iEAAiE;AACjE,EAAE;AACF,2EAA2E;A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AC,SAAS,CAAC,kBAAkB,CAAC;gBACtC,QAAQ,CAAC,SAAS,CAAC,mBAAmB,CAAC;gBACvC,QAAQ,CAAC,SAAS,CAAC,iBAAiB,CAAC;gBACrC,QAAQ,CAAC,SAAS,CAAC,wBAAwB,CAAC;aAC/C;YACD,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,kBAAkB,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC;SACvD;KACJ,CAAA;AACL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/extensions/openai/provider.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EACR,YAAY,EAKf,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/extensions/openai/provider.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EACR,YAAY,EAKf,MAAM,wBAAwB,CAAA;AAc/B,OAAO,KAAK,EACR,YAAY,EAMf,MAAM,YAAY,CAAA;AAOnB,MAAM,MAAM,qCAAqC,GAAG;IAChD,MAAM,EAAE,MAAM,CAAA;IACd,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;OAIG;IACH,KAAK,CAAC,EAAE,YAAY,CAAA;IACpB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC7B,CAAA;AAED,wBAAgB,6BAA6B,CACzC,OAAO,EAAE,qCAAqC,GAC/C,YAAY,CAmRd"}
|