@ai-d/aid
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -49,2 +49,5 @@ "use strict"; | ||
var import_zod_to_ts = require("zod-to-ts"); | ||
var instruction = (strategy) => ` | ||
Response in JSON format (without other words or code fences) that follows the ${strategy === "ts" ? "TypeScript type" : "JSON Schema"}: | ||
`; | ||
var DefaultJSON = (opt) => { | ||
@@ -57,3 +60,3 @@ return async (messages, schema) => { | ||
} | ||
system.content += "\nResponse in JSON format that follows the schema:\n" + ((opt == null ? void 0 : opt.strategy) === "ts" ? (0, import_zod_to_ts.printNode)((0, import_zod_to_ts.zodToTs)(schema).node) : JSON.stringify((0, import_zod_to_json_schema.default)(schema), null, 2)); | ||
system.content += instruction(opt == null ? void 0 : opt.strategy) + ((opt == null ? void 0 : opt.strategy) === "ts" ? (0, import_zod_to_ts.printNode)((0, import_zod_to_ts.zodToTs)(schema).node) : JSON.stringify((0, import_zod_to_json_schema.default)(schema), null, 2)); | ||
system.content = system.content.trim(); | ||
@@ -71,5 +74,3 @@ return messages; | ||
} | ||
const prompt = ` | ||
Response in JSON format (without other words or code fences) that follows the ${opt.strategy === "ts" ? "TypeScript type" : "JSON Schema"}: | ||
` + ((opt == null ? void 0 : opt.strategy) === "ts" ? (0, import_zod_to_ts.printNode)((0, import_zod_to_ts.zodToTs)(schema).node) : JSON.stringify((0, import_zod_to_json_schema.default)(schema), null, 2)); | ||
const prompt = instruction(opt == null ? void 0 : opt.strategy) + ((opt == null ? void 0 : opt.strategy) === "ts" ? (0, import_zod_to_ts.printNode)((0, import_zod_to_ts.zodToTs)(schema).node) : JSON.stringify((0, import_zod_to_json_schema.default)(schema), null, 2)); | ||
if (typeof system.content === "string") { | ||
@@ -76,0 +77,0 @@ system.content += prompt; |
{ | ||
"name": "@ai-d/aid", | ||
"description": "Aid provides a structured and type-safe way to interact with LLMs.", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"author": "JacobLinCool <jacoblincool@gmail.com> (https://jacoblin.cool)", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
31544
618