Skip to content

Commit

Permalink
Update generation.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
MERNinja committed Feb 7, 2025
1 parent f3ca520 commit 49a32b8
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions packages/core/src/generation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
parseJsonArrayFromText,
parseJSONObjectFromText,
parseShouldRespondFromText,
parseActionResponseFromText
parseActionResponseFromText,
} from "./parsing.ts";
import settings from "./settings.ts";
import {
Expand All @@ -33,7 +33,7 @@ import {
ModelProviderName,
ServiceType,
SearchResponse,
ActionResponse
ActionResponse,
} from "./types.ts";
import { fal } from "@fal-ai/client";

Expand Down Expand Up @@ -183,7 +183,7 @@ export async function generateText({
baseURL: endpoint,
fetch: runtime.fetch,
});

console.log("[DEBUG] Calling aiGenrateText");
const { text: openaiResponse } = await aiGenerateText({
model: openai.languageModel(model),
prompt: context,
Expand All @@ -192,7 +192,7 @@ export async function generateText({
settings.SYSTEM_PROMPT ??
undefined,
temperature: temperature,
maxTokens: max_response_length,
maxTokens: model !== "o3-mini" ? max_response_length : null,
frequencyPenalty: frequency_penalty,
presencePenalty: presence_penalty,
});
Expand Down Expand Up @@ -537,7 +537,7 @@ export async function generateText({
elizaLogger.debug("Initializing Venice model.");
const venice = createOpenAI({
apiKey: apiKey,
baseURL: endpoint
baseURL: endpoint,
});

const { text: veniceResponse } = await aiGenerateText({
Expand Down Expand Up @@ -1591,7 +1591,10 @@ export async function generateTweetActions({
context,
modelClass,
});
console.debug("Received response from generateText for tweet actions:", response);
console.debug(
"Received response from generateText for tweet actions:",
response
);
const { actions } = parseActionResponseFromText(response.trim());
if (actions) {
console.debug("Parsed tweet actions:", actions);
Expand All @@ -1614,4 +1617,4 @@ export async function generateTweetActions({
await new Promise((resolve) => setTimeout(resolve, retryDelay));
retryDelay *= 2;
}
}
}

0 comments on commit 49a32b8

Please sign in to comment.