Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove old openai models, group models by provider #472

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 29 additions & 44 deletions refact_known_models/passthrough.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# refer to https://docs.litellm.ai/docs/providers/

passthrough_mini_db = {
# OpenAI models
"gpt-4o": {
"backend": "litellm",
"provider": "openai",
Expand All @@ -12,28 +13,41 @@
"pp1000t_generated": 15_000, # $15.00 / 1M tokens (2024 may)
"filter_caps": ["chat", "tools", "completion"],
},
"gpt-4-turbo": {
"gpt-4o-2024-05-13": {
"backend": "litellm",
"provider": "openai",
"tokenizer_path": "Xenova/gpt-4",
"resolve_as": "gpt-4-turbo",
"tokenizer_path": "Xenova/gpt-4o",
"resolve_as": "gpt-4o-2024-05-13",
"T": 128_000,
"T_out": 4096,
"pp1000t_prompt": 10_000,
"pp1000t_generated": 30_000, # $30.00 / 1M tokens (2024 may)
"pp1000t_prompt": 5_000,
"pp1000t_generated": 15_000, # $15.00 / 1M tokens
"filter_caps": ["chat", "tools", "completion"],
},
"gpt-3.5-turbo": {
"gpt-4o-2024-08-06": {
"backend": "litellm",
"provider": "openai",
"tokenizer_path": "Xenova/gpt-3.5-turbo-16k",
"resolve_as": "gpt-3.5-turbo-1106",
"T": 16_000,
"tokenizer_path": "Xenova/gpt-4o",
"resolve_as": "gpt-4o-2024-08-06",
"T": 128_000,
"T_out": 4096,
"pp1000t_prompt": 1000,
"pp1000t_generated": 2000,
"pp1000t_prompt": 2_500,
"pp1000t_generated": 10_000, # $15.00 / 1M tokens
"filter_caps": ["chat", "tools", "completion"]
},
"gpt-4o-mini": {
"backend": "litellm",
"provider": "openai",
"tokenizer_path": "Xenova/gpt-4o",
"resolve_as": "gpt-4o-mini-2024-07-18",
"T": 128_000,
"T_out": 4096,
"pp1000t_prompt": 150,
"pp1000t_generated": 600, # $0.60 / 1M tokens
"filter_caps": ["chat", "tools", "completion"],
},

# Anthropic models
"claude-3-5-sonnet": {
"backend": "litellm",
"provider": "anthropic",
Expand Down Expand Up @@ -78,39 +92,6 @@
"pp1000t_generated": 15_000,
"filter_caps": ["chat", "tools", "completion"],
},
"gpt-4o-2024-05-13": {
"backend": "litellm",
"provider": "openai",
"tokenizer_path": "Xenova/gpt-4o",
"resolve_as": "gpt-4o-2024-05-13",
"T": 128_000,
"T_out": 4096,
"pp1000t_prompt": 5_000,
"pp1000t_generated": 15_000, # $15.00 / 1M tokens
"filter_caps": ["chat", "tools", "completion"],
},
"gpt-4o-2024-08-06": {
"backend": "litellm",
"provider": "openai",
"tokenizer_path": "Xenova/gpt-4o",
"resolve_as": "gpt-4o-2024-08-06",
"T": 128_000,
"T_out": 4096,
"pp1000t_prompt": 2_500,
"pp1000t_generated": 10_000, # $15.00 / 1M tokens
"filter_caps": ["chat", "tools", "completion"]
},
"gpt-4o-mini": {
"backend": "litellm",
"provider": "openai",
"tokenizer_path": "Xenova/gpt-4o",
"resolve_as": "gpt-4o-mini-2024-07-18",
"T": 128_000,
"T_out": 4096,
"pp1000t_prompt": 150,
"pp1000t_generated": 600, # $0.60 / 1M tokens
"filter_caps": ["chat", "tools", "completion"],
},
"claude-3-5-sonnet-20241022": {
"backend": "litellm",
"provider": "anthropic",
Expand All @@ -122,6 +103,8 @@
"pp1000t_generated": 15_000, # $15.00 / 1M tokens (2024 oct)
"filter_caps": ["chat", "tools", "completion"],
},

# Groq models
"groq-llama-3.1-8b": {
"backend": "litellm",
"provider": "groq",
Expand Down Expand Up @@ -188,6 +171,8 @@
"pp1000t_generated": 600, # TODO: don't know the price
"filter_caps": ["chat", "completion"],
},

# Cerebras models
"cerebras-llama3.1-8b": {
"backend": "litellm",
"provider": "cerebras",
Expand Down
28 changes: 14 additions & 14 deletions refact_utils/finetune/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,20 @@ def _add_results_for_passthrough_provider(provider: str) -> None:
if 'completion' in v.get('filter_caps', []):
result['completion'].append(k)

for k, v in data.get("model_assign", {}).items():
if model_dict := [d for d in data['models'] if d['name'] == k]:
model_dict = model_dict[0]

add_result(k, model_dict)

if not model_dict.get('has_finetune'):
continue

finetune_info = model_dict.get('finetune_info', []) or []
for run in finetune_info:
val = f"{k}:{run['run_id']}:{run['checkpoint']}"
add_result(val, model_dict)

if data.get("openai_api_enable"):
_add_results_for_passthrough_provider('openai')

Expand All @@ -121,20 +135,6 @@ def _add_results_for_passthrough_provider(provider: str) -> None:
if data.get('xai_api_enable'):
_add_results_for_passthrough_provider('xai')

for k, v in data.get("model_assign", {}).items():
if model_dict := [d for d in data['models'] if d['name'] == k]:
model_dict = model_dict[0]

add_result(k, model_dict)

if not model_dict.get('has_finetune'):
continue

finetune_info = model_dict.get('finetune_info', []) or []
for run in finetune_info:
val = f"{k}:{run['run_id']}:{run['checkpoint']}"
add_result(val, model_dict)

return result


Expand Down
2 changes: 1 addition & 1 deletion refact_webgui/webgui/selfhost_fastapi_completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def _caps_base_data(self) -> Dict[str, Any]:
"telemetry_basic_dest": "/stats/telemetry-basic",
"telemetry_corrected_snippets_dest": "/stats/telemetry-snippets",
"telemetry_basic_retrieve_my_own": "/stats/rh-stats",
"running_models": [r for r in [*running['completion'], *running['chat']]],
"running_models": list(set(r for r in [*running['completion'], *running['chat']])),
"code_completion_default_model": code_completion_default_model,
"multiline_code_completion_default_model": multiline_code_completion_default_model,
"code_chat_default_model": code_chat_default_model,
Expand Down
Loading