Skip to content

Commit

Permalink
model fix on cloud version
Browse files Browse the repository at this point in the history
  • Loading branch information
pu-re committed Feb 19, 2025
1 parent a4da67b commit c0ce9cf
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
20 changes: 16 additions & 4 deletions src/app/api/llm-providers/[id]/models/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ export async function GET(
for await (const models of modelsPage.iterPages()) {
const modelList = models.data;
results.push(...modelList.filter((model) => {
return !(currentDeploymentEnv === 'cloud' && model.id.startsWith('ft:'));

if (currentDeploymentEnv === 'cloud') {
return ['gpt-4o', 'o3-mini'].includes(model.id);
}
return !model.id.startsWith('ft:');
}).map(model => ({id: model.id, name: model.id})))
}
return NextResponse.json<LLMProviderModelListResponse>({
Expand All @@ -52,7 +54,12 @@ export async function GET(
const modelsPage = await anthropic.models.list();
for await (const models of modelsPage.iterPages()) {
const modelList = models.data;
results.push(...modelList.map(
results.push(...modelList.filter((model) => {
if (currentDeploymentEnv === 'cloud') {
return model.id.startsWith('claude-3-5');
}
return true;
}).map(
model => ({id: model.id, name: model.id})
))
}
Expand All @@ -67,7 +74,12 @@ export async function GET(
const response = await fetch(url.toString())
const {models} = await response.json()
return NextResponse.json<LLMProviderModelListResponse>({
llmProviderModels: models.map(
llmProviderModels: models.filter(({displayName}: { displayName: string }) => {
if (currentDeploymentEnv === 'cloud') {
return displayName === 'Gemini 2.0 Flash';
}
return true;
}).map(
({name, displayName}: { name: string, displayName: string }) => ({
id: name,
name: displayName
Expand Down
7 changes: 6 additions & 1 deletion src/lib/health-data/parser/vision/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,17 @@ export class OpenAIVisionParser extends BaseVisionParser {
}

async models(): Promise<VisionParserModel[]> {
if (currentDeploymentEnv === 'cloud') {
return [
{id: 'gpt-4o', name: 'gpt-4o'},
];
}
return [
{id: 'gpt-4o-mini', name: 'gpt-4o-mini'},
{id: 'gpt-4o', name: 'gpt-4o'},
{id: 'o1', name: 'o1'},
{id: 'o1-mini', name: 'o1-mini'},
]
];
}

async parse(options: VisionParseOptions) {
Expand Down

0 comments on commit c0ce9cf

Please sign in to comment.