@graphext/cuery 0.9.2 → 0.9.4
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google.d.ts","sourceRoot":"","sources":["../../../src/src/providers/google.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,CAAC,EAAE,MAAM,+CAA+C,CAAC;AAGlE,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"google.d.ts","sourceRoot":"","sources":["../../../src/src/providers/google.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,CAAC,EAAE,MAAM,+CAA+C,CAAC;AAGlE,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAiDpF;;GAEG;AACH,qBAAa,cAAe,YAAW,WAAW;IACjD,QAAQ,CAAC,IAAI,YAAY;IACzB,OAAO,CAAC,MAAM,CAAc;gBAEhB,MAAM,CAAC,EAAE,MAAM;IAUrB,QAAQ,CAAC,CAAC,EACf,QAAQ,EAAE,OAAO,EAAE,EACnB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,EAC3B,MAAM,CAAC,EAAE,cAAc,GACrB,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;CAiE1B"}
|
|
@@ -38,6 +38,15 @@ function convertMessages(messages) {
|
|
|
38
38
|
}
|
|
39
39
|
return contents;
|
|
40
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Convert a Zod schema to a Gemini-compatible response schema.
|
|
43
|
+
*
|
|
44
|
+
* Gemini `responseSchema` expects an OpenAPI-style schema object and rejects
|
|
45
|
+
* JSON Schema root fields like `$schema`.
|
|
46
|
+
*/
|
|
47
|
+
function toGeminiResponseSchema(schema) {
|
|
48
|
+
return z.toJSONSchema(schema, { target: 'openapi-3.0' });
|
|
49
|
+
}
|
|
41
50
|
/**
|
|
42
51
|
* Google LLM provider (for Gemini models).
|
|
43
52
|
*/
|
|
@@ -58,7 +67,7 @@ export class GoogleProvider {
|
|
|
58
67
|
};
|
|
59
68
|
if (schema != null) {
|
|
60
69
|
config.responseMimeType = 'application/json';
|
|
61
|
-
config.responseSchema =
|
|
70
|
+
config.responseSchema = toGeminiResponseSchema(schema);
|
|
62
71
|
}
|
|
63
72
|
const response = await this.client.models.generateContent({
|
|
64
73
|
model,
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google.d.ts","sourceRoot":"","sources":["../../../src/src/providers/google.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,CAAC,EAAE,MAAM,+CAA+C,CAAC;AAGlE,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"google.d.ts","sourceRoot":"","sources":["../../../src/src/providers/google.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,CAAC,EAAE,MAAM,+CAA+C,CAAC;AAGlE,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAiDpF;;GAEG;AACH,qBAAa,cAAe,YAAW,WAAW;IACjD,QAAQ,CAAC,IAAI,YAAY;IACzB,OAAO,CAAC,MAAM,CAAc;gBAEhB,MAAM,CAAC,EAAE,MAAM;IAUrB,QAAQ,CAAC,CAAC,EACf,QAAQ,EAAE,OAAO,EAAE,EACnB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI,EAC3B,MAAM,CAAC,EAAE,cAAc,GACrB,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;CAiE1B"}
|
|
@@ -74,6 +74,15 @@ function convertMessages(messages) {
|
|
|
74
74
|
}
|
|
75
75
|
return contents;
|
|
76
76
|
}
|
|
77
|
+
/**
|
|
78
|
+
* Convert a Zod schema to a Gemini-compatible response schema.
|
|
79
|
+
*
|
|
80
|
+
* Gemini `responseSchema` expects an OpenAPI-style schema object and rejects
|
|
81
|
+
* JSON Schema root fields like `$schema`.
|
|
82
|
+
*/
|
|
83
|
+
function toGeminiResponseSchema(schema) {
|
|
84
|
+
return index_js_1.z.toJSONSchema(schema, { target: 'openapi-3.0' });
|
|
85
|
+
}
|
|
77
86
|
/**
|
|
78
87
|
* Google LLM provider (for Gemini models).
|
|
79
88
|
*/
|
|
@@ -94,7 +103,7 @@ class GoogleProvider {
|
|
|
94
103
|
};
|
|
95
104
|
if (schema != null) {
|
|
96
105
|
config.responseMimeType = 'application/json';
|
|
97
|
-
config.responseSchema =
|
|
106
|
+
config.responseSchema = toGeminiResponseSchema(schema);
|
|
98
107
|
}
|
|
99
108
|
const response = await this.client.models.generateContent({
|
|
100
109
|
model,
|