@skmtc/core 0.0.503 → 0.0.505
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 -1
- package/esm/run/handleEnrichment.d.ts.map +1 -1
- package/esm/run/handleEnrichment.js +6 -2
- package/package.json +1 -1
- package/script/run/handleEnrichment.d.ts +1 -1
- package/script/run/handleEnrichment.d.ts.map +1 -1
- package/script/run/handleEnrichment.js +6 -2
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { EnrichmentRequest } from '../types/EnrichmentRequest.js';
|
|
2
|
-
export declare const handleEnrichment: <EnrichmentType>({ prompt, content, responseSchema }: EnrichmentRequest<EnrichmentType>) => Promise<string>;
|
|
2
|
+
export declare const handleEnrichment: <EnrichmentType>({ prompt, content, responseSchema: zodResponseSchema }: EnrichmentRequest<EnrichmentType>) => Promise<string>;
|
|
3
3
|
//# 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,
|
|
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"}
|
|
@@ -9,7 +9,11 @@ const genAI = new GoogleGenerativeAI(apiKey);
|
|
|
9
9
|
const model = genAI.getGenerativeModel({
|
|
10
10
|
model: 'gemini-1.5-flash'
|
|
11
11
|
});
|
|
12
|
-
export const handleEnrichment = async ({ prompt, content, responseSchema }) => {
|
|
12
|
+
export const handleEnrichment = async ({ prompt, content, responseSchema: zodResponseSchema }) => {
|
|
13
|
+
const responseSchema = zodToJsonSchema(zodResponseSchema, {
|
|
14
|
+
target: 'openApi3'
|
|
15
|
+
});
|
|
16
|
+
console.log('RESPONSE SCHEMA', responseSchema);
|
|
13
17
|
const chatSession = model.startChat({
|
|
14
18
|
generationConfig: {
|
|
15
19
|
temperature: 1,
|
|
@@ -17,7 +21,7 @@ export const handleEnrichment = async ({ prompt, content, responseSchema }) => {
|
|
|
17
21
|
topK: 40,
|
|
18
22
|
maxOutputTokens: 8192,
|
|
19
23
|
responseMimeType: 'application/json',
|
|
20
|
-
responseSchema
|
|
24
|
+
responseSchema
|
|
21
25
|
},
|
|
22
26
|
history: [
|
|
23
27
|
{
|
package/package.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { EnrichmentRequest } from '../types/EnrichmentRequest.js';
|
|
2
|
-
export declare const handleEnrichment: <EnrichmentType>({ prompt, content, responseSchema }: EnrichmentRequest<EnrichmentType>) => Promise<string>;
|
|
2
|
+
export declare const handleEnrichment: <EnrichmentType>({ prompt, content, responseSchema: zodResponseSchema }: EnrichmentRequest<EnrichmentType>) => Promise<string>;
|
|
3
3
|
//# 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,
|
|
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"}
|
|
@@ -35,7 +35,11 @@ const genAI = new generative_ai_1.GoogleGenerativeAI(apiKey);
|
|
|
35
35
|
const model = genAI.getGenerativeModel({
|
|
36
36
|
model: 'gemini-1.5-flash'
|
|
37
37
|
});
|
|
38
|
-
const handleEnrichment = async ({ prompt, content, responseSchema }) => {
|
|
38
|
+
const handleEnrichment = async ({ prompt, content, responseSchema: zodResponseSchema }) => {
|
|
39
|
+
const responseSchema = (0, zod_to_json_schema_1.zodToJsonSchema)(zodResponseSchema, {
|
|
40
|
+
target: 'openApi3'
|
|
41
|
+
});
|
|
42
|
+
console.log('RESPONSE SCHEMA', responseSchema);
|
|
39
43
|
const chatSession = model.startChat({
|
|
40
44
|
generationConfig: {
|
|
41
45
|
temperature: 1,
|
|
@@ -43,7 +47,7 @@ const handleEnrichment = async ({ prompt, content, responseSchema }) => {
|
|
|
43
47
|
topK: 40,
|
|
44
48
|
maxOutputTokens: 8192,
|
|
45
49
|
responseMimeType: 'application/json',
|
|
46
|
-
responseSchema
|
|
50
|
+
responseSchema
|
|
47
51
|
},
|
|
48
52
|
history: [
|
|
49
53
|
{
|