/opt/canhelp/node_modules/@anthropic-ai/sdk/helpers
NameSizeModeActions
beta/-0755rm
index.d.mts1410644editdlrm
index.d.mts.map1550644editdlrm
index.d.ts1380644editdlrm
index.d.ts.map1540644editdlrm
index.js5310644editdlrm
index.js.map1830644editdlrm
index.mjs1390644editdlrm
index.mjs.map1530644editdlrm
json-schema.d.mts8880644editdlrm
json-schema.d.mts.map5340644editdlrm
json-schema.d.ts8860644editdlrm
json-schema.d.ts.map5330644editdlrm
json-schema.js14750644editdlrm
json-schema.js.map8420644editdlrm
json-schema.mjs13150644editdlrm
json-schema.mjs.map8440644editdlrm
zod.d.mts7090644editdlrm
zod.d.mts.map3120644editdlrm
zod.d.ts7070644editdlrm
zod.d.ts.map3110644editdlrm
zod.js20960644editdlrm
zod.js.map13680644editdlrm
zod.mjs18710644editdlrm
zod.mjs.map13810644editdlrm
Edit: /opt/canhelp/node_modules/@anthropic-ai/sdk/helpers/json-schema.mjs (1315B)
import { AnthropicError } from "../core/error.mjs"; import { transformJSONSchema } from "../lib/transform-json-schema.mjs"; /** * Creates a JSON schema output format object from the given JSON schema. * If this is passed to the `.parse()` method then the response message will contain a * `.parsed_output` property that is the result of parsing the content with the given JSON schema. * * Note: When `transform` is enabled (the default), the schema is deep-cloned before transformation, * so the original schema object is not modified. */ export function jsonSchemaOutputFormat(jsonSchema, options) { if (jsonSchema.type !== 'object') { throw new Error(`JSON schema must be an object, but got ${jsonSchema.type}`); } const transform = options?.transform ?? true; if (transform) { jsonSchema = transformJSONSchema(jsonSchema); } return { type: 'json_schema', schema: { ...jsonSchema, }, parse: (content) => { try { return JSON.parse(content); } catch (error) { throw new AnthropicError(`Failed to parse structured output: ${error instanceof Error ? error.message : String(error)}`); } }, }; } //# sourceMappingURL=json-schema.mjs.map