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

add prices for newer 4o models #286

Merged
merged 1 commit into from
Dec 21, 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
20 changes: 6 additions & 14 deletions frontend/instrumentation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,9 @@ export async function register() {
const { llmPrices, pipelineTemplates, subscriptionTiers } = await import('lib/db/migrations/schema');
const { db } = await import('lib/db/drizzle');

const seed = async () => {
// This is a silly check to see if the table is already populated
// because drizzle-kit doesn't support seeding yet
// https://orm.drizzle.team/docs/kit-seed-data
const tiersData = await db.select().from(subscriptionTiers);
if (tiersData.length > 0) {
return;
}

const seedData = require('lib/db/seed.json');
for (const entry of seedData) {
const initializeData = async () => {
const initialData = require('lib/db/initial-data.json');
for (const entry of initialData) {
const tableName: string = entry.table;
const tables: Record<string, any> = {
'subscription_tiers': subscriptionTiers,
Expand All @@ -35,13 +27,13 @@ export async function register() {
[k.replace(/(_[a-z])/g, m => m[1].toUpperCase()), v]))
);

await db.insert(table).values(rows);
// TODO: figure out do update here
await db.insert(table).values(rows).onConflictDoNothing();
}
};

await migrate(db, { migrationsFolder: 'lib/db/migrations' });
await seed();
console.log('Seeded database with data from seed.json');
await initializeData();
} else {
console.log('Local DB is not enabled, skipping migrations and seeding');
}
Expand Down
53 changes: 46 additions & 7 deletions frontend/lib/db/seed.json → frontend/lib/db/initial-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -2990,7 +2990,7 @@
"created_at": "2024-10-16 17:54:35.25255+00",
"updated_at": "2024-10-16 17:54:35.25255+00",
"provider": "gemini",
"model": "gemini-1.0-pro",
"model": "models/gemini-1.0-pro",
"input_price_per_million": 0.5,
"output_price_per_million": 1.5,
"input_cached_price_per_million": null,
Expand All @@ -3001,7 +3001,7 @@
"created_at": "2024-10-16 17:47:10.663951+00",
"updated_at": "2024-10-16 17:47:10.663951+00",
"provider": "gemini",
"model": "gemini-1.5-flash",
"model": "models/gemini-1.5-flash",
"input_price_per_million": 0.075,
"output_price_per_million": 0.3,
"input_cached_price_per_million": 0.01875,
Expand All @@ -3014,7 +3014,7 @@
"created_at": "2024-10-16 17:48:12.168376+00",
"updated_at": "2024-10-16 17:48:12.168376+00",
"provider": "gemini",
"model": "gemini-1.5-flash--long-context",
"model": "models/gemini-1.5-flash--long-context",
"input_price_per_million": 0.15,
"output_price_per_million": 0.6,
"input_cached_price_per_million": 0.0375,
Expand All @@ -3027,7 +3027,7 @@
"created_at": "2024-10-16 17:49:59.928943+00",
"updated_at": "2024-10-16 17:49:59.928943+00",
"provider": "gemini",
"model": "gemini-1.5-flash-8b",
"model": "models/gemini-1.5-flash-8b",
"input_price_per_million": 0.0375,
"output_price_per_million": 0.15,
"input_cached_price_per_million": 0.01,
Expand All @@ -3040,7 +3040,7 @@
"created_at": "2024-10-16 17:51:05.527007+00",
"updated_at": "2024-10-16 17:51:05.527007+00",
"provider": "gemini",
"model": "gemini-1.5-flash-8b--long-context",
"model": "models/gemini-1.5-flash-8b--long-context",
"input_price_per_million": 0.075,
"output_price_per_million": 0.3,
"input_cached_price_per_million": 0.02,
Expand All @@ -3053,7 +3053,7 @@
"created_at": "2024-10-16 17:52:47.980902+00",
"updated_at": "2024-10-16 17:52:47.980902+00",
"provider": "gemini",
"model": "gemini-1.5-pro",
"model": "models/gemini-1.5-pro",
"input_price_per_million": 1.25,
"output_price_per_million": 5.0,
"input_cached_price_per_million": 0.3125,
Expand All @@ -3066,7 +3066,7 @@
"created_at": "2024-10-16 17:53:40.150074+00",
"updated_at": "2024-10-16 17:53:40.150074+00",
"provider": "gemini",
"model": "gemini-1.5-pro--long-context",
"model": "models/gemini-1.5-pro--long-context",
"input_price_per_million": 2.5,
"output_price_per_million": 10.0,
"input_cached_price_per_million": 0.625,
Expand Down Expand Up @@ -3558,6 +3558,45 @@
"input_cached_price_per_million": 1.25,
"additional_prices": {}
},
{
"id": "b674d4c6-b9f1-44b1-8df8-9d6cfb5158dd",
"created_at": "2024-12-18 08:02:06.265378+00",
"updated_at": "2024-12-18 08:02:06.265378+00",
"provider": "openai",
"model": "gpt-4o-2024-11-20",
"input_price_per_million": 2.5,
"output_price_per_million": 10,
"input_cached_price_per_million": 1.25,
"additional_prices": {}
},
{
"id": "de8c150a-27ec-4b7f-bf1a-5612099d58f0",
"created_at": "2024-12-18 07:53:54.51026+00",
"updated_at": "2024-12-18 07:53:54.51026+00",
"provider": "openai",
"model": "gpt-4o-audio-preview",
"input_price_per_million": 2.5,
"output_price_per_million": 10,
"input_cached_price_per_million": null,
"additional_prices": {
"audio_input_price_per_million": 100,
"audio_output_price_per_million": 200
}
},
{
"id": "588855e9-f065-481a-bd5c-132025ddbdee",
"created_at": "2024-12-18 07:45:05.615455+00",
"updated_at": "2024-12-18 07:45:05.615455+00",
"provider": "openai",
"model": "gpt-4o-audio-preview-2024-10-01",
"input_price_per_million": 2.5,
"output_price_per_million": 10,
"input_cached_price_per_million": null,
"additional_prices": {
"audio_input_price_per_million": 100,
"audio_output_price_per_million": 200
}
},
{
"id": "599c13b7-3fe8-44a4-bca9-54c3414100e5",
"created_at": "2024-10-16 00:12:22.410311+00",
Expand Down
5 changes: 3 additions & 2 deletions frontend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"./*"
]
},
"downlevelIteration": true
"downlevelIteration": true,
"target": "ES2017"
},
"include": [
"next-env.d.ts",
Expand All @@ -41,4 +42,4 @@
"exclude": [
"node_modules"
]
}
}
Loading