Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: generateText format consistency #550

Merged
merged 2 commits into from
Nov 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions packages/core/src/generation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export async function generateText({
);

switch (provider) {
// OPENAI & LLAMACLOUD shared same structure.
case ModelProviderName.OPENAI:
case ModelProviderName.LLAMACLOUD: {
elizaLogger.debug("Initializing OpenAI model.");
Expand All @@ -139,7 +140,7 @@ export async function generateText({
case ModelProviderName.GOOGLE: {
const google = createGoogleGenerativeAI();

const { text: anthropicResponse } = await aiGenerateText({
const { text: googleResponse } = await aiGenerateText({
model: google(model),
prompt: context,
system:
Expand All @@ -152,7 +153,8 @@ export async function generateText({
presencePenalty: presence_penalty,
});

response = anthropicResponse;
response = googleResponse;
elizaLogger.debug("Received response from Google model.");
break;
}

Expand Down Expand Up @@ -280,7 +282,7 @@ export async function generateText({
const serverUrl = models[provider].endpoint;
const openai = createOpenAI({ apiKey, baseURL: serverUrl });

const { text: openaiResponse } = await aiGenerateText({
const { text: redpillResponse } = await aiGenerateText({
model: openai.languageModel(model),
prompt: context,
temperature: temperature,
Expand All @@ -293,8 +295,8 @@ export async function generateText({
presencePenalty: presence_penalty,
});

response = openaiResponse;
elizaLogger.debug("Received response from OpenAI model.");
response = redpillResponse;
elizaLogger.debug("Received response from redpill model.");
break;
}

Expand Down
Loading