Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

fix: fail when cannot get token, add Akash to generateText switch #1214

Merged
merged 3 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions agent/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,10 @@ export function getTokenForProvider(
character.settings?.secrets?.AKASH_CHAT_API_KEY ||
settings.AKASH_CHAT_API_KEY
);
default:
const errorMessage = `Failed to get token - unsupported model provider: ${provider}`
elizaLogger.error(errorMessage)
throw new Error(errorMessage)
}
}

Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/generation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ export async function generateText({
case ModelProviderName.LLAMACLOUD:
case ModelProviderName.NANOGPT:
case ModelProviderName.HYPERBOLIC:
case ModelProviderName.TOGETHER: {
case ModelProviderName.TOGETHER:
shakkernerd marked this conversation as resolved.
Show resolved Hide resolved
case ModelProviderName.AKASH_CHAT_API: {
elizaLogger.debug("Initializing OpenAI model.");
const openai = createOpenAI({
apiKey,
Expand Down Expand Up @@ -1360,6 +1361,7 @@ export async function handleProvider(
case ModelProviderName.LLAMACLOUD:
case ModelProviderName.TOGETHER:
case ModelProviderName.NANOGPT:
case ModelProviderName.AKASH_CHAT_API:
return await handleOpenAI(options);
case ModelProviderName.ANTHROPIC:
return await handleAnthropic(options);
Expand Down
Loading