Skip to content

Commit

Permalink
Merge branch 'development' of github.com:Scale3-Labs/langtrace into d…
Browse files Browse the repository at this point in the history
…evelopment
  • Loading branch information
karthikscale3 committed Nov 21, 2024
2 parents acbbd4c + 7781684 commit 7ea986c
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 2 deletions.
70 changes: 70 additions & 0 deletions .github/workflows/close-inactive-issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Close Inactive Issues
on:
schedule:
- cron: '0 0 * * *' # Run daily at midnight UTC
workflow_dispatch: # Allow manual triggering

jobs:
close-inactive:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Close inactive issues
uses: actions/github-script@v7
with:
script: |
const daysUntilClose = 14
const warningLabel = 'stale'
const warningMessage = 'This issue has been automatically marked as stale due to inactivity. It will be closed in 3 days if no further activity occurs.'
const now = new Date()
const timeAgo = new Date(now.getTime() - (daysUntilClose * 24 * 60 * 60 * 1000))
const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
sort: 'updated',
direction: 'asc'
})
for (const issue of issues.data) {
const lastUpdated = new Date(issue.updated_at)
if (lastUpdated < timeAgo) {
// Check if issue has warning label
if (issue.labels.find(label => label.name === warningLabel)) {
// Close issue
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
state: 'closed',
state_reason: 'not_planned'
})
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
body: 'This issue has been automatically closed due to inactivity.'
})
} else {
// Add warning label and comment
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
labels: [warningLabel]
})
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
body: warningMessage
})
}
}
}
2 changes: 2 additions & 0 deletions components/shared/vendor-metadata.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,8 @@ export function VendorLogo({
);
}



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

};

export const MISTRAL_PRICING: Record<string, CostTableEntry> = {
"mistral-large-latest": {
input: 0.002,
output: 0.006,
},
"pixtral-large-latest": {
input: 0.002,
output: 0.006,
},
"mistral-small-latest": {
input: 0.0002,
output: 0.0006,
},
"codestral-latest": {
input: 0.0002,
output: 0.0006,
},
"ministral-8b-latest": {
input: 0.0001,
output: 0.0001,
},
"ministral-3b-latest": {
input: 0.00004,
output: 0.00004,
},
"mistral-embed": {
input: 0.0001,
output: 0,
},
"open-mistral-7b": {
input: 0.00025,
output: 0.00025,
},
"open-mixtral-8x7b": {
input: 0.0007,
output: 0.0007,
},
"open-mixtral-8x22b": {
input: 0.002,
output: 0.006,
},
};

export const XAI_PRICING: Record<string, CostTableEntry> = {
"grok-beta": {
input: 0.005,
Expand Down
9 changes: 7 additions & 2 deletions lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
CostTableEntry,
GROQ_PRICING,
LangTraceAttributes,
MISTRAL_PRICING,
OPENAI_PRICING,
PERPLEXITY_PRICING,
SpanStatusCode,
Expand Down Expand Up @@ -526,8 +527,8 @@ export function calculatePriceFromUsage(
vendor = "openai";
} else if (model.includes("claude")) {
vendor = "anthropic";
} else if (model.includes("mistral")) {
vendor = "mistral"; // Assuming there is a MISTRAL_PRICING object
} else if (model.includes("tral")) {
vendor = "mistral";
} else if (model.includes("grok")) {
vendor = "xai";
} else if (model.includes("gemini")) {
Expand Down Expand Up @@ -581,6 +582,8 @@ export function calculatePriceFromUsage(
costTable = GEMINI_PRICING[model];
} else if (model.includes("grok")) {
costTable = XAI_PRICING[model];
} else if (model.includes("tral")) {
costTable = MISTRAL_PRICING[model];
}
} else if (vendor === "openai") {
// check if model is present as key in OPENAI_PRICING
Expand Down Expand Up @@ -642,6 +645,8 @@ export function calculatePriceFromUsage(
costTable = GEMINI_PRICING[model];
} else if (vendor === "xai") {
costTable = XAI_PRICING[model];
} else if (vendor === "mistral") {
costTable = MISTRAL_PRICING[model];
}
if (costTable) {
const total =
Expand Down

0 comments on commit 7ea986c

Please sign in to comment.