@futdevpro/nts-dynamo 1.15.105 → 1.15.107
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/.dynamo/logs/cicd-pipeline/output.log +1805 -1863
- package/.dynamo/logs/cicd-pipeline/status.json +28 -28
- package/build/_modules/ai/_collections/ai-model-config-validator.util.d.ts +32 -0
- package/build/_modules/ai/_collections/ai-model-config-validator.util.d.ts.map +1 -0
- package/build/_modules/ai/_collections/ai-model-config-validator.util.js +95 -0
- package/build/_modules/ai/_collections/ai-model-config-validator.util.js.map +1 -0
- package/build/_modules/ai/_collections/ai-provider-error.util.d.ts +35 -0
- package/build/_modules/ai/_collections/ai-provider-error.util.d.ts.map +1 -0
- package/build/_modules/ai/_collections/ai-provider-error.util.js +82 -0
- package/build/_modules/ai/_collections/ai-provider-error.util.js.map +1 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-provider-error.interface.d.ts +17 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-provider-error.interface.d.ts.map +1 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-provider-error.interface.js +3 -0
- package/build/_modules/ai/_models/interfaces/dynts-ai-provider-error.interface.js.map +1 -0
- package/build/_modules/ai/_modules/ai-mock/_collections/aim-default-collection.util.d.ts +23 -0
- package/build/_modules/ai/_modules/ai-mock/_collections/aim-default-collection.util.d.ts.map +1 -0
- package/build/_modules/ai/_modules/ai-mock/_collections/aim-default-collection.util.js +52 -0
- package/build/_modules/ai/_modules/ai-mock/_collections/aim-default-collection.util.js.map +1 -0
- package/build/_modules/ai/_modules/ai-mock/_collections/aim-fixture-match.util.d.ts +34 -0
- package/build/_modules/ai/_modules/ai-mock/_collections/aim-fixture-match.util.d.ts.map +1 -0
- package/build/_modules/ai/_modules/ai-mock/_collections/aim-fixture-match.util.js +56 -0
- package/build/_modules/ai/_modules/ai-mock/_collections/aim-fixture-match.util.js.map +1 -0
- package/build/_modules/ai/_modules/ai-mock/_collections/aim-fixture-serializer.util.d.ts +33 -0
- package/build/_modules/ai/_modules/ai-mock/_collections/aim-fixture-serializer.util.d.ts.map +1 -0
- package/build/_modules/ai/_modules/ai-mock/_collections/aim-fixture-serializer.util.js +89 -0
- package/build/_modules/ai/_modules/ai-mock/_collections/aim-fixture-serializer.util.js.map +1 -0
- package/build/_modules/ai/_modules/ai-mock/_enums/aim-modality.enum.d.ts +16 -0
- package/build/_modules/ai/_modules/ai-mock/_enums/aim-modality.enum.d.ts.map +1 -0
- package/build/_modules/ai/_modules/ai-mock/_enums/aim-modality.enum.js +20 -0
- package/build/_modules/ai/_modules/ai-mock/_enums/aim-modality.enum.js.map +1 -0
- package/build/_modules/ai/_modules/ai-mock/_models/interfaces/aim-call-input.interface.d.ts +15 -0
- package/build/_modules/ai/_modules/ai-mock/_models/interfaces/aim-call-input.interface.d.ts.map +1 -0
- package/build/_modules/ai/_modules/ai-mock/_models/interfaces/aim-call-input.interface.js +3 -0
- package/build/_modules/ai/_modules/ai-mock/_models/interfaces/aim-call-input.interface.js.map +1 -0
- package/build/_modules/ai/_modules/ai-mock/_models/interfaces/aim-error.interface.d.ts +11 -0
- package/build/_modules/ai/_modules/ai-mock/_models/interfaces/aim-error.interface.d.ts.map +1 -0
- package/build/_modules/ai/_modules/ai-mock/_models/interfaces/aim-error.interface.js +3 -0
- package/build/_modules/ai/_modules/ai-mock/_models/interfaces/aim-error.interface.js.map +1 -0
- package/build/_modules/ai/_modules/ai-mock/_models/interfaces/aim-fixture.interface.d.ts +30 -0
- package/build/_modules/ai/_modules/ai-mock/_models/interfaces/aim-fixture.interface.d.ts.map +1 -0
- package/build/_modules/ai/_modules/ai-mock/_models/interfaces/aim-fixture.interface.js +3 -0
- package/build/_modules/ai/_modules/ai-mock/_models/interfaces/aim-fixture.interface.js.map +1 -0
- package/build/_modules/ai/_modules/ai-mock/_models/interfaces/aim-request.interface.d.ts +19 -0
- package/build/_modules/ai/_modules/ai-mock/_models/interfaces/aim-request.interface.d.ts.map +1 -0
- package/build/_modules/ai/_modules/ai-mock/_models/interfaces/aim-request.interface.js +3 -0
- package/build/_modules/ai/_modules/ai-mock/_models/interfaces/aim-request.interface.js.map +1 -0
- package/build/_modules/ai/_modules/ai-mock/_models/interfaces/aim-service-collection.interface.d.ts +19 -0
- package/build/_modules/ai/_modules/ai-mock/_models/interfaces/aim-service-collection.interface.d.ts.map +1 -0
- package/build/_modules/ai/_modules/ai-mock/_models/interfaces/aim-service-collection.interface.js +3 -0
- package/build/_modules/ai/_modules/ai-mock/_models/interfaces/aim-service-collection.interface.js.map +1 -0
- package/build/_modules/ai/{_services → _modules/ai-mock/_services}/ai-embedding-mock.service.d.ts +2 -2
- package/build/_modules/ai/_modules/ai-mock/_services/ai-embedding-mock.service.d.ts.map +1 -0
- package/build/_modules/ai/{_services → _modules/ai-mock/_services}/ai-embedding-mock.service.js +1 -1
- package/build/_modules/ai/_modules/ai-mock/_services/ai-embedding-mock.service.js.map +1 -0
- package/build/_modules/ai/_modules/ai-mock/_services/aim-fixture-harness.service.d.ts +48 -0
- package/build/_modules/ai/_modules/ai-mock/_services/aim-fixture-harness.service.d.ts.map +1 -0
- package/build/_modules/ai/_modules/ai-mock/_services/aim-fixture-harness.service.js +104 -0
- package/build/_modules/ai/_modules/ai-mock/_services/aim-fixture-harness.service.js.map +1 -0
- package/build/_modules/ai/_modules/ai-mock/_services/aim-fixture-store.service.d.ts +35 -0
- package/build/_modules/ai/_modules/ai-mock/_services/aim-fixture-store.service.d.ts.map +1 -0
- package/build/_modules/ai/_modules/ai-mock/_services/aim-fixture-store.service.js +60 -0
- package/build/_modules/ai/_modules/ai-mock/_services/aim-fixture-store.service.js.map +1 -0
- package/build/_modules/ai/_modules/ai-mock/_services/aim-mock.service.d.ts +60 -0
- package/build/_modules/ai/_modules/ai-mock/_services/aim-mock.service.d.ts.map +1 -0
- package/build/_modules/ai/_modules/ai-mock/_services/aim-mock.service.js +121 -0
- package/build/_modules/ai/_modules/ai-mock/_services/aim-mock.service.js.map +1 -0
- package/build/_modules/ai/_modules/ai-mock/index.d.ts +14 -0
- package/build/_modules/ai/_modules/ai-mock/index.d.ts.map +1 -0
- package/build/_modules/ai/_modules/ai-mock/index.js +41 -0
- package/build/_modules/ai/_modules/ai-mock/index.js.map +1 -0
- package/build/_modules/ai/_modules/open-ai/_services/oai-llm.service-base.d.ts +18 -0
- package/build/_modules/ai/_modules/open-ai/_services/oai-llm.service-base.d.ts.map +1 -1
- package/build/_modules/ai/_modules/open-ai/_services/oai-llm.service-base.js +58 -30
- package/build/_modules/ai/_modules/open-ai/_services/oai-llm.service-base.js.map +1 -1
- package/build/_modules/ai/_services/ai-embedding-provider.registry.d.ts +1 -1
- package/build/_modules/ai/_services/ai-embedding-provider.registry.d.ts.map +1 -1
- package/build/_modules/ai/_services/ai-embedding-provider.registry.js +1 -1
- package/build/_modules/ai/_services/ai-embedding-provider.registry.js.map +1 -1
- package/build/_modules/ai/_services/ai-llm.service-base.d.ts +16 -0
- package/build/_modules/ai/_services/ai-llm.service-base.d.ts.map +1 -1
- package/build/_modules/ai/_services/ai-llm.service-base.js +65 -0
- package/build/_modules/ai/_services/ai-llm.service-base.js.map +1 -1
- package/build/_modules/ai/index.d.ts +4 -1
- package/build/_modules/ai/index.d.ts.map +1 -1
- package/build/_modules/ai/index.js +9 -1
- package/build/_modules/ai/index.js.map +1 -1
- package/package.json +11 -2
- package/src/_modules/ai/_collections/ai-model-config-validator.util.spec.ts +150 -0
- package/src/_modules/ai/_collections/ai-model-config-validator.util.ts +131 -0
- package/src/_modules/ai/_collections/ai-provider-error.util.ts +98 -0
- package/src/_modules/ai/_models/interfaces/dynts-ai-provider-error.interface.ts +16 -0
- package/src/_modules/ai/_modules/ai-mock/_collections/aim-default-collection.util.spec.ts +72 -0
- package/src/_modules/ai/_modules/ai-mock/_collections/aim-default-collection.util.ts +71 -0
- package/src/_modules/ai/_modules/ai-mock/_collections/aim-fixture-match.util.spec.ts +57 -0
- package/src/_modules/ai/_modules/ai-mock/_collections/aim-fixture-match.util.ts +60 -0
- package/src/_modules/ai/_modules/ai-mock/_collections/aim-fixture-serializer.util.spec.ts +56 -0
- package/src/_modules/ai/_modules/ai-mock/_collections/aim-fixture-serializer.util.ts +107 -0
- package/src/_modules/ai/_modules/ai-mock/_enums/aim-modality.enum.ts +15 -0
- package/src/_modules/ai/_modules/ai-mock/_models/interfaces/aim-call-input.interface.ts +14 -0
- package/src/_modules/ai/_modules/ai-mock/_models/interfaces/aim-error.interface.ts +11 -0
- package/src/_modules/ai/_modules/ai-mock/_models/interfaces/aim-fixture.interface.ts +30 -0
- package/src/_modules/ai/_modules/ai-mock/_models/interfaces/aim-request.interface.ts +19 -0
- package/src/_modules/ai/_modules/ai-mock/_models/interfaces/aim-service-collection.interface.ts +20 -0
- package/src/_modules/ai/{_services → _modules/ai-mock/_services}/ai-embedding-mock.service.spec.ts +1 -1
- package/src/_modules/ai/{_services → _modules/ai-mock/_services}/ai-embedding-mock.service.ts +2 -2
- package/src/_modules/ai/_modules/ai-mock/_services/aim-fixture-harness.service.spec.ts +134 -0
- package/src/_modules/ai/_modules/ai-mock/_services/aim-fixture-harness.service.ts +127 -0
- package/src/_modules/ai/_modules/ai-mock/_services/aim-fixture-pipeline.spec.ts +105 -0
- package/src/_modules/ai/_modules/ai-mock/_services/aim-fixture-store.service.spec.ts +50 -0
- package/src/_modules/ai/_modules/ai-mock/_services/aim-fixture-store.service.ts +65 -0
- package/src/_modules/ai/_modules/ai-mock/_services/aim-mock.service.spec.ts +112 -0
- package/src/_modules/ai/_modules/ai-mock/_services/aim-mock.service.ts +142 -0
- package/src/_modules/ai/_modules/ai-mock/index.ts +44 -0
- package/src/_modules/ai/_modules/open-ai/_services/oai-llm.service-base.ts +77 -35
- package/src/_modules/ai/_services/ai-embedding-provider.registry.spec.ts +1 -1
- package/src/_modules/ai/_services/ai-embedding-provider.registry.ts +1 -1
- package/src/_modules/ai/_services/ai-llm.service-base.reconciler.spec.ts +133 -0
- package/src/_modules/ai/_services/ai-llm.service-base.ts +80 -0
- package/src/_modules/ai/index.ts +11 -1
- package/build/_modules/ai/_services/ai-embedding-mock.service.d.ts.map +0 -1
- package/build/_modules/ai/_services/ai-embedding-mock.service.js.map +0 -1
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { DyFM_Error } from '@futdevpro/fsm-dynamo';
|
|
2
|
+
import { DyFM_AI_ModelInfo } from '@futdevpro/fsm-dynamo/ai';
|
|
3
|
+
|
|
4
|
+
import { DyNTS_AIMock_Modality } from '../_enums/aim-modality.enum';
|
|
5
|
+
import { DyNTS_AI_ModelConfig_Validator } from '../../../_collections/ai-model-config-validator.util';
|
|
6
|
+
import { DyNTS_AIMock_Request } from '../_models/interfaces/aim-request.interface';
|
|
7
|
+
import { DyNTS_AIMock_Fixture } from '../_models/interfaces/aim-fixture.interface';
|
|
8
|
+
import { DyNTS_AIMock_Error } from '../_models/interfaces/aim-error.interface';
|
|
9
|
+
import { DyNTS_AIMock_CallInput } from '../_models/interfaces/aim-call-input.interface';
|
|
10
|
+
import { DyNTS_AIMock_FixtureMatch_Util } from '../_collections/aim-fixture-match.util';
|
|
11
|
+
import { DyNTS_AIMock_FixtureStore_Service } from './aim-fixture-store.service';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* A mock provider-surface (MP-4 SP-4.1) — a valódi AI-hívás kiváltása beégetett fixture-ökkel, outbound
|
|
15
|
+
* hívás NÉLKÜL. Négy modalitás-metódus (`chatCompletion`/`embed`/`generateImage`/`generateAudio`), mind a
|
|
16
|
+
* `DyNTS_AIMock_FixtureStore`-ból replay-el: hit → a beégetett kimenet; miss → strukturált reject-on-unknown
|
|
17
|
+
* (D3, NEM silent-fallback, NEM outbound); beégetett provider-faithful hiba → ugyanaz a hiba, mint a valódi
|
|
18
|
+
* providernél. A config-validáció (FR-048 reconciler validate-mode) a `settingsSchema` populálása UTÁN
|
|
19
|
+
* kötendő be (G4) — l. a `replay` TODO-ját; addig SZÁNDÉKOSAN nem validálunk (nem fake-elünk provider-error-t).
|
|
20
|
+
*/
|
|
21
|
+
export class DyNTS_AIMock_Service {
|
|
22
|
+
|
|
23
|
+
/** A fixture-tár, amiből a replay megy. */
|
|
24
|
+
private readonly store: DyNTS_AIMock_FixtureStore_Service;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* A modell-registry a config-validaciohoz (FR-048 `settingsSchema`). Ures registry → NINCS
|
|
28
|
+
* config-validacio (permissziv), csak fixture-replay — igy a mock a schema kikerulese elott is hasznalhato.
|
|
29
|
+
*/
|
|
30
|
+
private readonly modelRegistry: DyFM_AI_ModelInfo[];
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @param store a beégetett fixture-ök tára.
|
|
34
|
+
* @param modelRegistry opcionális modell-registry (pl. `DyFM_OAI_Models`) a FR-048 config-validációhoz.
|
|
35
|
+
*/
|
|
36
|
+
constructor(store: DyNTS_AIMock_FixtureStore_Service, modelRegistry?: DyFM_AI_ModelInfo[]) {
|
|
37
|
+
this.store = store;
|
|
38
|
+
this.modelRegistry = modelRegistry ?? [];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Chat/completion replay a beégetett fixture-ből.
|
|
43
|
+
* @param set - provider + model + opcionális config + prompt-input
|
|
44
|
+
*/
|
|
45
|
+
async chatCompletion(set: DyNTS_AIMock_CallInput): Promise<unknown> {
|
|
46
|
+
return this.replay(this.toRequest(set, DyNTS_AIMock_Modality.text));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Embedding replay a beégetett fixture-ből.
|
|
51
|
+
* @param set - provider + model + opcionális config + szöveg(ek)-input
|
|
52
|
+
*/
|
|
53
|
+
async embed(set: DyNTS_AIMock_CallInput): Promise<unknown> {
|
|
54
|
+
return this.replay(this.toRequest(set, DyNTS_AIMock_Modality.embedding));
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Kép-generálás replay a beégetett fixture-ből.
|
|
59
|
+
* @param set - provider + model + opcionális config + kép-prompt-input
|
|
60
|
+
*/
|
|
61
|
+
async generateImage(set: DyNTS_AIMock_CallInput): Promise<unknown> {
|
|
62
|
+
return this.replay(this.toRequest(set, DyNTS_AIMock_Modality.image));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Hang (transcription / TTS) replay a beégetett fixture-ből.
|
|
67
|
+
* @param set - provider + model + opcionális config + audio/szöveg-input
|
|
68
|
+
*/
|
|
69
|
+
async generateAudio(set: DyNTS_AIMock_CallInput): Promise<unknown> {
|
|
70
|
+
return this.replay(this.toRequest(set, DyNTS_AIMock_Modality.audio));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** A modalitás-metódus bemenetéből teljes `DyNTS_AIMock_Request`. */
|
|
74
|
+
private toRequest(set: DyNTS_AIMock_CallInput, modality: DyNTS_AIMock_Modality): DyNTS_AIMock_Request {
|
|
75
|
+
return {
|
|
76
|
+
provider: set.provider,
|
|
77
|
+
model: set.model,
|
|
78
|
+
modality: modality,
|
|
79
|
+
config: set.config,
|
|
80
|
+
input: set.input,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** A közös replay/reject-mag. */
|
|
85
|
+
private replay(request: DyNTS_AIMock_Request): unknown {
|
|
86
|
+
// FR-048: a config-validáció a modell `settingsSchema.unsupported`-ja alapján — MÉG a fixture-lookup
|
|
87
|
+
// ELŐTT, ahogy a valódi providernél is a szerver utasítja el a rossz paramétert.
|
|
88
|
+
this.validateConfig(request);
|
|
89
|
+
|
|
90
|
+
const fixture: DyNTS_AIMock_Fixture | undefined = this.store.resolve(request);
|
|
91
|
+
|
|
92
|
+
if (!fixture) {
|
|
93
|
+
throw this.rejectOnUnknown(request);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (fixture.error) {
|
|
97
|
+
throw this.toProviderFaithfulError(fixture.error);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return fixture.output;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* FR-048 config-validáció — **delegál** a modul-szintű `DyNTS_AI_ModelConfig_Validator`-ra, hogy EGY
|
|
105
|
+
* validációs út legyen (SSoT): ugyanaz a kód dönt a production pre-validációnál és a mockban.
|
|
106
|
+
* Üres registry / schema-mentes modell → permisszív (nem találgatunk).
|
|
107
|
+
*/
|
|
108
|
+
private validateConfig(request: DyNTS_AIMock_Request): void {
|
|
109
|
+
const error: DyFM_Error = DyNTS_AI_ModelConfig_Validator.validate({
|
|
110
|
+
provider: request.provider,
|
|
111
|
+
model: request.model,
|
|
112
|
+
config: request.config,
|
|
113
|
+
registry: this.modelRegistry,
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
if (error) {
|
|
117
|
+
throw error;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** Egy `DyNTS_AIMock_Error` leíróból a dobandó `DyFM_Error`. */
|
|
122
|
+
private toProviderFaithfulError(error: DyNTS_AIMock_Error): DyFM_Error {
|
|
123
|
+
return new DyFM_Error({
|
|
124
|
+
message: `[ai-mock] provider-faithful error (HTTP ${error.httpStatus}): ${error.reason}`,
|
|
125
|
+
userMessage: 'AI request rejected (mock).',
|
|
126
|
+
errorCode: 'DyNTS-AIMOCK-PERR',
|
|
127
|
+
additionalContent: { providerErrorBody: error.providerErrorBody },
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** Strukturált „no-fixture" hiba (D3) — beszédes, a hiányzó kulccsal + az extend-recepttel (MP-6). */
|
|
132
|
+
private rejectOnUnknown(request: DyNTS_AIMock_Request): DyFM_Error {
|
|
133
|
+
const matchKey: string = DyNTS_AIMock_FixtureMatch_Util.buildMatchKey(request);
|
|
134
|
+
|
|
135
|
+
return new DyFM_Error({
|
|
136
|
+
message: `[ai-mock] no fixture for '${request.provider}:${request.model}' (${request.modality}). ` +
|
|
137
|
+
`Match-key: ${matchKey}. Beégetés: 'dc ai-mock-extend' (MP-6).`,
|
|
138
|
+
userMessage: 'No mock fixture is registered for this AI request.',
|
|
139
|
+
errorCode: 'DyNTS-AIMOCK-NOFIX',
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//
|
|
2
|
+
// ai-mock module (@futdevpro/nts-dynamo/ai/ai-mock)
|
|
3
|
+
//
|
|
4
|
+
// AI Mocking System — provider-faithful mock-service + fixture-store (Layer B) a valódi AI-hívások
|
|
5
|
+
// kiváltására teszt/CI/lokál-fejlesztésben. A Layer A (per-model config-registry + validátor) a FR-048
|
|
6
|
+
// (`DyFM_AI_ModelSettingsSchema` + reconciler) — az ai-mock azt FOGYASZTJA a provider-faithful
|
|
7
|
+
// error-reprodukcióhoz. Terv: `documentations/plans/ai-mocking-system/HYPERPLAN.md`.
|
|
8
|
+
//
|
|
9
|
+
// SCAFFOLD (Cikl. 2, 2026-07-21): a modul-váz + a meglévő determinisztikus embedding-mock re-exportja.
|
|
10
|
+
// A további szolgáltatások (fixture-store, mock-service, coverage) MP-3..MP-6 során kerülnek ide;
|
|
11
|
+
// almappák (_collections/_enums/_models/_services) csak 3-5+ elemnél jönnek létre (FDP folder-rule).
|
|
12
|
+
//
|
|
13
|
+
|
|
14
|
+
// Layer B embedding-mag: a determinisztikus embedding-mock (BFR-AM-008) — MP-5 SP-5.1 során FIZIKAILAG
|
|
15
|
+
// ide költözött (`_services/ai-embedding-mock.service.ts`). A régi `@futdevpro/nts-dynamo/ai` útvonal
|
|
16
|
+
// backward-compat re-exportként tovább él, így a FAM-consumer nem törik.
|
|
17
|
+
export * from './_services/ai-embedding-mock.service';
|
|
18
|
+
|
|
19
|
+
// ENUMS
|
|
20
|
+
export * from './_enums/aim-modality.enum';
|
|
21
|
+
|
|
22
|
+
// MODELS / INTERFACES — fixture-shape (MP-3 SP-3.1)
|
|
23
|
+
export * from './_models/interfaces/aim-request.interface';
|
|
24
|
+
export * from './_models/interfaces/aim-error.interface';
|
|
25
|
+
export * from './_models/interfaces/aim-fixture.interface';
|
|
26
|
+
export * from './_models/interfaces/aim-call-input.interface';
|
|
27
|
+
export * from './_models/interfaces/aim-service-collection.interface';
|
|
28
|
+
|
|
29
|
+
// COLLECTIONS — input-match normalizáció (MP-3 SP-3.1).
|
|
30
|
+
// A provider-faithful hiba-alak + a validate-mode a MODUL-SZINTŰ `ai/` alatt él (SSoT), mert production
|
|
31
|
+
// pre-validációra is kell — nem az ai-mock-ból importálandó: `@futdevpro/nts-dynamo/ai`.
|
|
32
|
+
export * from './_collections/aim-fixture-match.util';
|
|
33
|
+
|
|
34
|
+
// DEFAULT-BUNDLE factory (MP-7 SP-7.1) — egy hívással álló mock-készlet.
|
|
35
|
+
export * from './_collections/aim-default-collection.util';
|
|
36
|
+
|
|
37
|
+
// FIXTURE-SERIALIZER (MP-3 SP-3.1) — determinisztikus, diff-barát konstans-fájl generálás.
|
|
38
|
+
export * from './_collections/aim-fixture-serializer.util';
|
|
39
|
+
|
|
40
|
+
// SERVICES — fixture-store (MP-3) + mock-service surface (MP-4 SP-4.1) + generáló harness (MP-3 SP-3.2).
|
|
41
|
+
// A harness KÉT biztonsági zárral véd a véletlen pénzköltés ellen (spend-guard default OFF + D2 tier-cap).
|
|
42
|
+
export * from './_services/aim-fixture-store.service';
|
|
43
|
+
export * from './_services/aim-mock.service';
|
|
44
|
+
export * from './_services/aim-fixture-harness.service';
|
|
@@ -12,7 +12,8 @@ import {
|
|
|
12
12
|
DyFM_AI_LLM_Response,
|
|
13
13
|
DyFM_AI_Tool,
|
|
14
14
|
DyFM_AI_ToolCall,
|
|
15
|
-
DyFM_AI_ModelInfo
|
|
15
|
+
DyFM_AI_ModelInfo,
|
|
16
|
+
DyFM_AI_ModelRegistry_Util
|
|
16
17
|
} from '@futdevpro/fsm-dynamo/ai';
|
|
17
18
|
|
|
18
19
|
import { DyNTS_global_settings } from '../../../../../_collections/global-settings.const';
|
|
@@ -514,33 +515,17 @@ export class DyNTS_OAI_LLM_ServiceBase extends DyNTS_AI_LLM_ServiceBase {
|
|
|
514
515
|
try {
|
|
515
516
|
const settings = set.settings ?? this.defaultSettings;
|
|
516
517
|
|
|
518
|
+
const useModel: string = String(settings?.useModel ?? this.defaultModel);
|
|
519
|
+
|
|
517
520
|
const result: ChatCompletionCreateParamsBase = {
|
|
518
|
-
model:
|
|
521
|
+
model: useModel,
|
|
519
522
|
messages: set.conversation as ChatCompletionMessageParam[],
|
|
520
523
|
};
|
|
521
524
|
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
/* result.max_completion_tokens = DyFM_notNull(settings?.maxTokens) ?
|
|
527
|
-
settings.maxTokens :
|
|
528
|
-
this.defaultSettings.maxTokens; */
|
|
529
|
-
result.max_completion_tokens = DyFM_notNull(settings?.maxTokens) ?
|
|
530
|
-
settings.maxTokens :
|
|
531
|
-
this.defaultSettings.maxTokens;
|
|
532
|
-
|
|
533
|
-
result.top_p = DyFM_notNull(settings?.topP) ?
|
|
534
|
-
settings.topP :
|
|
535
|
-
this.defaultSettings.topP;
|
|
536
|
-
|
|
537
|
-
result.frequency_penalty = DyFM_notNull(settings?.frequencyPenalty) ?
|
|
538
|
-
settings.frequencyPenalty :
|
|
539
|
-
this.defaultSettings.frequencyPenalty;
|
|
540
|
-
|
|
541
|
-
result.presence_penalty = DyFM_notNull(settings?.presencePenalty) ?
|
|
542
|
-
settings.presencePenalty :
|
|
543
|
-
this.defaultSettings.presencePenalty;
|
|
525
|
+
// FR-048 §3: a sampling-parameterek (+ max_completion_tokens) a per-model `settingsSchema` szerint
|
|
526
|
+
// kerulnek ra (drop/clamp). KORABBAN ez a NEM-tool ag FELTETEL NELKUL kuldte a sampling-parametereket,
|
|
527
|
+
// ezert reasoning modellen (GPT-5.x / o-series) 400-zal elhasalt volna — ezt itt zarjuk le.
|
|
528
|
+
this.applySamplingParams({ input: result, useModel: useModel, settings: set.settings });
|
|
544
529
|
|
|
545
530
|
return result;
|
|
546
531
|
} catch (error) {
|
|
@@ -603,19 +588,12 @@ export class DyNTS_OAI_LLM_ServiceBase extends DyNTS_AI_LLM_ServiceBase {
|
|
|
603
588
|
const input: ChatCompletionCreateParamsBase = {
|
|
604
589
|
model: useModel,
|
|
605
590
|
messages: messages,
|
|
606
|
-
max_completion_tokens: DyFM_notNull(settings?.maxTokens) ? settings.maxTokens : this.defaultSettings.maxTokens,
|
|
607
591
|
};
|
|
608
592
|
|
|
609
|
-
//
|
|
610
|
-
//
|
|
611
|
-
//
|
|
612
|
-
|
|
613
|
-
if (!this.isReasoningModel(String(useModel))) {
|
|
614
|
-
input.temperature = DyFM_notNull(settings?.temperature) ? settings.temperature : this.defaultSettings.temperature;
|
|
615
|
-
input.top_p = DyFM_notNull(settings?.topP) ? settings.topP : this.defaultSettings.topP;
|
|
616
|
-
input.frequency_penalty = DyFM_notNull(settings?.frequencyPenalty) ? settings.frequencyPenalty : this.defaultSettings.frequencyPenalty;
|
|
617
|
-
input.presence_penalty = DyFM_notNull(settings?.presencePenalty) ? settings.presencePenalty : this.defaultSettings.presencePenalty;
|
|
618
|
-
}
|
|
593
|
+
// FR-048 §3: a sampling-parameterek + `max_completion_tokens` a per-model `settingsSchema` szerint
|
|
594
|
+
// kerulnek ra. A korabbi lokalis `isReasoningModel`-drop atmeneti fallback-kent bent maradt a
|
|
595
|
+
// helper-ben (l. `applySamplingParams`), amig a schema ki nem kerul a fsm-bol — igy nincs regresszio.
|
|
596
|
+
this.applySamplingParams({ input: input, useModel: String(useModel), settings: set.settings });
|
|
619
597
|
|
|
620
598
|
// Ures tools-tomb -> 400 ("tools must have minimum length 1"). Csak akkor kuldjuk, ha van tool.
|
|
621
599
|
if (set.tools.length) {
|
|
@@ -736,6 +714,70 @@ export class DyNTS_OAI_LLM_ServiceBase extends DyNTS_AI_LLM_ServiceBase {
|
|
|
736
714
|
return /^gpt-5/.test(modelId) || /^o[0-9]/.test(modelId);
|
|
737
715
|
}
|
|
738
716
|
|
|
717
|
+
/**
|
|
718
|
+
* FR-048 §3 — feloldja az agnosztikus sampling-settingseket (hivas-settings > default), atengedi a
|
|
719
|
+
* per-model reconciler-en (`settingsSchema` szerinti drop/clamp), majd RAKEPZI a natív OpenAI mezokre.
|
|
720
|
+
* Csak azok a natív mezok kerulnek az input-ra, amik a reconcile utan MEGMARADTAK.
|
|
721
|
+
*
|
|
722
|
+
* Ezzel a "melyik modell mit fogad el" tudas a registry `settingsSchema`-jaban (SSoT) el, nem
|
|
723
|
+
* provider-translatoronkent duplikalva.
|
|
724
|
+
*
|
|
725
|
+
* **Atmeneti fallback (szandekos):** ha a registry-bejegyzesnek MEG NINCS `settingsSchema`-ja (regebbi
|
|
726
|
+
* fsm-verzio, vagy registry-ben nem szereplo modell), a korabbi lokalis `isReasoningModel`-drop marad
|
|
727
|
+
* ervenyben — igy a FR-047 `514153f` fix NEM regresszal, amig a schema ki nem kerul a fsm-bol. Amint a
|
|
728
|
+
* schema mindenhol elerheto, ez a fallback (es az `isReasoningModel`) elhagyhato.
|
|
729
|
+
*/
|
|
730
|
+
protected applySamplingParams(
|
|
731
|
+
set: {
|
|
732
|
+
input: ChatCompletionCreateParamsBase,
|
|
733
|
+
useModel: string,
|
|
734
|
+
settings?: DyFM_OAI_CallSettings,
|
|
735
|
+
}
|
|
736
|
+
): void {
|
|
737
|
+
const source: DyFM_OAI_CallSettings = set.settings ?? this.defaultSettings;
|
|
738
|
+
|
|
739
|
+
const resolved: DyFM_OAI_CallSettings = {
|
|
740
|
+
...source,
|
|
741
|
+
useModel: set.useModel,
|
|
742
|
+
temperature: DyFM_notNull(source?.temperature) ? source.temperature : this.defaultSettings.temperature,
|
|
743
|
+
maxTokens: DyFM_notNull(source?.maxTokens) ? source.maxTokens : this.defaultSettings.maxTokens,
|
|
744
|
+
topP: DyFM_notNull(source?.topP) ? source.topP : this.defaultSettings.topP,
|
|
745
|
+
frequencyPenalty: DyFM_notNull(source?.frequencyPenalty) ?
|
|
746
|
+
source.frequencyPenalty : this.defaultSettings.frequencyPenalty,
|
|
747
|
+
presencePenalty: DyFM_notNull(source?.presencePenalty) ?
|
|
748
|
+
source.presencePenalty : this.defaultSettings.presencePenalty,
|
|
749
|
+
};
|
|
750
|
+
|
|
751
|
+
const final: DyFM_OAI_CallSettings = this.reconcileCallSettings(set.useModel, resolved);
|
|
752
|
+
|
|
753
|
+
const modelInfo: DyFM_AI_ModelInfo = DyFM_AI_ModelRegistry_Util.findModelInfo(
|
|
754
|
+
this.getModelRegistry(),
|
|
755
|
+
set.useModel
|
|
756
|
+
);
|
|
757
|
+
const dropSampling: boolean = !modelInfo?.settingsSchema && this.isReasoningModel(set.useModel);
|
|
758
|
+
|
|
759
|
+
if (DyFM_notNull(final?.maxTokens)) {
|
|
760
|
+
set.input.max_completion_tokens = final.maxTokens;
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
if (dropSampling) {
|
|
764
|
+
return;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
if (DyFM_notNull(final?.temperature)) {
|
|
768
|
+
set.input.temperature = final.temperature;
|
|
769
|
+
}
|
|
770
|
+
if (DyFM_notNull(final?.topP)) {
|
|
771
|
+
set.input.top_p = final.topP;
|
|
772
|
+
}
|
|
773
|
+
if (DyFM_notNull(final?.frequencyPenalty)) {
|
|
774
|
+
set.input.frequency_penalty = final.frequencyPenalty;
|
|
775
|
+
}
|
|
776
|
+
if (DyFM_notNull(final?.presencePenalty)) {
|
|
777
|
+
set.input.presence_penalty = final.presencePenalty;
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
|
|
739
781
|
//#endregion
|
|
740
782
|
|
|
741
783
|
// async askJSONListQuestion(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DyNTS_AI_EmbeddingProvider_Registry } from './ai-embedding-provider.registry';
|
|
2
2
|
import { DyNTS_LMStudio_Embedding_ControlService } from './lmstudio-embedding.control-service';
|
|
3
|
-
import { DyNTS_AI_Embedding_MockService } from '
|
|
3
|
+
import { DyNTS_AI_Embedding_MockService } from '../_modules/ai-mock/_services/ai-embedding-mock.service';
|
|
4
4
|
import { DyNTS_OAI_Embedding_ControlService } from '../_modules/open-ai/_services/oai-embedding.control-service';
|
|
5
5
|
|
|
6
6
|
describe('| DyNTS_AI_EmbeddingProvider_Registry', () => {
|
|
@@ -3,7 +3,7 @@ import { DyFM_OAI_Settings } from '@futdevpro/fsm-dynamo/ai/open-ai';
|
|
|
3
3
|
import { DyNTS_AI_Embedding_ServiceBase } from './ai-embedding.service-base';
|
|
4
4
|
import { DyNTS_OAI_Embedding_ControlService } from '../_modules/open-ai/_services/oai-embedding.control-service';
|
|
5
5
|
import { DyNTS_LMStudio_Embedding_ControlService, DyNTS_LMStudio_Embedding_Settings } from './lmstudio-embedding.control-service';
|
|
6
|
-
import { DyNTS_AI_Embedding_MockService, DyNTS_AI_Embedding_MockSettings } from '
|
|
6
|
+
import { DyNTS_AI_Embedding_MockService, DyNTS_AI_Embedding_MockSettings } from '../_modules/ai-mock/_services/ai-embedding-mock.service';
|
|
7
7
|
import { DyNTS_AI_CostEventCallback } from '../_models/interfaces/dynts-ai-cost-event-callback.interface';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DyFM_AI_CallSettings,
|
|
3
|
+
DyFM_AI_ModelInfo,
|
|
4
|
+
DyFM_AI_ModelType,
|
|
5
|
+
DyFM_AI_Provider,
|
|
6
|
+
} from '@futdevpro/fsm-dynamo/ai';
|
|
7
|
+
|
|
8
|
+
import { DyNTS_AI_LLM_ServiceBase } from './ai-llm.service-base';
|
|
9
|
+
|
|
10
|
+
/** Minden-false capability-blokk a teszt-registry bejegyzesekhez. */
|
|
11
|
+
const NO_CAPS: any = {
|
|
12
|
+
functionCalling: false,
|
|
13
|
+
vision: false,
|
|
14
|
+
streaming: false,
|
|
15
|
+
jsonMode: false,
|
|
16
|
+
audioInput: false,
|
|
17
|
+
audioOutput: false,
|
|
18
|
+
imageGeneration: false,
|
|
19
|
+
embeddings: false,
|
|
20
|
+
adultContent: false,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/** Teszt-registry: egy schema-val rendelkezo es egy schema-mentes modell. */
|
|
24
|
+
const TEST_REGISTRY: DyFM_AI_ModelInfo[] = [
|
|
25
|
+
{
|
|
26
|
+
id: 'schema-model',
|
|
27
|
+
provider: DyFM_AI_Provider.OpenAI,
|
|
28
|
+
modelType: DyFM_AI_ModelType.Chat,
|
|
29
|
+
capabilities: NO_CAPS,
|
|
30
|
+
settingsSchema: {
|
|
31
|
+
supported: ['maxTokens'],
|
|
32
|
+
unsupported: ['temperature', 'topP'],
|
|
33
|
+
extraParams: ['reasoningEffort'],
|
|
34
|
+
constraints: {
|
|
35
|
+
maxTokens: { min: 10, max: 100 },
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: 'plain-model',
|
|
41
|
+
provider: DyFM_AI_Provider.OpenAI,
|
|
42
|
+
modelType: DyFM_AI_ModelType.Chat,
|
|
43
|
+
capabilities: NO_CAPS,
|
|
44
|
+
},
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
class ReconcilerTestService extends DyNTS_AI_LLM_ServiceBase<DyFM_AI_CallSettings> {
|
|
48
|
+
readonly aiProvider: any = {} as any;
|
|
49
|
+
readonly capabilities: any = {} as any;
|
|
50
|
+
setup = (config: any): void => {};
|
|
51
|
+
testConnection = async (issuer: string): Promise<boolean> => true;
|
|
52
|
+
|
|
53
|
+
readonly defaultSettings: DyFM_AI_CallSettings = {
|
|
54
|
+
systemPrompt: 'Test',
|
|
55
|
+
useModel: 'schema-model',
|
|
56
|
+
debugLog: false,
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
readonly predefinedRequests = { yesNo: { upperCaseYes: 'YES' } };
|
|
60
|
+
|
|
61
|
+
requestSimpleMessage = async (set: any): Promise<string> => { return ''; };
|
|
62
|
+
requestYesNo = async (set: any): Promise<boolean> => { return false; };
|
|
63
|
+
requestPercentage = async (set: any): Promise<number> => { return 0; };
|
|
64
|
+
requestSelect = async <T>(set: any): Promise<T | { unparsableResult: string }> => { return null as any; };
|
|
65
|
+
requestMultiselect = async <T>(set: any): Promise<T[] | { unparsableResult: string }> => { return []; };
|
|
66
|
+
requestJSON = async <T>(set: any): Promise<T | { unparsableResult: string }> => { return null as any; };
|
|
67
|
+
requestJSONQuestionWithKeysDescription = async <T>(set: any): Promise<T | { unparsableResult: string }> => { return null as any; };
|
|
68
|
+
requestJSONWithExactKeys = async <T>(set: any): Promise<T | { unparsableResult: string }> => { return null as any; };
|
|
69
|
+
requestList = async <T>(set: any): Promise<T[] | { unparsableResult: string }> => { return []; };
|
|
70
|
+
|
|
71
|
+
protected override getModelRegistry(): DyFM_AI_ModelInfo[] {
|
|
72
|
+
return TEST_REGISTRY;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
static getInstance(): ReconcilerTestService {
|
|
76
|
+
return ReconcilerTestService.getSingletonInstance();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
describe('| DyNTS_AI_LLM_ServiceBase — FR-048 reconcileCallSettings', () => {
|
|
81
|
+
let service: ReconcilerTestService;
|
|
82
|
+
|
|
83
|
+
beforeEach(() => {
|
|
84
|
+
service = ReconcilerTestService.getInstance();
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it('| dropolja az `unsupported` kulcsokat, a tobbit meghagyja', () => {
|
|
88
|
+
const result: DyFM_AI_CallSettings = (service as any).reconcileCallSettings('schema-model', {
|
|
89
|
+
temperature: 0.7,
|
|
90
|
+
topP: 0.9,
|
|
91
|
+
maxTokens: 50,
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
expect(result.temperature).toBeUndefined();
|
|
95
|
+
expect(result.topP).toBeUndefined();
|
|
96
|
+
expect(result.maxTokens).toBe(50);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('| NEM mutalja az eredeti settings-objektumot', () => {
|
|
100
|
+
const original: DyFM_AI_CallSettings = { temperature: 0.7, maxTokens: 50 };
|
|
101
|
+
|
|
102
|
+
(service as any).reconcileCallSettings('schema-model', original);
|
|
103
|
+
|
|
104
|
+
expect(original.temperature).toBe(0.7);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it('| clamp-eli a `constraints` min/max szerint', () => {
|
|
108
|
+
const tooHigh: DyFM_AI_CallSettings = (service as any).reconcileCallSettings('schema-model', { maxTokens: 500 });
|
|
109
|
+
const tooLow: DyFM_AI_CallSettings = (service as any).reconcileCallSettings('schema-model', { maxTokens: 1 });
|
|
110
|
+
|
|
111
|
+
expect(tooHigh.maxTokens).toBe(100);
|
|
112
|
+
expect(tooLow.maxTokens).toBe(10);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it('| schema-mentes modell → permissziv passthrough (non-breaking)', () => {
|
|
116
|
+
const input: DyFM_AI_CallSettings = { temperature: 0.7, topP: 0.9 };
|
|
117
|
+
const result: DyFM_AI_CallSettings = (service as any).reconcileCallSettings('plain-model', input);
|
|
118
|
+
|
|
119
|
+
expect(result).toBe(input);
|
|
120
|
+
expect(result.temperature).toBe(0.7);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it('| ismeretlen modell → permissziv passthrough (honesty, nem dob)', () => {
|
|
124
|
+
const input: DyFM_AI_CallSettings = { temperature: 0.7 };
|
|
125
|
+
const result: DyFM_AI_CallSettings = (service as any).reconcileCallSettings('nincs-ilyen-modell', input);
|
|
126
|
+
|
|
127
|
+
expect(result).toBe(input);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it('| undefined settings → valtozatlanul visszaadva', () => {
|
|
131
|
+
expect((service as any).reconcileCallSettings('schema-model', undefined)).toBeUndefined();
|
|
132
|
+
});
|
|
133
|
+
});
|
|
@@ -10,6 +10,8 @@ import {
|
|
|
10
10
|
DyFM_AI_ToolHandlers,
|
|
11
11
|
DyFM_AI_ModelInfo,
|
|
12
12
|
DyFM_AI_ModelRegistry_Util,
|
|
13
|
+
DyFM_AI_ModelSettingsSchema,
|
|
14
|
+
DyFM_AI_SettingConstraint,
|
|
13
15
|
} from '@futdevpro/fsm-dynamo/ai';
|
|
14
16
|
import { DyFM_Error, DyFM_Error_Settings, DyFM_getLocalStackLocation, DyFM_Log, DyFM_Object } from '@futdevpro/fsm-dynamo';
|
|
15
17
|
import {
|
|
@@ -82,6 +84,84 @@ export abstract class DyNTS_AI_LLM_ServiceBase<
|
|
|
82
84
|
}
|
|
83
85
|
}
|
|
84
86
|
|
|
87
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
88
|
+
// PER-MODEL SETTINGS RECONCILER — FR-048 //
|
|
89
|
+
//////////////////////////////////////////////////////////////////////////////////////////
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* FR-048 reconciler — a resolved modell `settingsSchema`-ja szerint egyezteti a call-settings-et a
|
|
93
|
+
* tenyleges provider-hivas ELOTT: DROPolja az `unsupported` kulcsokat (debug-log, SOHA nem csendben),
|
|
94
|
+
* CLAMP-eli a `constraints` (min/max) szerint. Ismeretlen modell / schema-mentes registry-bejegyzes →
|
|
95
|
+
* permissziv passthrough + log (best-effort, honesty).
|
|
96
|
+
*
|
|
97
|
+
* Ezzel altalanosul a FR-047 Phase-4 lokalis param-drop (Anthropic Opus 4.7+ temperature/topP/topK) es a
|
|
98
|
+
* FR-047 `isReasoningModel` sampling-drop: a tudas mostantol a registry `settingsSchema`-jaban (SSoT) el,
|
|
99
|
+
* nem provider-translator-onkent duplikalva.
|
|
100
|
+
*
|
|
101
|
+
* NON-BREAKING: ha a registry ures vagy a modellnek nincs schemaja, a bemenet valtozatlanul ter vissza —
|
|
102
|
+
* igy a meglevo providerek viselkedese nem valtozik, amig a schema nincs feltoltve.
|
|
103
|
+
* @param modelId - a feloldott modell azonositoja
|
|
104
|
+
* @param settings - a hivas-settings (opcionalis)
|
|
105
|
+
*/
|
|
106
|
+
protected reconcileCallSettings(modelId: string, settings?: T_AISettings): T_AISettings {
|
|
107
|
+
if (!settings) {
|
|
108
|
+
return settings;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const modelInfo: DyFM_AI_ModelInfo = DyFM_AI_ModelRegistry_Util.findModelInfo(this.getModelRegistry(), modelId);
|
|
112
|
+
const schema: DyFM_AI_ModelSettingsSchema = modelInfo?.settingsSchema;
|
|
113
|
+
|
|
114
|
+
if (!schema) {
|
|
115
|
+
if (this.debugLog) {
|
|
116
|
+
DyFM_Log.info(`[FR-048] no settingsSchema for '${modelId}' — passthrough (best-effort)`);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return settings;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const reconciled: T_AISettings = { ...settings };
|
|
123
|
+
// A generikus `T_AISettings` csak OLVASASRA indexelheto (TS2862), ezert a mutaciot egy nem-generikus
|
|
124
|
+
// aliason vegezzuk — UGYANARRA az objektumra mutat, igy cast nelkul is tipus-helyes marad.
|
|
125
|
+
const mutable: Record<string, unknown> = reconciled;
|
|
126
|
+
|
|
127
|
+
for (const key of schema.unsupported ?? []) {
|
|
128
|
+
if (mutable[key] !== undefined) {
|
|
129
|
+
if (this.debugLog) {
|
|
130
|
+
DyFM_Log.info(`[FR-048] drop unsupported '${key}' for model '${modelId}'`);
|
|
131
|
+
}
|
|
132
|
+
delete mutable[key];
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const constraints: Record<string, DyFM_AI_SettingConstraint> = schema.constraints ?? {};
|
|
137
|
+
|
|
138
|
+
for (const key of Object.keys(constraints)) {
|
|
139
|
+
const constraint: DyFM_AI_SettingConstraint = constraints[key];
|
|
140
|
+
const value: unknown = mutable[key];
|
|
141
|
+
|
|
142
|
+
if (typeof value !== 'number') {
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
let next: number = value;
|
|
147
|
+
|
|
148
|
+
if (typeof constraint.min === 'number' && next < constraint.min) {
|
|
149
|
+
next = constraint.min;
|
|
150
|
+
}
|
|
151
|
+
if (typeof constraint.max === 'number' && next > constraint.max) {
|
|
152
|
+
next = constraint.max;
|
|
153
|
+
}
|
|
154
|
+
if (next !== value) {
|
|
155
|
+
if (this.debugLog) {
|
|
156
|
+
DyFM_Log.info(`[FR-048] clamp '${key}' ${value} → ${next} for model '${modelId}'`);
|
|
157
|
+
}
|
|
158
|
+
mutable[key] = next;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return reconciled;
|
|
163
|
+
}
|
|
164
|
+
|
|
85
165
|
/**
|
|
86
166
|
* GPT valasz Function Calling Agent Tool-okkal — provider-agnosztikus agent-loop.
|
|
87
167
|
* @description A `tools` definiciok + `toolHandlers` alapjan tool-loop-ot futtat: hivja a
|
package/src/_modules/ai/index.ts
CHANGED
|
@@ -10,6 +10,12 @@ export * from './_models/ai-test-generation-result.interface';
|
|
|
10
10
|
export * from './_models/interfaces/dynts-ai-cost-event.interface';
|
|
11
11
|
export * from './_models/interfaces/dynts-ai-cost-event-callback.interface';
|
|
12
12
|
|
|
13
|
+
// FR-048 per-model settings — provider-faithful hiba-alak + validate-mode (production pre-validation).
|
|
14
|
+
// A reconciler (`DyNTS_AI_LLM_ServiceBase.reconcileCallSettings`) testvére: UGYANAZ a `settingsSchema` forrás.
|
|
15
|
+
export * from './_models/interfaces/dynts-ai-provider-error.interface';
|
|
16
|
+
export * from './_collections/ai-provider-error.util';
|
|
17
|
+
export * from './_collections/ai-model-config-validator.util';
|
|
18
|
+
|
|
13
19
|
// Abstract Services
|
|
14
20
|
export * from './_services/ai-provider.service-base';
|
|
15
21
|
export * from './_services/ai-llm.service-base';
|
|
@@ -19,5 +25,9 @@ export * from './_services/ai-user-key.service-base';
|
|
|
19
25
|
|
|
20
26
|
// Concrete Embedding Services + provider-dispatch (BFR-AM-002 / 007 / 008)
|
|
21
27
|
export * from './_services/lmstudio-embedding.control-service';
|
|
22
|
-
export * from './_services/ai-embedding-mock.service';
|
|
23
28
|
export * from './_services/ai-embedding-provider.registry';
|
|
29
|
+
|
|
30
|
+
// BACKWARD-COMPAT (MP-5 SP-5.1): a determinisztikus embedding-mock FIZIKAILAG az `ai-mock` submodulba
|
|
31
|
+
// koltozott (`./_modules/ai-mock/_services/`), de a `@futdevpro/nts-dynamo/ai` import-utvonal VALTOZATLAN —
|
|
32
|
+
// a meglevo consumer (FAM `EMBEDDING_PROVIDER=mock`) nem torik. Uj kod inkabb `@futdevpro/nts-dynamo/ai/ai-mock`.
|
|
33
|
+
export * from './_modules/ai-mock/_services/ai-embedding-mock.service';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ai-embedding-mock.service.d.ts","sourceRoot":"","sources":["../../../../src/_modules/ai/_services/ai-embedding-mock.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,OAAO,EAAE,gBAAgB,EAAE,4BAA4B,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1G,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAE9E,OAAO,EAAE,0BAA0B,EAAE,MAAM,8DAA8D,CAAC;AAC1G,OAAO,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;AAE7E,2GAA2G;AAC3G,eAAO,MAAM,4BAA4B,EAAE,MAAW,CAAC;AAEvD;;;GAGG;AACH,MAAM,WAAW,+BAA+B;IAC9C,6EAA6E;IAC7E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kGAAkG;IAClG,WAAW,CAAC,EAAE,0BAA0B,CAAC;CAC1C;AAED;;;;;;;;;;GAUG;AACH,qBAAa,8BAA+B,SAAQ,8BAA8B;IAEhF,yEAAyE;IACzE,QAAQ,CAAC,UAAU,EAAE,gBAAgB,CAA4B;IAEjE,8FAA8F;IAC9F,SAAS,CAAC,QAAQ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ACzB,QAAQ,EAAE,kBAAkB,GAAG,iBAAiB,EAChD,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EAAE,EACf,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GACb,IAAI;IAkBP,mDAAmD;IACnD,SAAS,CAAC,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM;CASlD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ai-embedding-mock.service.js","sourceRoot":"","sources":["../../../../src/_modules/ai/_services/ai-embedding-mock.service.ts"],"names":[],"mappings":";;;;AAAA,uDAAiC;AAGjC,iDAA0G;AAI1G,2EAA6E;AAE7E,2GAA2G;AAC9F,QAAA,4BAA4B,GAAW,EAAE,CAAC;AAavD;;;;;;;;;;GAUG;AACH,MAAa,8BAA+B,SAAQ,0DAA8B;IAEhF,yEAAyE;IAChE,UAAU,GAAqB,qBAAgB,CAAC,OAAO,CAAC;IAEjE,8FAA8F;IAC3E,YAAY,GAAW,MAAM,CAAC;IAEjD,4DAA4D;IACnD,YAAY,GAAiC;QACpD,IAAI,EAAE,KAAK;QACX,UAAU,EAAE,IAAI;QAChB,eAAe,EAAE,KAAK;QACtB,MAAM,EAAE,KAAK;QACb,eAAe,EAAE,KAAK;QACtB,aAAa,EAAE,KAAK;QACpB,eAAe,EAAE,KAAK;QACtB,SAAS,EAAE,KAAK;QAChB,eAAe,EAAE,IAAI;QACrB,mBAAmB,EAAE,EAAE;KACxB,CAAC;IAEF,oCAAoC;IAC1B,IAAI,CAAS;IAEvB,gDAAgD;IAChD,YAAY,GAAqC;QAC/C,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,IAAI,GAAG,GAAG,EAAE,IAAI,IAAI,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,oCAA4B,CAAC;QAEhF,IAAI,GAAG,EAAE,WAAW,EAAE,CAAC;YACrB,IAAI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