UNPKG

unstructured-client

Version:

<h3 align="center"> <img src="https://raw.githubusercontent.com/Unstructured-IO/unstructured/main/img/unstructured_logo.png" height="200" > </h3>

47 lines 1.54 kB
/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ // Optional function to assist with formatting prompt results export async function formatResult(value) { return { messages: [ { role: "user", content: { type: "text", text: value, }, }, ], }; } export function createRegisterPrompt(logger, server, sdk, allowedScopes) { return (prompt) => { const scopes = prompt.scopes ?? []; if (allowedScopes.size > 0 && scopes.length === 0) { return; } if (allowedScopes.size > 0 && !scopes.every((s) => allowedScopes.has(s))) { return; } if (prompt.args) { if (prompt.description) { server.prompt(prompt.name, prompt.description, prompt.args, async (args, ctx) => prompt.prompt(sdk, args, ctx)); } else { server.prompt(prompt.name, prompt.args, async (args, ctx) => prompt.prompt(sdk, args, ctx)); } } else { if (prompt.description) { server.prompt(prompt.name, prompt.description, async (ctx) => prompt.prompt(sdk, ctx)); } else { server.prompt(prompt.name, async (ctx) => prompt.prompt(sdk, ctx)); } } logger.debug("Registered prompt", { name: prompt.name }); }; } //# sourceMappingURL=prompts.js.map