Skip to content

Commit

Permalink
fixing metadata (#3027)
Browse files Browse the repository at this point in the history
  • Loading branch information
colegottdank authored Dec 9, 2024
1 parent 8e8e0ab commit 2326a8f
Showing 1 changed file with 25 additions and 12 deletions.
37 changes: 25 additions & 12 deletions bifrost/app/comparison/[comparison]/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
import { formatProviderName } from "@/app/llm-cost/CalculatorInfo";
import { providers } from "@/packages/cost/providers/mappings";
import { Metadata } from "next";

export async function generateMetadata({
params,
}: {
params: {
modelA: string;
modelB: string;
providerA: string;
providerB: string;
};
params: { comparison: string };
}): Promise<Metadata> {
const { modelA, modelB, providerA, providerB } = params;
const [modelAWithProvider, modelBWithProvider] =
params.comparison.split("-vs-");
const [modelA, providerA] = modelAWithProvider.split("-on-");
const [modelB, providerB] = modelBWithProvider.split("-on-");
const decodedModelA = decodeURIComponent(modelA || "");
const decodedModelB = decodeURIComponent(modelB || "");
const decodedProviderA = decodeURIComponent(providerA || "");
Expand Down Expand Up @@ -61,14 +59,29 @@ export default function RootLayout({
return <>{children}</>;
}

const getDisplayName = (model: string, provider: string): string => {
const providerInfo = providers.find(
(p) => p.provider.toUpperCase() === provider.toUpperCase()
);
const modelDetails = providerInfo?.modelDetails;

const details = modelDetails?.[model.toLowerCase()];

if (details) {
return details.searchTerms[0];
}

return model;
};

const getComparisonTitle = (
modelA: string,
modelB: string,
providerA: string,
providerB: string
) => {
const modelADisplay = `${providerA}'s ${modelA}`;
const modelBDisplay = `${providerB}'s ${modelB}`;
const modelADisplay = getDisplayName(modelA, providerA);
const modelBDisplay = getDisplayName(modelB, providerB);
return `${modelADisplay} vs ${modelBDisplay} - Model Comparison & Performance Analysis - Helicone`;
};

Expand All @@ -78,7 +91,7 @@ const getComparisonDescription = (
providerA: string,
providerB: string
) => {
const modelADisplay = `${providerA}'s ${modelA}`;
const modelBDisplay = `${providerB}'s ${modelB}`;
const modelADisplay = `${providerA}'s ${getDisplayName(modelA, providerA)}`;
const modelBDisplay = `${providerB}'s ${getDisplayName(modelB, providerB)}`;
return `Compare ${modelADisplay} and ${modelBDisplay}. Detailed analysis of performance metrics, costs, capabilities, and real-world usage patterns. Make data-driven decisions about which AI model best fits your needs.`;
};

0 comments on commit 2326a8f

Please sign in to comment.