@proposit/proposit-core 5.0.0 → 5.2.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/README.md +3 -2
- package/dist/cli/builder-repl.js +1 -1
- package/dist/cli/builder-repl.js.map +1 -1
- package/dist/extensions/citations/ieee/citation-claim.d.ts +117 -56
- package/dist/extensions/citations/ieee/citation-claim.d.ts.map +1 -1
- package/dist/extensions/citations/ieee/formatting.d.ts +1 -1
- package/dist/extensions/citations/ieee/formatting.d.ts.map +1 -1
- package/dist/extensions/citations/ieee/formatting.js.map +1 -1
- package/dist/extensions/citations/ieee/origin-document.d.ts +117 -56
- package/dist/extensions/citations/ieee/origin-document.d.ts.map +1 -1
- package/dist/extensions/citations/ieee/references.d.ts +364 -169
- package/dist/extensions/citations/ieee/references.d.ts.map +1 -1
- package/dist/extensions/citations/ieee/references.js +42 -4
- package/dist/extensions/citations/ieee/references.js.map +1 -1
- package/dist/extensions/citations/ieee/relaxed.d.ts +351 -168
- package/dist/extensions/citations/ieee/relaxed.d.ts.map +1 -1
- package/dist/extensions/citations/ieee/segment-builder.d.ts.map +1 -1
- package/dist/extensions/citations/ieee/segment-builder.js +11 -7
- package/dist/extensions/citations/ieee/segment-builder.js.map +1 -1
- package/dist/extensions/citations/ieee/segment-templates.d.ts +2 -0
- package/dist/extensions/citations/ieee/segment-templates.d.ts.map +1 -1
- package/dist/extensions/citations/ieee/segment-templates.js +121 -11
- package/dist/extensions/citations/ieee/segment-templates.js.map +1 -1
- package/dist/extensions/openai/openai-retrieval.d.ts.map +1 -1
- package/dist/extensions/openai/openai-retrieval.js +4 -2
- package/dist/extensions/openai/openai-retrieval.js.map +1 -1
- package/dist/extensions/openai/openai-tools.d.ts +8 -1
- package/dist/extensions/openai/openai-tools.d.ts.map +1 -1
- package/dist/extensions/openai/openai-tools.js +10 -0
- package/dist/extensions/openai/openai-tools.js.map +1 -1
- package/dist/extensions/openai/provider.d.ts.map +1 -1
- package/dist/extensions/openai/provider.js +5 -3
- package/dist/extensions/openai/provider.js.map +1 -1
- package/dist/extensions/openai/types.d.ts +2 -1
- package/dist/extensions/openai/types.d.ts.map +1 -1
- package/dist/extensions/openai/types.js.map +1 -1
- package/dist/extensions/pipelines/base/finalize-response-v2.d.ts +9 -6
- package/dist/extensions/pipelines/base/finalize-response-v2.d.ts.map +1 -1
- package/dist/extensions/pipelines/base/finalize-response-v2.js +101 -20
- package/dist/extensions/pipelines/base/finalize-response-v2.js.map +1 -1
- package/dist/extensions/pipelines/base/index.d.ts +1 -1
- package/dist/extensions/pipelines/base/index.d.ts.map +1 -1
- package/dist/extensions/pipelines/base/index.js.map +1 -1
- package/dist/extensions/pipelines/base/source-anchors.d.ts +33 -2
- package/dist/extensions/pipelines/base/source-anchors.d.ts.map +1 -1
- package/dist/extensions/pipelines/base/source-anchors.js +191 -13
- package/dist/extensions/pipelines/base/source-anchors.js.map +1 -1
- package/dist/extensions/pipelines/base/stages/axiom-indicator-detection.d.ts +1 -1
- package/dist/extensions/pipelines/base/stages/axiom-indicator-detection.d.ts.map +1 -1
- package/dist/extensions/pipelines/base/stages/axiom-indicator-detection.js +1 -1
- package/dist/extensions/pipelines/base/stages/axiom-indicator-detection.js.map +1 -1
- package/dist/extensions/pipelines/base/stages/citation-source-detection.d.ts +1 -1
- package/dist/extensions/pipelines/base/stages/citation-source-detection.d.ts.map +1 -1
- package/dist/extensions/pipelines/base/stages/citation-source-detection.js +1 -1
- package/dist/extensions/pipelines/base/stages/citation-source-detection.js.map +1 -1
- package/dist/extensions/pipelines/base/stages/claim-canonicalization.d.ts +3 -2
- package/dist/extensions/pipelines/base/stages/claim-canonicalization.d.ts.map +1 -1
- package/dist/extensions/pipelines/base/stages/claim-canonicalization.js +2 -2
- package/dist/extensions/pipelines/base/stages/claim-canonicalization.js.map +1 -1
- package/dist/extensions/pipelines/base/stages/claim-mention-extraction.d.ts +1 -1
- package/dist/extensions/pipelines/base/stages/claim-mention-extraction.d.ts.map +1 -1
- package/dist/extensions/pipelines/base/stages/claim-mention-extraction.js +1 -1
- package/dist/extensions/pipelines/base/stages/claim-mention-extraction.js.map +1 -1
- package/dist/extensions/pipelines/base/stages/claim-type-classification.d.ts +1 -1
- package/dist/extensions/pipelines/base/stages/claim-type-classification.d.ts.map +1 -1
- package/dist/extensions/pipelines/base/stages/claim-type-classification.js +1 -1
- package/dist/extensions/pipelines/base/stages/claim-type-classification.js.map +1 -1
- package/dist/extensions/pipelines/base/stages/conclusion-selection.d.ts +26 -3
- package/dist/extensions/pipelines/base/stages/conclusion-selection.d.ts.map +1 -1
- package/dist/extensions/pipelines/base/stages/conclusion-selection.js +40 -2
- package/dist/extensions/pipelines/base/stages/conclusion-selection.js.map +1 -1
- package/dist/extensions/pipelines/base/stages/index.d.ts +1 -1
- package/dist/extensions/pipelines/base/stages/index.d.ts.map +1 -1
- package/dist/extensions/pipelines/base/stages/index.js +1 -1
- package/dist/extensions/pipelines/base/stages/index.js.map +1 -1
- package/dist/extensions/pipelines/base/stages/relation-extraction.d.ts +4 -3
- package/dist/extensions/pipelines/base/stages/relation-extraction.d.ts.map +1 -1
- package/dist/extensions/pipelines/base/stages/relation-extraction.js +6 -4
- package/dist/extensions/pipelines/base/stages/relation-extraction.js.map +1 -1
- package/dist/extensions/pipelines/base/stages/segmentation.d.ts +1 -1
- package/dist/extensions/pipelines/base/stages/segmentation.d.ts.map +1 -1
- package/dist/extensions/pipelines/base/stages/segmentation.js +1 -1
- package/dist/extensions/pipelines/base/stages/segmentation.js.map +1 -1
- package/dist/extensions/pipelines/base/types.d.ts +1 -1
- package/dist/extensions/pipelines/ingestion/scribe/extract-stage.d.ts +61 -10
- package/dist/extensions/pipelines/ingestion/scribe/extract-stage.d.ts.map +1 -1
- package/dist/extensions/pipelines/ingestion/scribe/extract-stage.js +203 -14
- package/dist/extensions/pipelines/ingestion/scribe/extract-stage.js.map +1 -1
- package/dist/extensions/pipelines/ingestion/scribe/schemas.d.ts +15 -2
- package/dist/extensions/pipelines/ingestion/scribe/schemas.d.ts.map +1 -1
- package/dist/extensions/pipelines/ingestion/scribe/schemas.js +14 -2
- package/dist/extensions/pipelines/ingestion/scribe/schemas.js.map +1 -1
- package/dist/extensions/pipelines/ingestion/scribe/scribe.js +2 -2
- package/dist/extensions/pipelines/ingestion/scribe/scribe.js.map +1 -1
- package/dist/extensions/pipelines/ingestion/scribe/source-attachment.d.ts +29 -0
- package/dist/extensions/pipelines/ingestion/scribe/source-attachment.d.ts.map +1 -0
- package/dist/extensions/pipelines/ingestion/scribe/source-attachment.js +200 -0
- package/dist/extensions/pipelines/ingestion/scribe/source-attachment.js.map +1 -0
- package/dist/extensions/pipelines/ingestion/scribe/structure-stage.d.ts +5 -3
- package/dist/extensions/pipelines/ingestion/scribe/structure-stage.d.ts.map +1 -1
- package/dist/extensions/pipelines/ingestion/scribe/structure-stage.js +42 -14
- package/dist/extensions/pipelines/ingestion/scribe/structure-stage.js.map +1 -1
- package/dist/lib/core/parser/formula-gen.js +309 -46
- package/dist/lib/llm/types.d.ts +8 -2
- package/dist/lib/llm/types.d.ts.map +1 -1
- package/dist/lib/llm/types.js.map +1 -1
- package/dist/lib/pipelines/debug-log.js +1 -1
- package/dist/lib/pipelines/debug-log.js.map +1 -1
- package/dist/lib/pipelines/index.d.ts +1 -1
- package/dist/lib/pipelines/index.d.ts.map +1 -1
- package/dist/lib/pipelines/index.js.map +1 -1
- package/dist/lib/pipelines/llm-stage-helpers.d.ts +22 -1
- package/dist/lib/pipelines/llm-stage-helpers.d.ts.map +1 -1
- package/dist/lib/pipelines/llm-stage-helpers.js +21 -9
- package/dist/lib/pipelines/llm-stage-helpers.js.map +1 -1
- package/dist/lib/pipelines/single-stage.d.ts +9 -1
- package/dist/lib/pipelines/single-stage.d.ts.map +1 -1
- package/dist/lib/pipelines/single-stage.js +14 -3
- package/dist/lib/pipelines/single-stage.js.map +1 -1
- package/dist/lib/pipelines/stage-helpers.d.ts +1 -1
- package/dist/lib/pipelines/stage-helpers.d.ts.map +1 -1
- package/dist/lib/pipelines/stage-helpers.js.map +1 -1
- package/dist/lib/schemata/shared.d.ts.map +1 -1
- package/dist/lib/schemata/shared.js +8 -6
- package/dist/lib/schemata/shared.js.map +1 -1
- package/package.json +1 -1
|
@@ -12,12 +12,50 @@
|
|
|
12
12
|
// selected.'". The full ranked list rides along on the stage output for
|
|
13
13
|
// consumers that want to offer alternates.
|
|
14
14
|
//
|
|
15
|
-
// This is a strong-reasoning stage:
|
|
15
|
+
// This is a strong-reasoning stage: reasoning_effort=medium.
|
|
16
16
|
import { STAGE_IDS, ConclusionSelectionLlmOutputSchema, ConclusionSelectionOutputSchema, } from "./schemas.js";
|
|
17
17
|
import { llmStage } from "../../../../lib/pipelines/stage-helpers.js";
|
|
18
|
-
export const CONCLUSION_SELECTION_MODEL = "gpt-
|
|
18
|
+
export const CONCLUSION_SELECTION_MODEL = "gpt-6-sol";
|
|
19
19
|
export const CONCLUSION_SELECTION_REASONING = "medium";
|
|
20
20
|
export const CONCLUSION_SELECTION_NO_CONCLUSION_FAILURE_CODE = "NO_SINGLE_CONCLUSION";
|
|
21
|
+
/**
|
|
22
|
+
* The failure a stage reports when the model found no structure in claims
|
|
23
|
+
* that must have some, and what a reader is shown when retrying did not
|
|
24
|
+
* help.
|
|
25
|
+
*/
|
|
26
|
+
export const NO_ARGUMENT_STRUCTURE_FAILURE = {
|
|
27
|
+
code: "NO_ARGUMENT_STRUCTURE",
|
|
28
|
+
message: "Couldn't work out how these claims connect to a conclusion.",
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* `llmStage` content check shared by the stages that propose an argument's
|
|
32
|
+
* structure: once at least two canonical claims are normal, the model must
|
|
33
|
+
* name at least one relation and — when `conclusionCandidates` is given —
|
|
34
|
+
* at least one conclusion candidate. With fewer there is nothing to
|
|
35
|
+
* connect, so an empty answer is accepted. A failure retries the stage;
|
|
36
|
+
* see `llmStage`'s `checkOutput`.
|
|
37
|
+
*/
|
|
38
|
+
export function checkArgumentStructure(ctx, output) {
|
|
39
|
+
// Count claims the way the structure prompts list them: each canonical
|
|
40
|
+
// claim once, typed by its classification when it has one. Counting
|
|
41
|
+
// raw classification entries would let a repeated or unknown id demand
|
|
42
|
+
// a relation among claims the model was never shown.
|
|
43
|
+
const typeByMiniId = new Map();
|
|
44
|
+
for (const entry of ctx.get(STAGE_IDS.claimTypeClassification)?.classifications ?? []) {
|
|
45
|
+
typeByMiniId.set(entry.miniId, entry.type);
|
|
46
|
+
}
|
|
47
|
+
const normalClaims = new Set((ctx.get(STAGE_IDS.claimCanonicalization)?.canonicalClaims ?? [])
|
|
48
|
+
.filter((c) => (typeByMiniId.get(c.miniId) ?? c.type) === "normal")
|
|
49
|
+
.map((c) => c.miniId)).size;
|
|
50
|
+
if (normalClaims < 2)
|
|
51
|
+
return undefined;
|
|
52
|
+
if (output.relations.length === 0)
|
|
53
|
+
return NO_ARGUMENT_STRUCTURE_FAILURE;
|
|
54
|
+
if (output.conclusionCandidates?.length === 0) {
|
|
55
|
+
return NO_ARGUMENT_STRUCTURE_FAILURE;
|
|
56
|
+
}
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
21
59
|
export const CONCLUSION_SELECTION_SYSTEM_PROMPT = `You select the conclusion claim of an argument from the canonical claim set and the relation graph.
|
|
22
60
|
|
|
23
61
|
You receive:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conclusion-selection.js","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/base/stages/conclusion-selection.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,wEAAwE;AACxE,sEAAsE;AACtE,wEAAwE;AACxE,iEAAiE;AACjE,qEAAqE;AACrE,yEAAyE;AACzE,sEAAsE;AACtE,uDAAuD;AACvD,wEAAwE;AACxE,gEAAgE;AAChE,wEAAwE;AACxE,2CAA2C;AAC3C,EAAE;AACF,
|
|
1
|
+
{"version":3,"file":"conclusion-selection.js","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/base/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REFERENCE
|
|
|
10
10
|
export { variableAssignmentStage, assignVariables, isValidVariableSymbol, } from "./variable-assignment.js";
|
|
11
11
|
export type { TAssignVariablesInput } from "./variable-assignment.js";
|
|
12
12
|
export { relationExtractionStage, createRelationExtractionStage, RELATION_EXTRACTION_STAGE_DEFAULTS, } from "./relation-extraction.js";
|
|
13
|
-
export { conclusionSelectionStage, createConclusionSelectionStage, selectFallbackConclusion, CONCLUSION_SELECTION_STAGE_DEFAULTS, CONCLUSION_SELECTION_NO_CONCLUSION_FAILURE_CODE, } from "./conclusion-selection.js";
|
|
13
|
+
export { conclusionSelectionStage, createConclusionSelectionStage, selectFallbackConclusion, checkArgumentStructure, CONCLUSION_SELECTION_STAGE_DEFAULTS, CONCLUSION_SELECTION_NO_CONCLUSION_FAILURE_CODE, NO_ARGUMENT_STRUCTURE_FAILURE, } from "./conclusion-selection.js";
|
|
14
14
|
export { formulaCompilationStage, compileFormulas, FORMULA_COMPILATION_FAILURE_CODES, } from "./formula-compilation.js";
|
|
15
15
|
export type { TCompileFormulasInput, TFreeformRelation, } from "./formula-compilation.js";
|
|
16
16
|
export { formulaValidationStage, validateFormulas, FORMULA_VALIDATION_FAILURE_CODES, } from "./formula-validation.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/base/stages/index.ts"],"names":[],"mappings":"AAIA,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,EACrC,mBAAmB,EACnB,sBAAsB,GACzB,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,YAAY,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AACrE,OAAO,EACH,uBAAuB,EACvB,6BAA6B,EAC7B,kCAAkC,GACrC,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACH,wBAAwB,EACxB,8BAA8B,EAC9B,wBAAwB,EACxB,mCAAmC,EACnC,+CAA+C,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/base/stages/index.ts"],"names":[],"mappings":"AAIA,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,EACrC,mBAAmB,EACnB,sBAAsB,GACzB,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,YAAY,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AACrE,OAAO,EACH,uBAAuB,EACvB,6BAA6B,EAC7B,kCAAkC,GACrC,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACH,wBAAwB,EACxB,8BAA8B,EAC9B,wBAAwB,EACxB,sBAAsB,EACtB,mCAAmC,EACnC,+CAA+C,EAC/C,6BAA6B,GAChC,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACH,uBAAuB,EACvB,eAAe,EACf,iCAAiC,GACpC,MAAM,0BAA0B,CAAA;AACjC,YAAY,EACR,qBAAqB,EACrB,iBAAiB,GACpB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACH,sBAAsB,EACtB,gBAAgB,EAChB,gCAAgC,GACnC,MAAM,yBAAyB,CAAA;AAChC,YAAY,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA"}
|
|
@@ -12,7 +12,7 @@ export { claimTypeClassificationStage, createClaimTypeClassificationStage, CLAIM
|
|
|
12
12
|
export { claimReferenceValidationStage, validateClaimReferences, CLAIM_REFERENCE_FAILURE_CODES, } from "./claim-reference-validation.js";
|
|
13
13
|
export { variableAssignmentStage, assignVariables, isValidVariableSymbol, } from "./variable-assignment.js";
|
|
14
14
|
export { relationExtractionStage, createRelationExtractionStage, RELATION_EXTRACTION_STAGE_DEFAULTS, } from "./relation-extraction.js";
|
|
15
|
-
export { conclusionSelectionStage, createConclusionSelectionStage, selectFallbackConclusion, CONCLUSION_SELECTION_STAGE_DEFAULTS, CONCLUSION_SELECTION_NO_CONCLUSION_FAILURE_CODE, } from "./conclusion-selection.js";
|
|
15
|
+
export { conclusionSelectionStage, createConclusionSelectionStage, selectFallbackConclusion, checkArgumentStructure, CONCLUSION_SELECTION_STAGE_DEFAULTS, CONCLUSION_SELECTION_NO_CONCLUSION_FAILURE_CODE, NO_ARGUMENT_STRUCTURE_FAILURE, } from "./conclusion-selection.js";
|
|
16
16
|
export { formulaCompilationStage, compileFormulas, FORMULA_COMPILATION_FAILURE_CODES, } from "./formula-compilation.js";
|
|
17
17
|
export { formulaValidationStage, validateFormulas, FORMULA_VALIDATION_FAILURE_CODES, } from "./formula-validation.js";
|
|
18
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/base/stages/index.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,sEAAsE;AACtE,qEAAqE;AAErE,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,EACrC,mBAAmB,EACnB,sBAAsB,GACzB,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;AAEjC,OAAO,EACH,uBAAuB,EACvB,6BAA6B,EAC7B,kCAAkC,GACrC,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACH,wBAAwB,EACxB,8BAA8B,EAC9B,wBAAwB,EACxB,mCAAmC,EACnC,+CAA+C,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/base/stages/index.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,sEAAsE;AACtE,qEAAqE;AAErE,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,EACrC,mBAAmB,EACnB,sBAAsB,GACzB,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;AAEjC,OAAO,EACH,uBAAuB,EACvB,6BAA6B,EAC7B,kCAAkC,GACrC,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACH,wBAAwB,EACxB,8BAA8B,EAC9B,wBAAwB,EACxB,sBAAsB,EACtB,mCAAmC,EACnC,+CAA+C,EAC/C,6BAA6B,GAChC,MAAM,2BAA2B,CAAA;AAClC,OAAO,EACH,uBAAuB,EACvB,eAAe,EACf,iCAAiC,GACpC,MAAM,0BAA0B,CAAA;AAKjC,OAAO,EACH,sBAAsB,EACtB,gBAAgB,EAChB,gCAAgC,GACnC,MAAM,yBAAyB,CAAA"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type TRelationExtractionOutput } from "./schemas.js";
|
|
2
|
+
import type { TReasoningEffort } from "../../../../lib/llm/types.js";
|
|
2
3
|
import type { TStage } from "../../../../lib/pipelines/types.js";
|
|
3
4
|
import type { TLlmStageOptionsOverride } from "../types.js";
|
|
4
|
-
export declare const RELATION_EXTRACTION_MODEL = "gpt-
|
|
5
|
-
export declare const RELATION_EXTRACTION_REASONING:
|
|
6
|
-
export declare const RELATION_EXTRACTION_SYSTEM_PROMPT = "You identify inference 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 inference. Return an object with a single key `relations` whose value is the array.\n\nAn `inference` relation says: the claims in `antecedents`, taken together, imply the claim in `consequent`. Use a SINGLE antecedent for an ordinary \"P, therefore Q\" step; use MULTIPLE antecedents when the author commits to a step that requires ALL of them to hold together (e.g. major premise + minor premise \u2192 conclusion).\n\nFor each relation emit:\n- a fresh `relationId` (r1, r2, ...)\n- `type` \u2014 always `\"inference\"`\n- `antecedents` \u2014 an array of the supporting claim miniIds (one or more) whose conjunction implies the consequent\n- `consequent` \u2014 the implied claim's miniId\n- `title` \u2014 a short noun phrase naming what this step DOES in the argument \u2014 the inferential move, not the proposition. Do not restate the consequent: that claim's own title is already shown directly beneath this one. Aim for under 60 characters. Examples: \"Limits of the crowd's power\", \"Residence as tacit consent\", \"Principle over survival\".\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`antecedents` and `consequent` are CLAIM miniIds \u2014 NOT source citations. A citation-typed or axiomatic-typed claim may appear in `antecedents` (the pipeline routes it to where it belongs); do not special-case it. A citation/axiomatic claim is never a `consequent`.\n\n## Conservatism rules\n\n- Do not invent relations. If the author doesn't actually argue from the antecedents to the consequent, don't emit a relation.\n- Do not double-count. If several claims share the same backing, emit one relation per consequent, not a redundant pairing.\n- The conclusion of the argument is identified in a separate stage; do NOT emit a special \"conclusion\" relation here. Just emit the inference edges you see; the conclusion stage selects from your output.\n- Avoid attack/rebuttal relations entirely for now \u2014 the pipeline does not yet handle them.\n\
|
|
5
|
+
export declare const RELATION_EXTRACTION_MODEL = "gpt-6-sol";
|
|
6
|
+
export declare const RELATION_EXTRACTION_REASONING: TReasoningEffort;
|
|
7
|
+
export declare const RELATION_EXTRACTION_SYSTEM_PROMPT = "You identify inference 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 inference. Return an object with a single key `relations` whose value is the array.\n\nAn `inference` relation says: the claims in `antecedents`, taken together, imply the claim in `consequent`. Use a SINGLE antecedent for an ordinary \"P, therefore Q\" step; use MULTIPLE antecedents when the author commits to a step that requires ALL of them to hold together (e.g. major premise + minor premise \u2192 conclusion).\n\nFor each relation emit:\n- a fresh `relationId` (r1, r2, ...)\n- `type` \u2014 always `\"inference\"`\n- `antecedents` \u2014 an array of the supporting claim miniIds (one or more) whose conjunction implies the consequent\n- `consequent` \u2014 the implied claim's miniId\n- `title` \u2014 a short noun phrase naming what this step DOES in the argument \u2014 the inferential move, not the proposition. Do not restate the consequent: that claim's own title is already shown directly beneath this one. Aim for under 60 characters. Examples: \"Limits of the crowd's power\", \"Residence as tacit consent\", \"Principle over survival\". Every relation's title must differ from every other relation's \u2014 two steps never share a name.\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`antecedents` and `consequent` are CLAIM miniIds \u2014 NOT source citations. A citation-typed or axiomatic-typed claim may appear in `antecedents` (the pipeline routes it to where it belongs); do not special-case it. A citation/axiomatic claim is never a `consequent`.\n\n## Conservatism rules\n\n- Do not invent relations. If the author doesn't actually argue from the antecedents to the consequent, don't emit a relation.\n- Do not double-count. If several claims share the same backing, emit one relation per consequent, not a redundant pairing.\n- The conclusion of the argument is identified in a separate stage; do NOT emit a special \"conclusion\" relation here. Just emit the inference edges you see; the conclusion stage selects from your output.\n- Avoid attack/rebuttal relations entirely for now \u2014 the pipeline does not yet handle them.\n\nEmit the relations the author actually argues. An argument with at least two normal-typed claims has at least one, so look for it before concluding there is none. Never invent support the author does not give: if the claims genuinely do not connect, return `{ \"relations\": [] }`.";
|
|
7
8
|
/** Internal default knobs for the relation-extraction stage. */
|
|
8
9
|
export declare const RELATION_EXTRACTION_STAGE_DEFAULTS: TLlmStageOptionsOverride;
|
|
9
10
|
/** Build the relation-extraction stage with optional caller overrides. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relation-extraction.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/base/stages/relation-extraction.ts"],"names":[],"mappings":"AAUA,OAAO,EAMH,KAAK,yBAAyB,EAEjC,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"relation-extraction.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/base/stages/relation-extraction.ts"],"names":[],"mappings":"AAUA,OAAO,EAMH,KAAK,yBAAyB,EAEjC,MAAM,cAAc,CAAA;AACrB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAGpE,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,oCAAoC,CAAA;AAC/E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AAE3D,eAAO,MAAM,yBAAyB,cAAc,CAAA;AACpD,eAAO,MAAM,6BAA6B,EAAE,gBAAyB,CAAA;AAErE,eAAO,MAAM,iCAAiC,gqFAwB4O,CAAA;AAuC1R,gEAAgE;AAChE,eAAO,MAAM,kCAAkC,EAAE,wBAGhD,CAAA;AAED,0EAA0E;AAC1E,wBAAgB,6BAA6B,CACzC,OAAO,CAAC,EAAE,wBAAwB,GACnC,MAAM,CAAC,yBAAyB,CAAC,CAiBnC;AAED,iDAAiD;AACjD,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,yBAAyB,CACnC,CAAA"}
|
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
// `inference`: its `antecedents` claims, taken together, imply its
|
|
4
4
|
// `consequent` claim.
|
|
5
5
|
//
|
|
6
|
-
// This stage uses
|
|
6
|
+
// This stage uses reasoning_effort=high — it's the most
|
|
7
7
|
// subtle judgement call in the pipeline. The output is a graph; the
|
|
8
8
|
// conclusion + the inference graph drive the formula-compilation stage
|
|
9
9
|
// that comes next.
|
|
10
10
|
import { STAGE_IDS, RelationExtractionOutputSchema, } from "./schemas.js";
|
|
11
11
|
import { llmStage } from "../../../../lib/pipelines/stage-helpers.js";
|
|
12
|
-
|
|
12
|
+
import { checkArgumentStructure } from "./conclusion-selection.js";
|
|
13
|
+
export const RELATION_EXTRACTION_MODEL = "gpt-6-sol";
|
|
13
14
|
export const RELATION_EXTRACTION_REASONING = "high";
|
|
14
15
|
export const RELATION_EXTRACTION_SYSTEM_PROMPT = `You identify inference relationships between canonical claims in an argument.
|
|
15
16
|
|
|
@@ -22,7 +23,7 @@ For each relation emit:
|
|
|
22
23
|
- \`type\` — always \`"inference"\`
|
|
23
24
|
- \`antecedents\` — an array of the supporting claim miniIds (one or more) whose conjunction implies the consequent
|
|
24
25
|
- \`consequent\` — the implied claim's miniId
|
|
25
|
-
- \`title\` — a short noun phrase naming what this step DOES in the argument — the inferential move, not the proposition. Do not restate the consequent: that claim's own title is already shown directly beneath this one. Aim for under 60 characters. Examples: "Limits of the crowd's power", "Residence as tacit consent", "Principle over survival".
|
|
26
|
+
- \`title\` — a short noun phrase naming what this step DOES in the argument — the inferential move, not the proposition. Do not restate the consequent: that claim's own title is already shown directly beneath this one. Aim for under 60 characters. Examples: "Limits of the crowd's power", "Residence as tacit consent", "Principle over survival". Every relation's title must differ from every other relation's — two steps never share a name.
|
|
26
27
|
- \`evidence.segmentIds\` — the segments that ground the relation (often a single segment containing a "therefore", "so", "because")
|
|
27
28
|
- \`evidence.quote\` — a short verbatim quote from the input that justifies the relation
|
|
28
29
|
|
|
@@ -35,7 +36,7 @@ For each relation emit:
|
|
|
35
36
|
- The conclusion of the argument is identified in a separate stage; do NOT emit a special "conclusion" relation here. Just emit the inference edges you see; the conclusion stage selects from your output.
|
|
36
37
|
- Avoid attack/rebuttal relations entirely for now — the pipeline does not yet handle them.
|
|
37
38
|
|
|
38
|
-
|
|
39
|
+
Emit the relations the author actually argues. An argument with at least two normal-typed claims has at least one, so look for it before concluding there is none. Never invent support the author does not give: if the claims genuinely do not connect, return \`{ "relations": [] }\`.`;
|
|
39
40
|
function buildPrompt(ctx) {
|
|
40
41
|
const canon = ctx.get(STAGE_IDS.claimCanonicalization);
|
|
41
42
|
const typeEnvelope = ctx.get(STAGE_IDS.claimTypeClassification);
|
|
@@ -84,6 +85,7 @@ export function createRelationExtractionStage(options) {
|
|
|
84
85
|
reasoningEffort: options?.reasoningEffort ?? RELATION_EXTRACTION_REASONING,
|
|
85
86
|
retry: options?.retry,
|
|
86
87
|
buildPrompt,
|
|
88
|
+
checkOutput: (output, ctx) => checkArgumentStructure(ctx, output),
|
|
87
89
|
});
|
|
88
90
|
}
|
|
89
91
|
/** Backward-compatible default-options stage. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"relation-extraction.js","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/base/stages/relation-extraction.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,wEAAwE;AACxE,mEAAmE;AACnE,sBAAsB;AACtB,EAAE;AACF,
|
|
1
|
+
{"version":3,"file":"relation-extraction.js","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/base/stages/relation-extraction.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,wEAAwE;AACxE,mEAAmE;AACnE,sBAAsB;AACtB,EAAE;AACF,wDAAwD;AACxD,oEAAoE;AACpE,uEAAuE;AACvE,mBAAmB;AAEnB,OAAO,EACH,SAAS,EACT,8BAA8B,GAMjC,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,QAAQ,EAAE,MAAM,4CAA4C,CAAA;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAA;AAIlE,MAAM,CAAC,MAAM,yBAAyB,GAAG,WAAW,CAAA;AACpD,MAAM,CAAC,MAAM,6BAA6B,GAAqB,MAAM,CAAA;AAErE,MAAM,CAAC,MAAM,iCAAiC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;0RAwByO,CAAA;AAE1R,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,MAAM,KAAK,IAAI,YAAY,EAAE,eAAe,IAAI,EAAE,EAAE,CAAC;QACtD,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;IACzC,CAAC;IACD,MAAM,eAAe,GAAG,GAAG,CAAC,GAAG,CAAsB,SAAS,CAAC,YAAY,CAAC,CAAA;IAC5E,MAAM,QAAQ,GAAG,eAAe,EAAE,QAAQ,IAAI,EAAE,CAAA;IAEhD,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,eAAe,IAAI,EAAE,CAAC;SAC5C,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;QACP,MAAM,WAAW,G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QAClD,eAAe,EAAE,OAAO,EAAE,eAAe;QACzC,eAAe,EACX,OAAO,EAAE,eAAe,IAAI,6BAA6B;QAC7D,KAAK,EAAE,OAAO,EAAE,KAAK;QACrB,WAAW;QACX,WAAW,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC,sBAAsB,CAAC,GAAG,EAAE,MAAM,CAAC;KACpE,CAAC,CAAA;AACN,CAAC;AAED,iDAAiD;AACjD,MAAM,CAAC,MAAM,uBAAuB,GAChC,6BAA6B,EAAE,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type TSegmentationOutput } from "./schemas.js";
|
|
2
2
|
import type { TStage } from "../../../../lib/pipelines/types.js";
|
|
3
3
|
import type { TLlmStageOptionsOverride } from "../types.js";
|
|
4
|
-
export declare const SEGMENTATION_MODEL = "gpt-
|
|
4
|
+
export declare const SEGMENTATION_MODEL = "gpt-6-sol";
|
|
5
5
|
export declare const SEGMENTATION_MAX_OUTPUT_TOKENS = 8192;
|
|
6
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
7
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"segmentation.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/base/stages/segmentation.ts"],"names":[],"mappings":"AAYA,OAAO,EAGH,KAAK,mBAAmB,EAC3B,MAAM,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,oCAAoC,CAAA;AAC/E,OAAO,KAAK,EAAmB,wBAAwB,EAAE,MAAM,aAAa,CAAA;AAE5E,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"segmentation.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/base/stages/segmentation.ts"],"names":[],"mappings":"AAYA,OAAO,EAGH,KAAK,mBAAmB,EAC3B,MAAM,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,oCAAoC,CAAA;AAC/E,OAAO,KAAK,EAAmB,wBAAwB,EAAE,MAAM,aAAa,CAAA;AAE5E,eAAO,MAAM,kBAAkB,cAAc,CAAA;AAqB7C,eAAO,MAAM,8BAA8B,OAAO,CAAA;AAElD,eAAO,MAAM,0BAA0B,mjCAQsI,CAAA;AAY7K;;;GAGG;AACH,eAAO,MAAM,2BAA2B,EAAE,wBAGzC,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACnC,OAAO,CAAC,EAAE,wBAAwB,GACnC,MAAM,CAAC,mBAAmB,CAAC,CAY7B;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,mBAAmB,CAC7B,CAAA"}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// the same job.
|
|
12
12
|
import { STAGE_IDS, SegmentationOutputSchema, } from "./schemas.js";
|
|
13
13
|
import { llmStage } from "../../../../lib/pipelines/stage-helpers.js";
|
|
14
|
-
export const SEGMENTATION_MODEL = "gpt-
|
|
14
|
+
export const SEGMENTATION_MODEL = "gpt-6-sol";
|
|
15
15
|
// **Output cap (v1.3.1 fix for the segmentation-truncation
|
|
16
16
|
// regression).** Segmentation emits an array of `{ segmentId, text,
|
|
17
17
|
// span }` records — each segment's `text` is copied verbatim from
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"segmentation.js","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/base/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,4CAA4C,CAAA;AAIrE,MAAM,CAAC,MAAM,kBAAkB,GAAG,
|
|
1
|
+
{"version":3,"file":"segmentation.js","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/base/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,4CAA4C,CAAA;AAIrE,MAAM,CAAC,MAAM,kBAAkB,GAAG,WAAW,CAAA;AAE7C,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,0DAA0D;AAC1D,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,KAAK,EAAE,kBAAkB;IACzB,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,OAAO,EAAE,KAAK,IAAI,kBAAkB;QAC3C,eAAe,EACX,OAAO,EAAE,eAAe,IAAI,8BAA8B;QAC9D,eAAe,EAAE,OAAO,EAAE,eAAe;QACzC,KAAK,EAAE,OAAO,EAAE,KAAK;QACrB,WAAW,EAAE,uBAAuB;KACvC,CAAC,CAAA;AACN,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAC1B,uBAAuB,EAAE,CAAA"}
|
|
@@ -54,7 +54,7 @@ export type TIngestionInput = {
|
|
|
54
54
|
* different backend without forking the stages — e.g. pointing the
|
|
55
55
|
* whole v2 pipeline at a local model
|
|
56
56
|
* (`{ llm: { defaults: { model: "local-coder" } } }`) for cost-free
|
|
57
|
-
* local development. Each stage keeps its own hard-coded
|
|
57
|
+
* local development. Each stage keeps its own hard-coded model
|
|
58
58
|
* default when no override is supplied, so production behavior is
|
|
59
59
|
* unchanged.
|
|
60
60
|
*
|
|
@@ -1,23 +1,25 @@
|
|
|
1
|
-
import type { TStage } from "../../../../lib/pipelines/types.js";
|
|
1
|
+
import type { TStage, TStageContext } from "../../../../lib/pipelines/types.js";
|
|
2
2
|
import { type TClaimCanonicalizationOutput, type TClaimMentionExtractionOutput, type TClaimTypeClassificationOutput } from "../../base/stages/index.js";
|
|
3
3
|
import type { TIngestionExtension, TLlmStageOptionsOverride } from "../../base/types.js";
|
|
4
4
|
import { type TScribeExtractOutput } from "./schemas.js";
|
|
5
|
-
export declare const EXTRACT_MODEL = "gpt-
|
|
5
|
+
export declare const EXTRACT_MODEL = "gpt-6-sol";
|
|
6
6
|
/** Internal default knobs for scribe's `extract` stage. */
|
|
7
7
|
export declare const EXTRACT_STAGE_DEFAULTS: TLlmStageOptionsOverride;
|
|
8
|
-
export declare const EXTRACT_SYSTEM_PROMPT = "You read a raw argument and emit its canonical claim set in one pass.\n\nFor each distinct proposition the author makes, emit one canonical claim. Two phrasings of the same proposition merge into a single claim.\n\nAlso emit `mentions` \u2014 where in the input each claim is stated. One entry per place a claim is made:\n- `mentionId` \u2014 \"<claim miniId>-m\" for the first mention of a claim, then \"-m2\", \"-m3\", ... for further ones (e.g. \"c1-m\", \"c1-m2\").\n- `text` \u2014 the span of the input that states the claim, COPIED CHARACTER FOR CHARACTER from the input. Never reword, summarize, translate, correct, or join separated passages with an ellipsis, and do not change capitalization or punctuation \u2014 copy the first character exactly as the input has it, upper- or lower-case. Prefer the shortest span that states the claim on its own \u2014 usually one sentence or clause. A span that is not present in the input verbatim is discarded, and the claim loses its link back to the source.\n- `span` \u2014 approximate `{ start, end }` character offsets of that text in the input. A rough estimate is fine; the text is what is trusted.\n- `segmentId` \u2014 the empty string.\n\nEach canonical claim carries:\n- `miniId` \u2014 assign in order: c1, c2, c3, ...\n- `mentionIds` \u2014 the `mentionId`s of every mention that states this claim.\n- `type` \u2014 \"normal\" (a primary proposition), \"citation\" (content is \"the cited source asserts X\"; populate `url` + `title`, and set `citationTypeGuess`), or \"axiomatic\" (invoked as self-evident; populate `axiom`).\n- `citationTypeGuess` (citation claims only) \u2014 your best guess at the source's IEEE reference type, chosen from the allowed values in your output schema (e.g. \"JournalArticle\", \"NewspaperArticle\", \"Book\", \"Website\", \"GovernmentPublication\", \u2026). Use \"unknown\" when no IEEE type fits or you cannot tell.\n- `suggestedSymbol` \u2014 a short PascalCase-or-snake_case identifier (letters/digits/underscores, starts with a letter or underscore, under 32 chars). Avoid single letters and generic names.\n- the extension fields your output schema requires (title, body, url, axiom \u2014 whichever apply to the claim's type).\n- `mentionToClaim` \u2014 one `{ \"mentionId\": \"...\", \"claimMiniId\": \"...\" }` entry per mention id you used.\n\nStyle:\n- Third-person, present-tense, active voice.\n- State the proposition itself \u2014 never \"The author claims that ...\". For a citation claim, the title summarizes what the source asserts.\n\nOutput ONLY the schema-shaped object. No prose.";
|
|
8
|
+
export declare const EXTRACT_SYSTEM_PROMPT = "You read a raw argument and emit its canonical claim set in one pass.\n\nFor each distinct proposition the author makes, emit one canonical claim. Two phrasings of the same proposition merge into a single claim.\n\nEvery explicit link or URL the author offers as evidence becomes its own citation claim \u2014 one per distinct link, even when several links sit in one sentence or a link backs a claim you also emit as a normal claim.\n\nLines that begin with \"> \" quote someone else, usually the person the author is replying to. They are not the author's claims: never emit a claim from them, and use them only to understand what the author is responding to.\n\nAlso emit `mentions` \u2014 where in the input each claim is stated. One entry per place a claim is made:\n- `mentionId` \u2014 \"<claim miniId>-m\" for the first mention of a claim, then \"-m2\", \"-m3\", ... for further ones (e.g. \"c1-m\", \"c1-m2\").\n- `text` \u2014 the span of the input that states the claim, COPIED CHARACTER FOR CHARACTER from the input. Never reword, summarize, translate, correct, or join separated passages with an ellipsis, and do not change capitalization or punctuation \u2014 copy the first character exactly as the input has it, upper- or lower-case. Prefer the shortest span that states the claim on its own \u2014 usually one sentence or clause. A span that is not present in the input verbatim is discarded, and the claim loses its link back to the source.\n- `span` \u2014 approximate `{ start, end }` character offsets of that text in the input. A rough estimate is fine; the text is what is trusted.\n- `segmentId` \u2014 the empty string.\n\nEach canonical claim carries:\n- `miniId` \u2014 assign in order: c1, c2, c3, ...\n- `mentionIds` \u2014 the `mentionId`s of every mention that states this claim.\n- `type` \u2014 \"normal\" (a primary proposition), \"citation\" (content is \"the cited source asserts X\"; populate `url` + `title`, and set `citationTypeGuess`), or \"axiomatic\" (invoked as self-evident; populate `axiom`).\n- `url` (citation claims only) \u2014 a URL copied from the input exactly as written, scheme included. Never build one from a site name, domain or title (\"www.example.org\" is not \"https://www.example.org/\"); when the input gives the source no URL, use the empty string.\n- `citationTypeGuess` (citation claims only) \u2014 your best guess at the source's IEEE reference type, chosen from the allowed values in your output schema (e.g. \"JournalArticle\", \"NewspaperArticle\", \"Book\", \"Website\", \"GovernmentPublication\", \u2026). Use \"unknown\" when no IEEE type fits or you cannot tell.\n- `suggestedSymbol` \u2014 a short PascalCase-or-snake_case identifier (letters/digits/underscores, starts with a letter or underscore, under 32 chars). Avoid single letters and generic names.\n- the extension fields your output schema requires (title, body, url, axiom \u2014 whichever apply to the claim's type).\n- `mentionToClaim` \u2014 one `{ \"mentionId\": \"...\", \"claimMiniId\": \"...\" }` entry per mention id you used.\n- `sourceSupport` \u2014 one `{ \"sourceMiniId\": \"...\", \"supportedMiniId\": \"...\" }` entry per citation claim and per axiomatic claim: its miniId, and the miniId of the normal claim it is offered as evidence for, or invoked to justify \u2014 usually the claim stated in the same sentence, or just before it. The supported claim must be a normal claim, never a citation or axiomatic one.\n\nStyle:\n- Third-person, present-tense, active voice.\n- State the proposition itself \u2014 never \"The author claims that ...\". For a citation claim, the title summarizes what the source asserts.\n\nOutput ONLY the schema-shaped object. No prose.";
|
|
9
9
|
/**
|
|
10
10
|
* Build scribe's `extract` LLM stage. Its `outputSchema` is the
|
|
11
11
|
* per-extension canonicalization schema widened with the mention slot,
|
|
12
12
|
* so the cheap model is asked for the same extension-shaped claim
|
|
13
13
|
* records (title/body/url/axiom) scholar's canonicalizer produces —
|
|
14
14
|
* without which finalize would assemble empty claims — plus the quoted
|
|
15
|
-
* spans those claims came from.
|
|
15
|
+
* spans those claims came from, plus which claim each source supports.
|
|
16
16
|
*/
|
|
17
17
|
export declare function createExtractStage(extension: TIngestionExtension, options?: TLlmStageOptionsOverride): TStage<TScribeExtractOutput>;
|
|
18
18
|
/**
|
|
19
19
|
* Adapter — republish `extract`'s canonical claims under the
|
|
20
|
-
* canonicalization slot scholar's deterministic stages + finalize read
|
|
20
|
+
* canonicalization slot scholar's deterministic stages + finalize read,
|
|
21
|
+
* after `settleCitations` has checked their urls and merged citations of
|
|
22
|
+
* the same page.
|
|
21
23
|
*
|
|
22
24
|
* It picks the two keys rather than passing the whole output through:
|
|
23
25
|
* the canonicalization envelope is `additionalProperties: false`, so
|
|
@@ -28,6 +30,52 @@ export declare function createExtractStage(extension: TIngestionExtension, optio
|
|
|
28
30
|
* the extension's claim fields.
|
|
29
31
|
*/
|
|
30
32
|
export declare function createExtractCanonicalizationAdapterStage(extension: TIngestionExtension): TStage<TClaimCanonicalizationOutput>;
|
|
33
|
+
type TAddFailure = TStageContext["addFailure"];
|
|
34
|
+
/**
|
|
35
|
+
* `extract`'s output with its citations settled: a url the input does not
|
|
36
|
+
* contain is cleared (`SOURCE_URL_NOT_IN_TEXT_FAILURE_CODE`), one it
|
|
37
|
+
* contains in a slightly different form takes the text's form, and
|
|
38
|
+
* citations of the same page are merged into one
|
|
39
|
+
* (`SOURCE_DUPLICATE_MERGED_FAILURE_CODE`) — the first, unless it is an
|
|
40
|
+
* archive copy and the original is also cited. The kept citation takes
|
|
41
|
+
* the merged ones' mentions and supports what any of them supported.
|
|
42
|
+
*
|
|
43
|
+
* Deterministic, so every stage that reads `extract` directly can call it
|
|
44
|
+
* and see the same claim set; only one of them should report.
|
|
45
|
+
*/
|
|
46
|
+
export declare function settleCitations(extract: TScribeExtractOutput | undefined, inputText: string, addFailure: TAddFailure): TScribeExtractOutput | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Warning code for a citation url `extract` reported that the input does
|
|
49
|
+
* not contain. A model asked for a source's url will build one from a bare
|
|
50
|
+
* site name ("www.gutenberg.org" in a reference list becomes
|
|
51
|
+
* "https://www.gutenberg.org/"), and a link the author never gave is worse
|
|
52
|
+
* than none — so the url is cleared and the citation kept, since the
|
|
53
|
+
* source itself is still named in the text.
|
|
54
|
+
*/
|
|
55
|
+
export declare const SOURCE_URL_NOT_IN_TEXT_FAILURE_CODE = "SOURCE_URL_NOT_IN_TEXT";
|
|
56
|
+
/**
|
|
57
|
+
* Warning code for citations merged because their urls name the same page.
|
|
58
|
+
* A reference list often links one work several ways — an archive copy
|
|
59
|
+
* beside the original, `/index.html` beside `/` — and each became its own
|
|
60
|
+
* citation claim. `context` carries `keptMiniId` and `mergedMiniIds`.
|
|
61
|
+
*/
|
|
62
|
+
export declare const SOURCE_DUPLICATE_MERGED_FAILURE_CODE = "SOURCE_DUPLICATE_MERGED";
|
|
63
|
+
/**
|
|
64
|
+
* What two citation urls must share to name the same page: the url with
|
|
65
|
+
* an archive copy unwrapped to its original, http and https treated alike,
|
|
66
|
+
* the host lowercased and without a leading "www.", a trailing
|
|
67
|
+
* "index.html" or "index.htm" and a trailing slash dropped, and a DOI
|
|
68
|
+
* read the same through either resolver with its path percent-decoded.
|
|
69
|
+
* The fragment is kept: it names a place in the page, as a page number
|
|
70
|
+
* names one in a book.
|
|
71
|
+
*/
|
|
72
|
+
export declare function citationUrlKey(url: string): string;
|
|
73
|
+
/**
|
|
74
|
+
* The url as the input writes it, if the input contains it: the same link
|
|
75
|
+
* with only differences that cannot change where it goes — the case of the
|
|
76
|
+
* scheme and host, http for https or the reverse, and a trailing slash.
|
|
77
|
+
*/
|
|
78
|
+
export declare function findUrlInText(url: string, text: string): string | undefined;
|
|
31
79
|
/**
|
|
32
80
|
* Adapter — republish `extract`'s mentions under the mention slot
|
|
33
81
|
* finalize resolves into each claim's source anchors.
|
|
@@ -39,11 +87,14 @@ export declare function createExtractCanonicalizationAdapterStage(extension: TIn
|
|
|
39
87
|
*/
|
|
40
88
|
export declare const extractMentionAdapterStage: TStage<TClaimMentionExtractionOutput>;
|
|
41
89
|
/**
|
|
42
|
-
* Adapter — derive the classification slot from
|
|
43
|
-
* records: each
|
|
44
|
-
*
|
|
45
|
-
* `
|
|
46
|
-
*
|
|
90
|
+
* Adapter — derive the classification slot from the canonical claim
|
|
91
|
+
* records: each one already carries its `type`, so the classification
|
|
92
|
+
* entry is `{ miniId, type, sourceString }`. `sourceString` is the claim's
|
|
93
|
+
* `url` when present (citation claims), else null — mirroring what
|
|
94
|
+
* scholar's classification stage records. It reads the canonicalization
|
|
95
|
+
* slot rather than `extract` itself, so a url that adapter cleared is not
|
|
96
|
+
* carried here.
|
|
47
97
|
*/
|
|
48
98
|
export declare const extractClassificationAdapterStage: TStage<TClaimTypeClassificationOutput>;
|
|
99
|
+
export {};
|
|
49
100
|
//# sourceMappingURL=extract-stage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-stage.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/ingestion/scribe/extract-stage.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"extract-stage.d.ts","sourceRoot":"","sources":["../../../../../src/extensions/pipelines/ingestion/scribe/extract-stage.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAA;AAC/E,OAAO,EAKH,KAAK,4BAA4B,EACjC,KAAK,6BAA6B,EAClC,KAAK,8BAA8B,EACtC,MAAM,4BAA4B,CAAA;AACnC,OAAO,KAAK,EACR,mBAAmB,EAEnB,wBAAwB,EAC3B,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAEH,KAAK,oBAAoB,EAC5B,MAAM,cAAc,CAAA;AAErB,eAAO,MAAM,aAAa,cAAc,CAAA;AAExC,2DAA2D;AAC3D,eAAO,MAAM,sBAAsB,EAAE,wBAEpC,CAAA;AAED,eAAO,MAAM,qBAAqB,0oHA6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