From df7222d60645aad469aecb6ac10d92e4ee64051b Mon Sep 17 00:00:00 2001 From: Peter Kirkham Date: Sat, 1 Feb 2025 08:15:14 -0800 Subject: [PATCH] feat: add additional fallback --- .../worker/ingestion/event-pipeline/processAiEvent.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugin-server/src/worker/ingestion/event-pipeline/processAiEvent.ts b/plugin-server/src/worker/ingestion/event-pipeline/processAiEvent.ts index 02f80b1fdcac3..acadf112544b9 100644 --- a/plugin-server/src/worker/ingestion/event-pipeline/processAiEvent.ts +++ b/plugin-server/src/worker/ingestion/event-pipeline/processAiEvent.ts @@ -86,9 +86,18 @@ export const extractCoreModelParams = (event: PluginEvent): PluginEvent => { } const findCostFromModel = (aiModel: string): ModelRow | undefined => { + // Check if the model is an exact match let cost = costs.find((cost) => cost.model.toLowerCase() === aiModel.toLowerCase()) + // Check if the model is a variant of a known model if (!cost) { cost = costs.find((cost) => aiModel.toLowerCase().includes(cost.model.toLowerCase())) } + // Check if the model is a variant of a known model + if (!cost) { + cost = costs.find((cost) => cost.model.toLowerCase().includes(aiModel.toLowerCase())) + } + if (!cost) { + console.warn(`No cost found for model: ${aiModel}`) + } return cost }