@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.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
// src/config.ts
|
|
4
|
-
var SDK_VERSION = "0.
|
|
4
|
+
var SDK_VERSION = "0.15.1";
|
|
5
5
|
function resolveConfig(config) {
|
|
6
6
|
if (!config.baseUrl) {
|
|
7
7
|
throw new Error("ClientConfig.baseUrl is required");
|
|
@@ -2427,17 +2427,18 @@ var Ingestion = class {
|
|
|
2427
2427
|
...params
|
|
2428
2428
|
});
|
|
2429
2429
|
/**
|
|
2430
|
-
*
|
|
2430
|
+
* @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.
|
|
2431
2431
|
*
|
|
2432
2432
|
* @tags ingestion
|
|
2433
2433
|
* @name IngestRdf
|
|
2434
|
-
* @summary Ingest RDF/OWL/SHACL data and convert to OSF
|
|
2434
|
+
* @summary Ingest RDF/OWL/SHACL data and convert to OSF.
|
|
2435
2435
|
* @request POST:/api/v1/ingest/rdf
|
|
2436
2436
|
* @secure
|
|
2437
2437
|
*/
|
|
2438
|
-
ingestRdf = (data, params = {}) => this.http.request({
|
|
2438
|
+
ingestRdf = (query, data, params = {}) => this.http.request({
|
|
2439
2439
|
path: `/api/v1/ingest/rdf`,
|
|
2440
2440
|
method: "POST",
|
|
2441
|
+
query,
|
|
2441
2442
|
body: data,
|
|
2442
2443
|
secure: true,
|
|
2443
2444
|
type: "application/json" /* Json */,
|
|
@@ -13116,6 +13117,40 @@ function OcrConfigDtoFromFrontToApi(model) {
|
|
|
13116
13117
|
use_llm_enhancement: model.useLlmEnhancement
|
|
13117
13118
|
};
|
|
13118
13119
|
}
|
|
13120
|
+
function ExtractionStrategyFromFrontToApi(model) {
|
|
13121
|
+
switch (model.type) {
|
|
13122
|
+
case "llm":
|
|
13123
|
+
return { type: "llm" };
|
|
13124
|
+
case "local_ner":
|
|
13125
|
+
return { type: "local_ner" };
|
|
13126
|
+
case "hybrid":
|
|
13127
|
+
return {
|
|
13128
|
+
type: "hybrid",
|
|
13129
|
+
ner_confidence_threshold: model.nerConfidenceThreshold
|
|
13130
|
+
};
|
|
13131
|
+
case "schema_guided":
|
|
13132
|
+
return {
|
|
13133
|
+
type: "schema_guided",
|
|
13134
|
+
ner_confidence_threshold: model.nerConfidenceThreshold,
|
|
13135
|
+
relation_confidence_threshold: model.relationConfidenceThreshold,
|
|
13136
|
+
escalate_unknown_types: model.escalateUnknownTypes
|
|
13137
|
+
};
|
|
13138
|
+
case "adaptive":
|
|
13139
|
+
return {
|
|
13140
|
+
type: "adaptive",
|
|
13141
|
+
fallback: ExtractionStrategyFromFrontToApi(model.fallback)
|
|
13142
|
+
};
|
|
13143
|
+
}
|
|
13144
|
+
}
|
|
13145
|
+
function EvidenceDerivationConfigDtoFromFrontToApi(model) {
|
|
13146
|
+
return {
|
|
13147
|
+
context_dependent_relations: model.contextDependentRelations,
|
|
13148
|
+
default_quality_weight: model.defaultQualityWeight,
|
|
13149
|
+
evidence_sort_name: model.evidenceSortName,
|
|
13150
|
+
negative_relations: model.negativeRelations,
|
|
13151
|
+
positive_relations: model.positiveRelations
|
|
13152
|
+
};
|
|
13153
|
+
}
|
|
13119
13154
|
function IngestionConfigDtoFromFrontToApi(model) {
|
|
13120
13155
|
return {
|
|
13121
13156
|
auto_create_sorts: model.autoCreateSorts,
|
|
@@ -13125,16 +13160,20 @@ function IngestionConfigDtoFromFrontToApi(model) {
|
|
|
13125
13160
|
domain_instructions: model.domainInstructions,
|
|
13126
13161
|
enable_description_consolidation: model.enableDescriptionConsolidation,
|
|
13127
13162
|
enable_entity_filtering: model.enableEntityFiltering,
|
|
13163
|
+
enable_evidence_enrichment: model.enableEvidenceEnrichment,
|
|
13128
13164
|
enable_focused_extraction: model.enableFocusedExtraction,
|
|
13129
13165
|
enable_schema_discovery: model.enableSchemaDiscovery,
|
|
13130
13166
|
enable_zero_degree_filtering: model.enableZeroDegreeFiltering,
|
|
13167
|
+
evidence_derivation_config: model.evidenceDerivationConfig ? EvidenceDerivationConfigDtoFromFrontToApi(model.evidenceDerivationConfig) : model.evidenceDerivationConfig,
|
|
13131
13168
|
extract_relations: model.extractRelations,
|
|
13132
|
-
extraction_strategy: model.extractionStrategy,
|
|
13169
|
+
extraction_strategy: model.extractionStrategy ? ExtractionStrategyFromFrontToApi(model.extractionStrategy) : void 0,
|
|
13170
|
+
force_extraction_strategy: model.forceExtractionStrategy,
|
|
13133
13171
|
max_schema_tokens: model.maxSchemaTokens,
|
|
13134
13172
|
ner_confidence_threshold: model.nerConfidenceThreshold,
|
|
13135
13173
|
ner_entity_labels: model.nerEntityLabels,
|
|
13136
13174
|
ner_relation_confidence_threshold: model.nerRelationConfidenceThreshold,
|
|
13137
13175
|
ner_relation_labels: model.nerRelationLabels,
|
|
13176
|
+
reject_anonymized_references: model.rejectAnonymizedReferences,
|
|
13138
13177
|
skip_fingerprint: model.skipFingerprint,
|
|
13139
13178
|
skip_relation_completion: model.skipRelationCompletion
|
|
13140
13179
|
};
|
|
@@ -13170,24 +13209,25 @@ function PipelineQualityStatsDtoFromApiToFront(dto) {
|
|
|
13170
13209
|
axiomsDeduplicated: dto.axioms_deduplicated,
|
|
13171
13210
|
dynamicConfigEntityThreshold: dto.dynamic_config_entity_threshold,
|
|
13172
13211
|
dynamicConfigRelationThreshold: dto.dynamic_config_relation_threshold,
|
|
13173
|
-
|
|
13174
|
-
|
|
13175
|
-
|
|
13176
|
-
fcaSortsCreated: dto.fca_sorts_created,
|
|
13212
|
+
entitiesRejected: dto.entities_rejected,
|
|
13213
|
+
entitiesSortCorrected: dto.entities_sort_corrected,
|
|
13214
|
+
entitiesValidated: dto.entities_validated,
|
|
13177
13215
|
feedbackAxiomsLearned: dto.feedback_axioms_learned,
|
|
13178
13216
|
feedbackPipelineAdjustments: dto.feedback_pipeline_adjustments,
|
|
13217
|
+
forwardChainingIssues: dto.forward_chaining_issues,
|
|
13218
|
+
fullyValid: dto.fully_valid,
|
|
13179
13219
|
hybridIntraBatchDeduped: dto.hybrid_intra_batch_deduped,
|
|
13220
|
+
incompleteEntities: dto.incomplete_entities,
|
|
13221
|
+
inconsistentSorts: dto.inconsistent_sorts,
|
|
13222
|
+
inferenceIterations: dto.inference_iterations,
|
|
13180
13223
|
inferenceRelationsDeduped: dto.inference_relations_deduped,
|
|
13181
13224
|
inferenceRulesApplied: dto.inference_rules_applied,
|
|
13182
13225
|
inferenceRulesFilteredLowConfidence: dto.inference_rules_filtered_low_confidence,
|
|
13183
13226
|
inferenceRulesInvalidScopeSort: dto.inference_rules_invalid_scope_sort,
|
|
13184
13227
|
inferenceRulesTotal: dto.inference_rules_total,
|
|
13185
|
-
|
|
13186
|
-
|
|
13187
|
-
|
|
13188
|
-
osfForwardChainingIssues: dto.osf_forward_chaining_issues,
|
|
13189
|
-
osfFullyValid: dto.osf_fully_valid,
|
|
13190
|
-
osfIncompleteEntities: dto.osf_incomplete_entities
|
|
13228
|
+
patternRulesPersisted: dto.pattern_rules_persisted,
|
|
13229
|
+
relationsFromInferenceRules: dto.relations_from_inference_rules,
|
|
13230
|
+
relationsInferred: dto.relations_inferred
|
|
13191
13231
|
};
|
|
13192
13232
|
}
|
|
13193
13233
|
function TokenUsageDtoFromApiToFront(dto) {
|
|
@@ -13358,6 +13398,14 @@ function IngestDocumentBatchResponseFromApiToFront(dto) {
|
|
|
13358
13398
|
totalTimeMs: dto.total_time_ms
|
|
13359
13399
|
};
|
|
13360
13400
|
}
|
|
13401
|
+
function IngestMarkdownResponseFromApiToFront(dto) {
|
|
13402
|
+
return {
|
|
13403
|
+
pendingReview: dto.pending_review?.map(PendingReviewDtoFromApiToFront),
|
|
13404
|
+
sessionId: dto.session_id ?? void 0,
|
|
13405
|
+
stats: IngestionStatsDtoFromApiToFront(dto.stats),
|
|
13406
|
+
success: dto.success
|
|
13407
|
+
};
|
|
13408
|
+
}
|
|
13361
13409
|
function IngestRdfResponseFromApiToFront(dto) {
|
|
13362
13410
|
return {
|
|
13363
13411
|
shapesParsed: dto.shapes_parsed,
|
|
@@ -13438,8 +13486,8 @@ function DocumentProgressDtoFromApiToFront(dto) {
|
|
|
13438
13486
|
extractionStrategy: dto.extraction_strategy,
|
|
13439
13487
|
inferenceRulesApplied: dto.inference_rules_applied,
|
|
13440
13488
|
modelName: dto.model_name,
|
|
13441
|
-
|
|
13442
|
-
|
|
13489
|
+
residuationsCreated: dto.residuations_created,
|
|
13490
|
+
residuationsResumed: dto.residuations_resumed,
|
|
13443
13491
|
referencesResolved: dto.references_resolved,
|
|
13444
13492
|
referencesUnresolved: dto.references_unresolved,
|
|
13445
13493
|
relationsExtracted: dto.relations_extracted,
|
|
@@ -13449,7 +13497,6 @@ function DocumentProgressDtoFromApiToFront(dto) {
|
|
|
13449
13497
|
sortNames: dto.sort_names,
|
|
13450
13498
|
sortsCreated: dto.sorts_created,
|
|
13451
13499
|
sortsReused: dto.sorts_reused,
|
|
13452
|
-
sortsReusedGlb: dto.sorts_reused_glb,
|
|
13453
13500
|
sortsReusedSemantic: dto.sorts_reused_semantic,
|
|
13454
13501
|
startedAt: dto.started_at,
|
|
13455
13502
|
stepLog: dto.step_log.map(StepLogEntryDtoFromApiToFront),
|
|
@@ -13672,7 +13719,7 @@ var IngestionClient = class {
|
|
|
13672
13719
|
type: "application/json" /* Json */,
|
|
13673
13720
|
format: "json"
|
|
13674
13721
|
});
|
|
13675
|
-
return response.data;
|
|
13722
|
+
return IngestMarkdownResponseFromApiToFront(response.data);
|
|
13676
13723
|
}
|
|
13677
13724
|
/**
|
|
13678
13725
|
* Ingest a batch of markdown documents.
|
|
@@ -13691,7 +13738,7 @@ var IngestionClient = class {
|
|
|
13691
13738
|
type: "application/json" /* Json */,
|
|
13692
13739
|
format: "json"
|
|
13693
13740
|
});
|
|
13694
|
-
return response.data;
|
|
13741
|
+
return IngestMarkdownResponseFromApiToFront(response.data);
|
|
13695
13742
|
}
|
|
13696
13743
|
async ingestDocument(request, options) {
|
|
13697
13744
|
const sync = options?.sync ?? true;
|
|
@@ -13734,7 +13781,10 @@ var IngestionClient = class {
|
|
|
13734
13781
|
* @returns Created sorts and terms from the RDF data.
|
|
13735
13782
|
*/
|
|
13736
13783
|
async ingestRdf(request) {
|
|
13737
|
-
const response = await this.api.ingestRdf(
|
|
13784
|
+
const response = await this.api.ingestRdf(
|
|
13785
|
+
{ sync: request.sync ?? false },
|
|
13786
|
+
IngestRdfRequestFromFrontToApi(request)
|
|
13787
|
+
);
|
|
13738
13788
|
return IngestRdfResponseFromApiToFront(response.data);
|
|
13739
13789
|
}
|
|
13740
13790
|
/**
|
|
@@ -15424,7 +15474,10 @@ function SearchStatsDtoFromApiToFront(dto) {
|
|
|
15424
15474
|
nodesPruned: dto.nodes_pruned,
|
|
15425
15475
|
backtracks: dto.backtracks,
|
|
15426
15476
|
solveTimeMs: dto.solve_time_ms,
|
|
15427
|
-
scorerCalls: dto.scorer_calls
|
|
15477
|
+
scorerCalls: dto.scorer_calls,
|
|
15478
|
+
restarts: dto.restarts,
|
|
15479
|
+
learnedClauses: dto.learned_clauses,
|
|
15480
|
+
forcedChoices: dto.forced_choices?.map(ChoiceSelectionFromApiToFront)
|
|
15428
15481
|
};
|
|
15429
15482
|
}
|
|
15430
15483
|
function SpaceSearchRequestFromFrontToApi(model) {
|
|
@@ -15432,11 +15485,31 @@ function SpaceSearchRequestFromFrontToApi(model) {
|
|
|
15432
15485
|
strategy: model.strategy,
|
|
15433
15486
|
max_solutions: model.maxSolutions,
|
|
15434
15487
|
collect_traces: model.collectTraces,
|
|
15435
|
-
use_neural_guidance: model.useNeuralGuidance
|
|
15488
|
+
use_neural_guidance: model.useNeuralGuidance,
|
|
15489
|
+
mode: model.mode
|
|
15490
|
+
};
|
|
15491
|
+
}
|
|
15492
|
+
function VariableFeasibilityDtoFromApiToFront(dto) {
|
|
15493
|
+
return {
|
|
15494
|
+
canBeTrue: dto.can_be_true,
|
|
15495
|
+
canBeFalse: dto.can_be_false
|
|
15436
15496
|
};
|
|
15437
15497
|
}
|
|
15438
15498
|
function SpaceSearchResponseFromApiToFront(dto) {
|
|
15499
|
+
if (dto.kind === "feasibility") {
|
|
15500
|
+
return {
|
|
15501
|
+
kind: "feasibility",
|
|
15502
|
+
variables: Object.fromEntries(
|
|
15503
|
+
Object.entries(dto.variables).map(([name, v]) => [
|
|
15504
|
+
name,
|
|
15505
|
+
VariableFeasibilityDtoFromApiToFront(v)
|
|
15506
|
+
])
|
|
15507
|
+
),
|
|
15508
|
+
searchStats: dto.search_stats ? SearchStatsDtoFromApiToFront(dto.search_stats) : dto.search_stats
|
|
15509
|
+
};
|
|
15510
|
+
}
|
|
15439
15511
|
return {
|
|
15512
|
+
kind: "solutions",
|
|
15440
15513
|
solutions: dto.solutions.map(SpaceSolutionDtoFromApiToFront),
|
|
15441
15514
|
count: dto.count,
|
|
15442
15515
|
searchStats: dto.search_stats ? SearchStatsDtoFromApiToFront(dto.search_stats) : dto.search_stats
|