Skip to content

Commit 70f3607

Browse files
committed
(fix) pre commit hook to sync backup context_window mapping
1 parent 8b57115 commit 70f3607

File tree

3 files changed

+15
-22
lines changed

3 files changed

+15
-22
lines changed

ci_cd/check_files_match.py

+13-20
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,32 @@
11
import sys
22
import filecmp
3-
import difflib
4-
5-
6-
def show_diff(file1, file2):
7-
with open(file1, "r") as f1, open(file2, "r") as f2:
8-
lines1 = f1.readlines()
9-
lines2 = f2.readlines()
10-
11-
diff = difflib.unified_diff(lines1, lines2, lineterm="")
12-
13-
for line in diff:
14-
print(line)
3+
import shutil
154

165

176
def main(argv=None):
187
print(
19-
"comparing model_prices_and_context_window, and litellm/model_prices_and_context_window_backup.json files.......... checking they match",
20-
argv,
8+
"Comparing model_prices_and_context_window and litellm/model_prices_and_context_window_backup.json files... checking if they match."
219
)
2210

2311
file1 = "model_prices_and_context_window.json"
2412
file2 = "litellm/model_prices_and_context_window_backup.json"
13+
2514
cmp_result = filecmp.cmp(file1, file2, shallow=False)
15+
2616
if cmp_result:
27-
print(f"Passed ! Files {file1} and {file2} match.")
17+
print(f"Passed! Files {file1} and {file2} match.")
2818
return 0
2919
else:
30-
# show the diff
31-
print(f"Failed ! Files {file1} and {file2} do not match.")
32-
print("\nDiff")
33-
show_diff(file1, file2)
34-
20+
print(
21+
f"Failed! Files {file1} and {file2} do not match. Copying content from {file1} to {file2}."
22+
)
23+
copy_content(file1, file2)
3524
return 1
3625

3726

27+
def copy_content(source, destination):
28+
shutil.copy2(source, destination)
29+
30+
3831
if __name__ == "__main__":
3932
sys.exit(main())

litellm/model_prices_and_context_window_backup.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"max_output_tokens": 4096,
66
"input_cost_per_token": 0.00003,
77
"output_cost_per_token": 0.00006,
8-
"litellm_provider": "openai",
8+
"litellm_provider": "opeai",
99
"mode": "chat"
1010
},
1111
"gpt-4-0314": {

model_prices_and_context_window.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"max_output_tokens": 4096,
66
"input_cost_per_token": 0.00003,
77
"output_cost_per_token": 0.00006,
8-
"litellm_provider": "openai",
8+
"litellm_provider": "opeai",
99
"mode": "chat"
1010
},
1111
"gpt-4-0314": {

0 commit comments

Comments
 (0)