Skip to content

Commit bca6f87

Browse files
Move model cost to dedicated folder
1 parent 9e9d3d2 commit bca6f87

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

.github/workflows/update-model-costs.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# This workflow updates the file in /data/model_prices_and_context_window.json
1+
# This workflow updates the file in /model_cost_data/model_prices_and_context_window.json
22
name: Update model prices and context window JSON file
33

44
on:
@@ -18,12 +18,12 @@ jobs:
1818

1919
- name: Get the latest file
2020
run: |
21-
curl -Ss 'https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json' > data/model_prices_and_context_window.json
21+
curl -Ss 'https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json' > model_cost_data/model_prices_and_context_window.json
2222
2323
- name: Check if file changed
2424
id: check-model-prices
2525
run: |
26-
if ! git diff --quiet data/model_prices_and_context_window.json ; then
26+
if ! git diff --quiet model_cost_data/model_prices_and_context_window.json ; then
2727
echo "changed=true" >> "$GITHUB_OUTPUT"
2828
else
2929
echo "changed=false" >> "$GITHUB_OUTPUT"
@@ -44,7 +44,7 @@ jobs:
4444
run: |
4545
git checkout -b update-model-prices-$GITHUB_SHA
4646
47-
git add data/model_prices_and_context_window.json
47+
git add model_cost_data/model_prices_and_context_window.json
4848
git commit -m "Update model_prices_and_context_window.json to version generated on ${{ env.CURRENT_DATETIME }}"
4949
5050
echo "Pushing branch so we can create a PR..."

src/codegate/db/token_usage.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ class TokenUsageParser:
1919
def __init__(self):
2020
current_dir = Path(__file__).parent
2121
filemodel_path = (
22-
current_dir.parent.parent.parent / "data" / "model_prices_and_context_window.json"
22+
current_dir.parent.parent.parent
23+
/ "model_cost_data"
24+
/ "model_prices_and_context_window.json"
2325
)
2426
with open(filemodel_path) as file:
2527
self.model_cost_mapping: Dict[str, Dict] = json.load(file)

0 commit comments

Comments
 (0)