@kortexya/reasoninglayer 0.13.0 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +96 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +698 -110
- package/dist/index.d.ts +698 -110
- package/dist/index.js +96 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/config.ts
|
|
2
|
-
var SDK_VERSION = "0.
|
|
2
|
+
var SDK_VERSION = "0.15.1";
|
|
3
3
|
function resolveConfig(config) {
|
|
4
4
|
if (!config.baseUrl) {
|
|
5
5
|
throw new Error("ClientConfig.baseUrl is required");
|
|
@@ -2425,17 +2425,18 @@ var Ingestion = class {
|
|
|
2425
2425
|
...params
|
|
2426
2426
|
});
|
|
2427
2427
|
/**
|
|
2428
|
-
*
|
|
2428
|
+
* @description Defaults to async dispatch: returns `202` with a session id and the pipeline runs in a background tokio task. Pass `?sync=true` to run the whole pipeline inside the request and get a `201` with the full result — suitable only for small ontologies because the embedding loop dominates wall time on large inputs.
|
|
2429
2429
|
*
|
|
2430
2430
|
* @tags ingestion
|
|
2431
2431
|
* @name IngestRdf
|
|
2432
|
-
* @summary Ingest RDF/OWL/SHACL data and convert to OSF
|
|
2432
|
+
* @summary Ingest RDF/OWL/SHACL data and convert to OSF.
|
|
2433
2433
|
* @request POST:/api/v1/ingest/rdf
|
|
2434
2434
|
* @secure
|
|
2435
2435
|
*/
|
|
2436
|
-
ingestRdf = (data, params = {}) => this.http.request({
|
|
2436
|
+
ingestRdf = (query, data, params = {}) => this.http.request({
|
|
2437
2437
|
path: `/api/v1/ingest/rdf`,
|
|
2438
2438
|
method: "POST",
|
|
2439
|
+
query,
|
|
2439
2440
|
body: data,
|
|
2440
2441
|
secure: true,
|
|
2441
2442
|
type: "application/json" /* Json */,
|
|
@@ -13114,6 +13115,40 @@ function OcrConfigDtoFromFrontToApi(model) {
|
|
|
13114
13115
|
use_llm_enhancement: model.useLlmEnhancement
|
|
13115
13116
|
};
|
|
13116
13117
|
}
|
|
13118
|
+
function ExtractionStrategyFromFrontToApi(model) {
|
|
13119
|
+
switch (model.type) {
|
|
13120
|
+
case "llm":
|
|
13121
|
+
return { type: "llm" };
|
|
13122
|
+
case "local_ner":
|
|
13123
|
+
return { type: "local_ner" };
|
|
13124
|
+
case "hybrid":
|
|
13125
|
+
return {
|
|
13126
|
+
type: "hybrid",
|
|
13127
|
+
ner_confidence_threshold: model.nerConfidenceThreshold
|
|
13128
|
+
};
|
|
13129
|
+
case "schema_guided":
|
|
13130
|
+
return {
|
|
13131
|
+
type: "schema_guided",
|
|
13132
|
+
ner_confidence_threshold: model.nerConfidenceThreshold,
|
|
13133
|
+
relation_confidence_threshold: model.relationConfidenceThreshold,
|
|
13134
|
+
escalate_unknown_types: model.escalateUnknownTypes
|
|
13135
|
+
};
|
|
13136
|
+
case "adaptive":
|
|
13137
|
+
return {
|
|
13138
|
+
type: "adaptive",
|
|
13139
|
+
fallback: ExtractionStrategyFromFrontToApi(model.fallback)
|
|
13140
|
+
};
|
|
13141
|
+
}
|
|
13142
|
+
}
|
|
13143
|
+
function EvidenceDerivationConfigDtoFromFrontToApi(model) {
|
|
13144
|
+
return {
|
|
13145
|
+
context_dependent_relations: model.contextDependentRelations,
|
|
13146
|
+
default_quality_weight: model.defaultQualityWeight,
|
|
13147
|
+
evidence_sort_name: model.evidenceSortName,
|
|
13148
|
+
negative_relations: model.negativeRelations,
|
|
13149
|
+
positive_relations: model.positiveRelations
|
|
13150
|
+
};
|
|
13151
|
+
}
|
|
13117
13152
|
function IngestionConfigDtoFromFrontToApi(model) {
|
|
13118
13153
|
return {
|
|
13119
13154
|
auto_create_sorts: model.autoCreateSorts,
|
|
@@ -13123,16 +13158,20 @@ function IngestionConfigDtoFromFrontToApi(model) {
|
|
|
13123
13158
|
domain_instructions: model.domainInstructions,
|
|
13124
13159
|
enable_description_consolidation: model.enableDescriptionConsolidation,
|
|
13125
13160
|
enable_entity_filtering: model.enableEntityFiltering,
|
|
13161
|
+
enable_evidence_enrichment: model.enableEvidenceEnrichment,
|
|
13126
13162
|
enable_focused_extraction: model.enableFocusedExtraction,
|
|
13127
13163
|
enable_schema_discovery: model.enableSchemaDiscovery,
|
|
13128
13164
|
enable_zero_degree_filtering: model.enableZeroDegreeFiltering,
|
|
13165
|
+
evidence_derivation_config: model.evidenceDerivationConfig ? EvidenceDerivationConfigDtoFromFrontToApi(model.evidenceDerivationConfig) : model.evidenceDerivationConfig,
|
|
13129
13166
|
extract_relations: model.extractRelations,
|
|
13130
|
-
extraction_strategy: model.extractionStrategy,
|
|
13167
|
+
extraction_strategy: model.extractionStrategy ? ExtractionStrategyFromFrontToApi(model.extractionStrategy) : void 0,
|
|
13168
|
+
force_extraction_strategy: model.forceExtractionStrategy,
|
|
13131
13169
|
max_schema_tokens: model.maxSchemaTokens,
|
|
13132
13170
|
ner_confidence_threshold: model.nerConfidenceThreshold,
|
|
13133
13171
|
ner_entity_labels: model.nerEntityLabels,
|
|
13134
13172
|
ner_relation_confidence_threshold: model.nerRelationConfidenceThreshold,
|
|
13135
13173
|
ner_relation_labels: model.nerRelationLabels,
|
|
13174
|
+
reject_anonymized_references: model.rejectAnonymizedReferences,
|
|
13136
13175
|
skip_fingerprint: model.skipFingerprint,
|
|
13137
13176
|
skip_relation_completion: model.skipRelationCompletion
|
|
13138
13177
|
};
|
|
@@ -13168,24 +13207,25 @@ function PipelineQualityStatsDtoFromApiToFront(dto) {
|
|
|
13168
13207
|
axiomsDeduplicated: dto.axioms_deduplicated,
|
|
13169
13208
|
dynamicConfigEntityThreshold: dto.dynamic_config_entity_threshold,
|
|
13170
13209
|
dynamicConfigRelationThreshold: dto.dynamic_config_relation_threshold,
|
|
13171
|
-
|
|
13172
|
-
|
|
13173
|
-
|
|
13174
|
-
fcaSortsCreated: dto.fca_sorts_created,
|
|
13210
|
+
entitiesRejected: dto.entities_rejected,
|
|
13211
|
+
entitiesSortCorrected: dto.entities_sort_corrected,
|
|
13212
|
+
entitiesValidated: dto.entities_validated,
|
|
13175
13213
|
feedbackAxiomsLearned: dto.feedback_axioms_learned,
|
|
13176
13214
|
feedbackPipelineAdjustments: dto.feedback_pipeline_adjustments,
|
|
13215
|
+
forwardChainingIssues: dto.forward_chaining_issues,
|
|
13216
|
+
fullyValid: dto.fully_valid,
|
|
13177
13217
|
hybridIntraBatchDeduped: dto.hybrid_intra_batch_deduped,
|
|
13218
|
+
incompleteEntities: dto.incomplete_entities,
|
|
13219
|
+
inconsistentSorts: dto.inconsistent_sorts,
|
|
13220
|
+
inferenceIterations: dto.inference_iterations,
|
|
13178
13221
|
inferenceRelationsDeduped: dto.inference_relations_deduped,
|
|
13179
13222
|
inferenceRulesApplied: dto.inference_rules_applied,
|
|
13180
13223
|
inferenceRulesFilteredLowConfidence: dto.inference_rules_filtered_low_confidence,
|
|
13181
13224
|
inferenceRulesInvalidScopeSort: dto.inference_rules_invalid_scope_sort,
|
|
13182
13225
|
inferenceRulesTotal: dto.inference_rules_total,
|
|
13183
|
-
|
|
13184
|
-
|
|
13185
|
-
|
|
13186
|
-
osfForwardChainingIssues: dto.osf_forward_chaining_issues,
|
|
13187
|
-
osfFullyValid: dto.osf_fully_valid,
|
|
13188
|
-
osfIncompleteEntities: dto.osf_incomplete_entities
|
|
13226
|
+
patternRulesPersisted: dto.pattern_rules_persisted,
|
|
13227
|
+
relationsFromInferenceRules: dto.relations_from_inference_rules,
|
|
13228
|
+
relationsInferred: dto.relations_inferred
|
|
13189
13229
|
};
|
|
13190
13230
|
}
|
|
13191
13231
|
function TokenUsageDtoFromApiToFront(dto) {
|
|
@@ -13356,6 +13396,14 @@ function IngestDocumentBatchResponseFromApiToFront(dto) {
|
|
|
13356
13396
|
totalTimeMs: dto.total_time_ms
|
|
13357
13397
|
};
|
|
13358
13398
|
}
|
|
13399
|
+
function IngestMarkdownResponseFromApiToFront(dto) {
|
|
13400
|
+
return {
|
|
13401
|
+
pendingReview: dto.pending_review?.map(PendingReviewDtoFromApiToFront),
|
|
13402
|
+
sessionId: dto.session_id ?? void 0,
|
|
13403
|
+
stats: IngestionStatsDtoFromApiToFront(dto.stats),
|
|
13404
|
+
success: dto.success
|
|
13405
|
+
};
|
|
13406
|
+
}
|
|
13359
13407
|
function IngestRdfResponseFromApiToFront(dto) {
|
|
13360
13408
|
return {
|
|
13361
13409
|
shapesParsed: dto.shapes_parsed,
|
|
@@ -13436,8 +13484,8 @@ function DocumentProgressDtoFromApiToFront(dto) {
|
|
|
13436
13484
|
extractionStrategy: dto.extraction_strategy,
|
|
13437
13485
|
inferenceRulesApplied: dto.inference_rules_applied,
|
|
13438
13486
|
modelName: dto.model_name,
|
|
13439
|
-
|
|
13440
|
-
|
|
13487
|
+
residuationsCreated: dto.residuations_created,
|
|
13488
|
+
residuationsResumed: dto.residuations_resumed,
|
|
13441
13489
|
referencesResolved: dto.references_resolved,
|
|
13442
13490
|
referencesUnresolved: dto.references_unresolved,
|
|
13443
13491
|
relationsExtracted: dto.relations_extracted,
|
|
@@ -13447,7 +13495,6 @@ function DocumentProgressDtoFromApiToFront(dto) {
|
|
|
13447
13495
|
sortNames: dto.sort_names,
|
|
13448
13496
|
sortsCreated: dto.sorts_created,
|
|
13449
13497
|
sortsReused: dto.sorts_reused,
|
|
13450
|
-
sortsReusedGlb: dto.sorts_reused_glb,
|
|
13451
13498
|
sortsReusedSemantic: dto.sorts_reused_semantic,
|
|
13452
13499
|
startedAt: dto.started_at,
|
|
13453
13500
|
stepLog: dto.step_log.map(StepLogEntryDtoFromApiToFront),
|
|
@@ -13670,7 +13717,7 @@ var IngestionClient = class {
|
|
|
13670
13717
|
type: "application/json" /* Json */,
|
|
13671
13718
|
format: "json"
|
|
13672
13719
|
});
|
|
13673
|
-
return response.data;
|
|
13720
|
+
return IngestMarkdownResponseFromApiToFront(response.data);
|
|
13674
13721
|
}
|
|
13675
13722
|
/**
|
|
13676
13723
|
* Ingest a batch of markdown documents.
|
|
@@ -13689,7 +13736,7 @@ var IngestionClient = class {
|
|
|
13689
13736
|
type: "application/json" /* Json */,
|
|
13690
13737
|
format: "json"
|
|
13691
13738
|
});
|
|
13692
|
-
return response.data;
|
|
13739
|
+
return IngestMarkdownResponseFromApiToFront(response.data);
|
|
13693
13740
|
}
|
|
13694
13741
|
async ingestDocument(request, options) {
|
|
13695
13742
|
const sync = options?.sync ?? true;
|
|
@@ -13732,7 +13779,10 @@ var IngestionClient = class {
|
|
|
13732
13779
|
* @returns Created sorts and terms from the RDF data.
|
|
13733
13780
|
*/
|
|
13734
13781
|
async ingestRdf(request) {
|
|
13735
|
-
const response = await this.api.ingestRdf(
|
|
13782
|
+
const response = await this.api.ingestRdf(
|
|
13783
|
+
{ sync: request.sync ?? false },
|
|
13784
|
+
IngestRdfRequestFromFrontToApi(request)
|
|
13785
|
+
);
|
|
13736
13786
|
return IngestRdfResponseFromApiToFront(response.data);
|
|
13737
13787
|
}
|
|
13738
13788
|
/**
|
|
@@ -15422,7 +15472,10 @@ function SearchStatsDtoFromApiToFront(dto) {
|
|
|
15422
15472
|
nodesPruned: dto.nodes_pruned,
|
|
15423
15473
|
backtracks: dto.backtracks,
|
|
15424
15474
|
solveTimeMs: dto.solve_time_ms,
|
|
15425
|
-
scorerCalls: dto.scorer_calls
|
|
15475
|
+
scorerCalls: dto.scorer_calls,
|
|
15476
|
+
restarts: dto.restarts,
|
|
15477
|
+
learnedClauses: dto.learned_clauses,
|
|
15478
|
+
forcedChoices: dto.forced_choices?.map(ChoiceSelectionFromApiToFront)
|
|
15426
15479
|
};
|
|
15427
15480
|
}
|
|
15428
15481
|
function SpaceSearchRequestFromFrontToApi(model) {
|
|
@@ -15430,11 +15483,31 @@ function SpaceSearchRequestFromFrontToApi(model) {
|
|
|
15430
15483
|
strategy: model.strategy,
|
|
15431
15484
|
max_solutions: model.maxSolutions,
|
|
15432
15485
|
collect_traces: model.collectTraces,
|
|
15433
|
-
use_neural_guidance: model.useNeuralGuidance
|
|
15486
|
+
use_neural_guidance: model.useNeuralGuidance,
|
|
15487
|
+
mode: model.mode
|
|
15488
|
+
};
|
|
15489
|
+
}
|
|
15490
|
+
function VariableFeasibilityDtoFromApiToFront(dto) {
|
|
15491
|
+
return {
|
|
15492
|
+
canBeTrue: dto.can_be_true,
|
|
15493
|
+
canBeFalse: dto.can_be_false
|
|
15434
15494
|
};
|
|
15435
15495
|
}
|
|
15436
15496
|
function SpaceSearchResponseFromApiToFront(dto) {
|
|
15497
|
+
if (dto.kind === "feasibility") {
|
|
15498
|
+
return {
|
|
15499
|
+
kind: "feasibility",
|
|
15500
|
+
variables: Object.fromEntries(
|
|
15501
|
+
Object.entries(dto.variables).map(([name, v]) => [
|
|
15502
|
+
name,
|
|
15503
|
+
VariableFeasibilityDtoFromApiToFront(v)
|
|
15504
|
+
])
|
|
15505
|
+
),
|
|
15506
|
+
searchStats: dto.search_stats ? SearchStatsDtoFromApiToFront(dto.search_stats) : dto.search_stats
|
|
15507
|
+
};
|
|
15508
|
+
}
|
|
15437
15509
|
return {
|
|
15510
|
+
kind: "solutions",
|
|
15438
15511
|
solutions: dto.solutions.map(SpaceSolutionDtoFromApiToFront),
|
|
15439
15512
|
count: dto.count,
|
|
15440
15513
|
searchStats: dto.search_stats ? SearchStatsDtoFromApiToFront(dto.search_stats) : dto.search_stats
|