@agentica/core
Version:
Agentic AI Library specialized in LLM Function Calling
35 lines • 1.65 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AgenticaDefaultPrompt = void 0;
exports.write = write;
const tstl_1 = require("tstl");
const Singleton_1 = require("../utils/Singleton");
const AgenticaSystemPrompt_1 = require("./AgenticaSystemPrompt");
/**
* @TODO maybe replace `process` property for lint pass
*/
const getLocale = new Singleton_1.Singleton(() => {
var _a, _b;
return (0, tstl_1.is_node)()
// eslint-disable-next-line node/prefer-global/process
? ((_b = (_a = process.env.LANG) === null || _a === void 0 ? void 0 : _a.split(".")[0]) !== null && _b !== void 0 ? _b : "en-US")
: navigator.language;
});
const getTimezone = new Singleton_1.Singleton(() => Intl.DateTimeFormat().resolvedOptions().timeZone);
function write(config) {
var _a, _b, _c;
if (((_a = config === null || config === void 0 ? void 0 : config.systemPrompt) === null || _a === void 0 ? void 0 : _a.common) !== undefined) {
return config.systemPrompt.common(config);
}
const locale = (_b = config === null || config === void 0 ? void 0 : config.locale) !== null && _b !== void 0 ? _b : getLocale.get();
const timezone = (_c = config === null || config === void 0 ? void 0 : config.timezone) !== null && _c !== void 0 ? _c : getTimezone.get();
return AgenticaSystemPrompt_1.AgenticaSystemPrompt.COMMON
// intended code
.replace("${locale}", locale)
.replace("${timezone}", timezone)
.replace("${datetime}", new Date().toISOString());
}
exports.AgenticaDefaultPrompt = {
write,
};
//# sourceMappingURL=AgenticaDefaultPrompt.js.map