Update model path handling logic for FireworksAI and refine supported model filtering.

This commit is contained in:
geoffsee
2025-07-27 12:30:47 -04:00
parent 53268b528d
commit 67483d08db
2 changed files with 26 additions and 7 deletions

View File

@@ -15,10 +15,21 @@ export class FireworksAiChatProvider extends BaseChatProvider {
let modelPrefix = 'accounts/fireworks/models/';
if (param.model.toLowerCase().includes('yi-')) {
modelPrefix = 'accounts/yi-01-ai/models/';
} else if (param.model.toLowerCase().includes('/perplexity/')) {
modelPrefix = 'accounts/perplexity/models/';
} else if (param.model.toLowerCase().includes('/sentientfoundation/')) {
modelPrefix = 'accounts/sentientfoundation/models/';
} else if (param.model.toLowerCase().includes('/sentientfoundation-serverless/')) {
modelPrefix = 'accounts/sentientfoundation-serverless/models/';
} else if (param.model.toLowerCase().includes('/instacart/')) {
modelPrefix = 'accounts/instacart/models/';
}
const finalModelIdentifier = param.model.includes(modelPrefix)
? param.model
: `${modelPrefix}${param.model}`;
console.log('using fireworks model', finalModelIdentifier);
return {
model: `${modelPrefix}${param.model}`,
model: finalModelIdentifier,
messages: safeMessages,
stream: true,
};

View File

@@ -168,12 +168,19 @@ const ChatService = types
providerModels.set(
provider.name,
models.filter(
(mdl: any) =>
models.filter((mdl: any) => {
if ('supports_chat' in mdl && mdl.supports_chat) {
return true;
} else if ('supports_chat' in mdl && !mdl.supports_chat) {
return false;
}
return (
!mdl.id.includes('whisper') &&
!mdl.id.includes('tts') &&
!mdl.id.includes('guard'),
),
!mdl.id.includes('guard')
);
}),
);
// 2b. Retrieve metadata
@@ -318,7 +325,8 @@ const ChatService = types
);
}
if (message.includes('404')) {
throw new ClientError(`Something went wrong, try again.`, 413, {});
console.log(message);
throw new ClientError(`Something went wrong, try again.`, 404, {});
}
throw error;
}