UNPKG

@samchon/openapi

Version:

Universal OpenAPI to LLM function calling schemas. Transform any Swagger/OpenAPI document into type-safe schemas for OpenAI, Claude, Qwen, and more.

25 lines (21 loc) 1.11 kB
import { HttpMigrateRouteFetcher } from "./HttpMigrateRouteFetcher.mjs"; var HttpLlmFunctionFetcher; (function(HttpLlmFunctionFetcher) { HttpLlmFunctionFetcher.execute = props => HttpMigrateRouteFetcher.execute(getFetchArguments("execute", props)); HttpLlmFunctionFetcher.propagate = props => HttpMigrateRouteFetcher.propagate(getFetchArguments("propagate", props)); const getFetchArguments = (from, props) => { const route = props.function.route(); const input = props.input; const valid = typeof input === "object" && input !== null; if (valid === false) throw new Error(`Error on HttpLlmFunctionFetcher.${from}(): keyworded arguments must be an object`); return { connection: props.connection, route, parameters: Object.fromEntries(route.parameters.map(p => [ p.key, input[p.key] ])), query: input.query, body: input.body }; }; })(HttpLlmFunctionFetcher || (HttpLlmFunctionFetcher = {})); export { HttpLlmFunctionFetcher }; //# sourceMappingURL=HttpLlmFunctionFetcher.mjs.map