@genkit-ai/core
Version:
Genkit AI framework core libraries.
33 lines • 969 B
JavaScript
import { logger } from "./logging.mjs";
const CONFIG_KEY = "__GENKIT_RUNTIME_CONFIG__";
function getConfig() {
if (!global[CONFIG_KEY]) {
global[CONFIG_KEY] = {};
}
return global[CONFIG_KEY];
}
function setGenkitRuntimeConfig(config) {
if (config.jsonSchemaMode === "interpret") {
logger.warn(
"It looks like you're trying to disable schema code generation. Please ensure that the '@cfworker/json-schema' package is installed: `npm i --save @cfworker/json-schema`"
);
}
const current = getConfig();
global[CONFIG_KEY] = { ...current, ...config };
}
function getGenkitRuntimeConfig() {
const config = getConfig();
return {
jsonSchemaMode: config.jsonSchemaMode ?? "compile",
sandboxedRuntime: config.sandboxedRuntime ?? false
};
}
function resetGenkitRuntimeConfig() {
global[CONFIG_KEY] = {};
}
export {
getGenkitRuntimeConfig,
resetGenkitRuntimeConfig,
setGenkitRuntimeConfig
};
//# sourceMappingURL=config.mjs.map