Skip to content

Commit

Permalink
Merge pull request #1214 from vpavlin/fix/akash
Browse files Browse the repository at this point in the history
fix: fail when cannot get token, add Akash to generateText switch
  • Loading branch information
shakkernerd authored Dec 19, 2024
2 parents 76960dd + 31b2b25 commit d990859
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
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:
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

0 comments on commit d990859

Please sign in to comment.