Skip to content

Commit

Permalink
Merge branch 'development' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
karthikscale3 committed Oct 22, 2024
2 parents a00d088 + 5f0370f commit a388a5d
Show file tree
Hide file tree
Showing 5 changed files with 188 additions and 0 deletions.
16 changes: 16 additions & 0 deletions components/shared/vendor-metadata.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,22 @@ export function VendorLogo({
);
}

if (vendor.includes("xai")) {
const color = vendorColor("vercel");
return (
<Image
alt="XAI Logo"
src="/xai.png"
width={30}
height={30}
className={cn(
`${color} p-[3px]`,
variant === "circular" ? "rounded-full" : "rounded-md"
)}
/>
);
}

if (vendor.includes("embedchain")) {
const color = vendorColor("embedchain");
return (
Expand Down
7 changes: 7 additions & 0 deletions lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,13 @@ export const OPENAI_PRICING: Record<string, CostTableEntry> = {

};

export const XAI_PRICING: Record<string, CostTableEntry> = {
"grok-beta": {
input: 0.005,
output: 0.015,
},
};

export const ANTHROPIC_PRICING: Record<string, CostTableEntry> = {
"claude-3-haiku": {
input: 0.00025,
Expand Down
10 changes: 10 additions & 0 deletions lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
OPENAI_PRICING,
PERPLEXITY_PRICING,
SpanStatusCode,
XAI_PRICING,
} from "./constants";

export function cn(...inputs: ClassValue[]) {
Expand Down Expand Up @@ -527,6 +528,8 @@ export function calculatePriceFromUsage(
vendor = "anthropic";
} else if (model.includes("mistral")) {
vendor = "mistral"; // Assuming there is a MISTRAL_PRICING object
} else if (model.includes("grok")) {
vendor = "xai";
} else if (model.includes("gemini")) {
vendor =
model.includes("flash") || model.includes("pro")
Expand Down Expand Up @@ -635,6 +638,8 @@ export function calculatePriceFromUsage(
costTable = AZURE_PRICING[correctModel];
} else if (vendor === "gemini") {
costTable = GEMINI_PRICING[model];
} else if (vendor === "xai") {
costTable = XAI_PRICING[model];
}
if (costTable) {
const total =
Expand Down Expand Up @@ -756,6 +761,11 @@ export function getVendorFromSpan(span: Span): string {
serviceName.includes("perplexity")
) {
vendor = "perplexity";
} else if (
span.name.includes("xai") ||
serviceName.includes("xai")
) {
vendor = "xai";
} else if (span.name.includes("openai") || serviceName.includes("openai")) {
vendor = "openai";
} else if (
Expand Down
155 changes: 155 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added public/xai.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a388a5d

Please sign in to comment.