Skip to content

Commit f92889f

Browse files
joycequujoycequmdr223
authored
Generalize Support for LiteLLM Models #265 (#272)
* model_info (Model -> ConfiguredModel in constants) - 265 * predictor function for unknown spec * update full list of API keys * add gemini3 and gpt5.2 to constants * return models based on opt obj when models is None * reorganize functions in model info/helper * add tests and update model references and imports * move validation from config to query processor * add json file for model score/latency and update predictor function * update model references and imports * update dependencies and related test cases * update Model to have both string and enum * model_info -> model_helper * update model usage in query config * rollback import changes for CuratedModel -> Model * ModelProvider class * update all switch cases to ModelProvider when applicable * reverted CuratedModel changes * add test cases * add additional test cases * fix formatting issues * add prompt caching stats for #262 * restructure Model class * fix Model enum issue * add sorting logic to model class * use singular json file for info fetching * expand model list and updates curated_model_info file * restructure model info fetching, update Model class and test cases * script to update pz_models_information and update get_optimal_models * is_deepseek_model * add audio cache read/creation * remove claude sonnet 3.5 (retired) * add deepseek-chat * add .json files to pyproject.toml so that is packaged too * revert uvicorn dependency * some small tweaks * passing tests --------- Co-authored-by: joycequ <joycequ@mit.edu> Co-authored-by: Matthew Russo <mdrusso@mit.edu>
1 parent e581059 commit f92889f

24 files changed

Lines changed: 2492 additions & 553 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ testdata/enron-eval/*.txt
5353
pyrightconfig.json
5454

5555
myenv/
56+
pz-env/
5657

5758
# abacus-research data
5859
abacus-research/cuad-data/*

abacus-research/helper-scripts/mmqa-baseline.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import numpy as np
88
from openai import OpenAI
99

10-
from palimpzest.constants import MODEL_CARDS, Cardinality, Model
10+
from palimpzest.constants import Cardinality, Model
1111
from palimpzest.query.generators.generators import get_json_from_answer
1212

1313

@@ -109,8 +109,9 @@ def f1(preds: list | None, targets: list):
109109
completion = client.chat.completions.create(**payload)
110110

111111
# compute total cost
112-
usd_per_input_token = MODEL_CARDS[model_name]["usd_per_input_token"]
113-
usd_per_output_token = MODEL_CARDS[model_name]["usd_per_output_token"]
112+
model = Model(model_name)
113+
usd_per_input_token = model.get_usd_per_input_token()
114+
usd_per_output_token = model.get_usd_per_output_token()
114115
input_tokens = completion.usage.prompt_tokens
115116
output_tokens = completion.usage.completion_tokens
116117
total_cost += input_tokens * usd_per_input_token + output_tokens * usd_per_output_token

pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dependencies = [
1414
"chromadb>=1.0.15",
1515
"colorama>=0.4.6",
1616
"datasets>=4.0.0",
17-
"fastapi~=0.115.0",
17+
"fastapi>=0.115.0",
1818
"gradio>=5.26.0",
1919
"litellm>=1.76.1",
2020
"numpy==2.0.2",
@@ -63,8 +63,7 @@ where = ["src"]
6363
namespaces = false
6464

6565
[tool.setuptools.package-data]
66-
"*" = ["*.txt", "*.rst", "*.md"]
67-
66+
"*" = ["*.txt", "*.rst", "*.md", "*.json"]
6867

6968
[tool.pytest.ini_options]
7069
testpaths = ["tests/pytest"]

0 commit comments

Comments
 (0)