@skmtc/core 0.0.505 → 0.0.506
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/handleEnrichment.d.ts +1 -0
- package/esm/run/handleEnrichment.d.ts.map +1 -1
- package/esm/run/handleEnrichment.js +25 -1
- package/package.json +1 -1
- package/script/run/handleEnrichment.d.ts +1 -0
- package/script/run/handleEnrichment.d.ts.map +1 -1
- package/script/run/handleEnrichment.js +26 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { EnrichmentRequest } from '../types/EnrichmentRequest.js';
|
|
2
2
|
export declare const handleEnrichment: <EnrichmentType>({ prompt, content, responseSchema: zodResponseSchema }: EnrichmentRequest<EnrichmentType>) => Promise<string>;
|
|
3
|
+
export declare function removeProperties<T extends Record<string, any>>(obj: T, propertyName: string): Partial<T>;
|
|
3
4
|
//# sourceMappingURL=handleEnrichment.d.ts.map
|
|
@@ -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;AAetE,eAAO,MAAM,gBAAgB,GAAU,cAAc,0DAIlD,iBAAiB,CAAC,cAAc,CAAC,oBAyCnC,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,GAAU,cAAc,0DAIlD,iBAAiB,CAAC,cAAc,CAAC,oBAyCnC,CAAA;AAGD,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC5D,GAAG,EAAE,CAAC,EACN,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,CAAC,CAAC,CAyBZ"}
|
|
@@ -21,7 +21,7 @@ export const handleEnrichment = async ({ prompt, content, responseSchema: zodRes
|
|
|
21
21
|
topK: 40,
|
|
22
22
|
maxOutputTokens: 8192,
|
|
23
23
|
responseMimeType: 'application/json',
|
|
24
|
-
responseSchema
|
|
24
|
+
responseSchema: removeProperties(responseSchema, 'additionalProperties')
|
|
25
25
|
},
|
|
26
26
|
history: [
|
|
27
27
|
{
|
|
@@ -46,3 +46,27 @@ export const handleEnrichment = async ({ prompt, content, responseSchema: zodRes
|
|
|
46
46
|
console.log('RESULT', result);
|
|
47
47
|
return result.response.text();
|
|
48
48
|
};
|
|
49
|
+
// deno-lint-ignore no-explicit-any
|
|
50
|
+
export function removeProperties(obj, propertyName) {
|
|
51
|
+
if (typeof obj !== 'object' || obj === null) {
|
|
52
|
+
return obj;
|
|
53
|
+
}
|
|
54
|
+
// deno-lint-ignore ban-ts-comment
|
|
55
|
+
// @ts-ignore
|
|
56
|
+
const result = Array.isArray(obj) ? [] : {};
|
|
57
|
+
for (const key in obj) {
|
|
58
|
+
if (key === propertyName) {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
const value = obj[key];
|
|
62
|
+
if (typeof value === 'object' && value !== null) {
|
|
63
|
+
// deno-lint-ignore ban-ts-comment
|
|
64
|
+
// @ts-ignore
|
|
65
|
+
result[key] = removeProperties(value, propertyName);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
result[key] = value;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return result;
|
|
72
|
+
}
|
package/package.json
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { EnrichmentRequest } from '../types/EnrichmentRequest.js';
|
|
2
2
|
export declare const handleEnrichment: <EnrichmentType>({ prompt, content, responseSchema: zodResponseSchema }: EnrichmentRequest<EnrichmentType>) => Promise<string>;
|
|
3
|
+
export declare function removeProperties<T extends Record<string, any>>(obj: T, propertyName: string): Partial<T>;
|
|
3
4
|
//# sourceMappingURL=handleEnrichment.d.ts.map
|
|
@@ -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;AAetE,eAAO,MAAM,gBAAgB,GAAU,cAAc,0DAIlD,iBAAiB,CAAC,cAAc,CAAC,oBAyCnC,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,GAAU,cAAc,0DAIlD,iBAAiB,CAAC,cAAc,CAAC,oBAyCnC,CAAA;AAGD,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC5D,GAAG,EAAE,CAAC,EACN,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,CAAC,CAAC,CAyBZ"}
|
|
@@ -24,6 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.handleEnrichment = void 0;
|
|
27
|
+
exports.removeProperties = removeProperties;
|
|
27
28
|
const dntShim = __importStar(require("../_dnt.shims.js"));
|
|
28
29
|
const generative_ai_1 = require("@google/generative-ai");
|
|
29
30
|
const zod_to_json_schema_1 = require("zod-to-json-schema");
|
|
@@ -47,7 +48,7 @@ const handleEnrichment = async ({ prompt, content, responseSchema: zodResponseSc
|
|
|
47
48
|
topK: 40,
|
|
48
49
|
maxOutputTokens: 8192,
|
|
49
50
|
responseMimeType: 'application/json',
|
|
50
|
-
responseSchema
|
|
51
|
+
responseSchema: removeProperties(responseSchema, 'additionalProperties')
|
|
51
52
|
},
|
|
52
53
|
history: [
|
|
53
54
|
{
|
|
@@ -73,3 +74,27 @@ const handleEnrichment = async ({ prompt, content, responseSchema: zodResponseSc
|
|
|
73
74
|
return result.response.text();
|
|
74
75
|
};
|
|
75
76
|
exports.handleEnrichment = handleEnrichment;
|
|
77
|
+
// deno-lint-ignore no-explicit-any
|
|
78
|
+
function removeProperties(obj, propertyName) {
|
|
79
|
+
if (typeof obj !== 'object' || obj === null) {
|
|
80
|
+
return obj;
|
|
81
|
+
}
|
|
82
|
+
// deno-lint-ignore ban-ts-comment
|
|
83
|
+
// @ts-ignore
|
|
84
|
+
const result = Array.isArray(obj) ? [] : {};
|
|
85
|
+
for (const key in obj) {
|
|
86
|
+
if (key === propertyName) {
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
const value = obj[key];
|
|
90
|
+
if (typeof value === 'object' && value !== null) {
|
|
91
|
+
// deno-lint-ignore ban-ts-comment
|
|
92
|
+
// @ts-ignore
|
|
93
|
+
result[key] = removeProperties(value, propertyName);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
result[key] = value;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return result;
|
|
100
|
+
}
|