@skmtc/core 0.0.487 → 0.0.490
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/esm/run/enrichSettings.d.ts +2 -1
- package/esm/run/enrichSettings.d.ts.map +1 -1
- package/esm/run/enrichSettings.js +1 -2
- package/esm/run/handleEnrichment.d.ts.map +1 -1
- package/esm/run/handleEnrichment.js +2 -1
- package/esm/run/toEnrichments.d.ts +5 -1
- package/esm/run/toEnrichments.d.ts.map +1 -1
- package/esm/run/toEnrichments.js +15 -8
- package/esm/types/EnrichmentRequest.d.ts +2 -2
- package/esm/types/EnrichmentRequest.d.ts.map +1 -1
- package/package.json +3 -2
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ClientGeneratorSettings } from '../types/Settings.js';
|
|
2
|
+
import type { EnrichmentItem } from './toEnrichments.js';
|
|
2
3
|
type EnrichSettingsArgs = {
|
|
3
4
|
generatorSettings: ClientGeneratorSettings[];
|
|
4
|
-
enrichments: Record<string,
|
|
5
|
+
enrichments: Record<string, EnrichmentItem[]>;
|
|
5
6
|
};
|
|
6
7
|
export declare const enrichSettings: ({ generatorSettings, enrichments }: EnrichSettingsArgs) => ClientGeneratorSettings[];
|
|
7
8
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enrichSettings.d.ts","sourceRoot":"","sources":["../../src/run/enrichSettings.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"enrichSettings.d.ts","sourceRoot":"","sources":["../../src/run/enrichSettings.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAExD,KAAK,kBAAkB,GAAG;IACxB,iBAAiB,EAAE,uBAAuB,EAAE,CAAA;IAC5C,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC,CAAA;CAC9C,CAAA;AAED,eAAO,MAAM,cAAc,uCAAwC,kBAAkB,8BAQpF,CAAA"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { set } from 'lodash-es';
|
|
2
2
|
export const enrichSettings = ({ generatorSettings, enrichments }) => {
|
|
3
3
|
Object.values(generatorSettings).forEach(setting => {
|
|
4
|
-
Object.
|
|
5
|
-
console.log('KEY', key);
|
|
4
|
+
Object.values(enrichments[setting.id] ?? {}).forEach(({ key, value }) => {
|
|
6
5
|
set(setting, key, value);
|
|
7
6
|
});
|
|
8
7
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleEnrichment.d.ts","sourceRoot":"","sources":["../../src/run/handleEnrichment.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;
|
|
1
|
+
{"version":3,"file":"handleEnrichment.d.ts","sourceRoot":"","sources":["../../src/run/handleEnrichment.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AAetE,eAAO,MAAM,gBAAgB,wCAA+C,iBAAiB,oBAmC5F,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as dntShim from "../_dnt.shims.js";
|
|
2
2
|
import { GoogleGenerativeAI } from '@google/generative-ai';
|
|
3
|
+
import { zodToJsonSchema } from 'zod-to-json-schema';
|
|
3
4
|
const apiKey = dntShim.Deno.env.get('GEMINI_API_KEY');
|
|
4
5
|
if (!apiKey) {
|
|
5
6
|
throw new Error('GEMINI_API_KEY is not set');
|
|
@@ -16,7 +17,7 @@ export const handleEnrichment = async ({ prompt, content, responseSchema }) => {
|
|
|
16
17
|
topK: 40,
|
|
17
18
|
maxOutputTokens: 8192,
|
|
18
19
|
responseMimeType: 'application/json',
|
|
19
|
-
responseSchema
|
|
20
|
+
responseSchema: zodToJsonSchema(responseSchema)
|
|
20
21
|
},
|
|
21
22
|
history: [
|
|
22
23
|
{
|
|
@@ -7,6 +7,10 @@ type ToEnrichmentsArgs = {
|
|
|
7
7
|
generators: GeneratorsType[];
|
|
8
8
|
oasDocument: OasDocument;
|
|
9
9
|
};
|
|
10
|
-
export
|
|
10
|
+
export type EnrichmentItem = {
|
|
11
|
+
key: string[];
|
|
12
|
+
value: unknown;
|
|
13
|
+
};
|
|
14
|
+
export declare const toEnrichments: ({ generators, oasDocument }: ToEnrichmentsArgs) => Promise<Record<string, EnrichmentItem[]>>;
|
|
11
15
|
export {};
|
|
12
16
|
//# sourceMappingURL=toEnrichments.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toEnrichments.d.ts","sourceRoot":"","sources":["../../src/run/toEnrichments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAA;AACpG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAI9D,KAAK,cAAc,GACf,gBAAgB,GAChB,mBAAmB,CAAC,cAAc,CAAC,GACnC,eAAe,CAAC,cAAc,CAAC,CAAA;AAEnC,KAAK,iBAAiB,GAAG;IACvB,UAAU,EAAE,cAAc,EAAE,CAAA;IAC5B,WAAW,EAAE,WAAW,CAAA;CACzB,CAAA;AAED,eAAO,MAAM,aAAa,gCAAuC,iBAAiB,
|
|
1
|
+
{"version":3,"file":"toEnrichments.d.ts","sourceRoot":"","sources":["../../src/run/toEnrichments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA;AACtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAA;AACpG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AAI9D,KAAK,cAAc,GACf,gBAAgB,GAChB,mBAAmB,CAAC,cAAc,CAAC,GACnC,eAAe,CAAC,cAAc,CAAC,CAAA;AAEnC,KAAK,iBAAiB,GAAG;IACvB,UAAU,EAAE,cAAc,EAAE,CAAA;IAC5B,WAAW,EAAE,WAAW,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,MAAM,EAAE,CAAA;IACb,KAAK,EAAE,OAAO,CAAA;CACf,CAAA;AAED,eAAO,MAAM,aAAa,gCAAuC,iBAAiB,8CA4CjF,CAAA"}
|
package/esm/run/toEnrichments.js
CHANGED
|
@@ -7,10 +7,13 @@ export const toEnrichments = async ({ generators, oasDocument }) => {
|
|
|
7
7
|
const enrichmentRequest = generator.toEnrichmentRequest?.(operation);
|
|
8
8
|
if (enrichmentRequest) {
|
|
9
9
|
const enrichmentResponse = await handleEnrichment(enrichmentRequest);
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
if (!output[generator.id]) {
|
|
11
|
+
output[generator.id] = [];
|
|
12
|
+
}
|
|
13
|
+
output[generator.id].push({
|
|
14
|
+
key: ['operations', operation.path, operation.method, 'enrichments'],
|
|
15
|
+
value: JSON.parse(enrichmentResponse)
|
|
16
|
+
});
|
|
14
17
|
}
|
|
15
18
|
}
|
|
16
19
|
}
|
|
@@ -19,13 +22,17 @@ export const toEnrichments = async ({ generators, oasDocument }) => {
|
|
|
19
22
|
const enrichmentRequest = generator.toEnrichmentRequest?.(refName);
|
|
20
23
|
if (enrichmentRequest) {
|
|
21
24
|
const enrichmentResponse = await handleEnrichment(enrichmentRequest);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
if (!output[generator.id]) {
|
|
26
|
+
output[generator.id] = [];
|
|
27
|
+
}
|
|
28
|
+
output[generator.id].push({
|
|
29
|
+
key: ['models', refName, 'enrichments'],
|
|
30
|
+
value: JSON.parse(enrichmentResponse)
|
|
31
|
+
});
|
|
26
32
|
}
|
|
27
33
|
}
|
|
28
34
|
}
|
|
29
35
|
}
|
|
36
|
+
console.log('OUTPUT', output);
|
|
30
37
|
return output;
|
|
31
38
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "../_dnt.polyfills.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { z } from 'zod';
|
|
3
3
|
export type EnrichmentRequest = {
|
|
4
4
|
prompt: string;
|
|
5
|
-
responseSchema:
|
|
5
|
+
responseSchema: z.ZodType<unknown>;
|
|
6
6
|
content: string;
|
|
7
7
|
};
|
|
8
8
|
//# sourceMappingURL=EnrichmentRequest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnrichmentRequest.d.ts","sourceRoot":"","sources":["../../src/types/EnrichmentRequest.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"EnrichmentRequest.d.ts","sourceRoot":"","sources":["../../src/types/EnrichmentRequest.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAE5B,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IAClC,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skmtc/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.490",
|
|
4
4
|
"module": "./esm/mod.js",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -54,7 +54,8 @@
|
|
|
54
54
|
"openapi-types": "12.1.3",
|
|
55
55
|
"tiny-invariant": "1.3.3",
|
|
56
56
|
"ts-pattern": "5.6.0",
|
|
57
|
-
"zod": "3.24.1"
|
|
57
|
+
"zod": "3.24.1",
|
|
58
|
+
"zod-to-json-schema": "3.24.1"
|
|
58
59
|
},
|
|
59
60
|
"devDependencies": {
|
|
60
61
|
"@types/lodash-es": "4.17.12",
|