@elizaos/core 1.6.2-alpha.14 → 1.6.2-alpha.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.browser.js +52 -45
- package/dist/browser/index.browser.js.map +4 -4
- package/dist/node/index.node.js +46 -1
- package/dist/node/index.node.js.map +4 -4
- package/dist/runtime.d.ts +5 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/types/model.d.ts +26 -0
- package/dist/types/model.d.ts.map +1 -1
- package/dist/types/runtime.d.ts +2 -1
- package/dist/types/runtime.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/node/index.node.js
CHANGED
|
@@ -45173,6 +45173,51 @@ class AgentRuntime {
|
|
|
45173
45173
|
throw error;
|
|
45174
45174
|
}
|
|
45175
45175
|
}
|
|
45176
|
+
async generateText(input, options) {
|
|
45177
|
+
if (!input?.trim()) {
|
|
45178
|
+
throw new Error("Input cannot be empty");
|
|
45179
|
+
}
|
|
45180
|
+
const includeCharacter = options?.includeCharacter ?? true;
|
|
45181
|
+
const modelType = options?.modelType ?? ModelType.TEXT_LARGE;
|
|
45182
|
+
let prompt = input;
|
|
45183
|
+
if (includeCharacter && this.character) {
|
|
45184
|
+
const c = this.character;
|
|
45185
|
+
const parts = [];
|
|
45186
|
+
const bioText = Array.isArray(c.bio) ? c.bio.join(" ") : c.bio;
|
|
45187
|
+
if (bioText) {
|
|
45188
|
+
parts.push(`# About ${c.name}
|
|
45189
|
+
${bioText}`);
|
|
45190
|
+
}
|
|
45191
|
+
if (c.system) {
|
|
45192
|
+
parts.push(c.system);
|
|
45193
|
+
}
|
|
45194
|
+
const styles2 = [...c.style?.all || [], ...c.style?.chat || []];
|
|
45195
|
+
if (styles2.length > 0) {
|
|
45196
|
+
parts.push(`Style:
|
|
45197
|
+
${styles2.map((s) => `- ${s}`).join(`
|
|
45198
|
+
`)}`);
|
|
45199
|
+
}
|
|
45200
|
+
if (parts.length > 0) {
|
|
45201
|
+
prompt = `${parts.join(`
|
|
45202
|
+
|
|
45203
|
+
`)}
|
|
45204
|
+
|
|
45205
|
+
${input}`;
|
|
45206
|
+
}
|
|
45207
|
+
}
|
|
45208
|
+
const params = {
|
|
45209
|
+
prompt,
|
|
45210
|
+
maxTokens: options?.maxTokens,
|
|
45211
|
+
temperature: options?.temperature,
|
|
45212
|
+
frequencyPenalty: options?.frequencyPenalty,
|
|
45213
|
+
presencePenalty: options?.presencePenalty,
|
|
45214
|
+
stopSequences: options?.stopSequences
|
|
45215
|
+
};
|
|
45216
|
+
const response = await this.useModel(modelType, params);
|
|
45217
|
+
return {
|
|
45218
|
+
text: response
|
|
45219
|
+
};
|
|
45220
|
+
}
|
|
45176
45221
|
registerEvent(event, handler) {
|
|
45177
45222
|
if (!this.events[event]) {
|
|
45178
45223
|
this.events[event] = [];
|
|
@@ -46865,5 +46910,5 @@ export {
|
|
|
46865
46910
|
AgentRuntime
|
|
46866
46911
|
};
|
|
46867
46912
|
|
|
46868
|
-
//# debugId=
|
|
46913
|
+
//# debugId=89451468EB946ADB64756E2164756E21
|
|
46869
46914
|
//# sourceMappingURL=index.node.js.map
|