aiwrapper
Version:
A Universal AI Wrapper for JavaScript & TypeScript
24 lines (22 loc) • 650 B
JavaScript
import zodToJsonSchema from "zod-to-json-schema";
import { isZodSchema } from "./schema/schema-utils.js";
function addInstructionAboutSchema(schema) {
let schemaStr = "";
if (isZodSchema(schema)) {
const jsonSchema = zodToJsonSchema(schema);
schemaStr = JSON.stringify(jsonSchema, null, 2);
} else {
schemaStr = JSON.stringify(schema, null, 2);
}
return `<outputFormat>
You must return a valid JSON that follows this exact schema structure:
\`\`\`json
${schemaStr}
\`\`\`
Don't include any text outside the JSON.
</outputFormat>`;
}
export {
addInstructionAboutSchema
};
//# sourceMappingURL=prompt-for-json.js.map