Skip to content

Commit

Permalink
Litellm dev contributor prs 01 31 2025 (#8168)
Browse files Browse the repository at this point in the history
* Add O3-Mini for Azure and Remove Vision Support (#8161)

* Azure Released O3-mini at the same time as OAI, so i've added support here. Confirmed to work with Sweden Central.

* [FIX] replace cgi for python 3.13 with email.Message as suggested in PEP 594 (#8160)

* Update model_prices_and_context_window.json (#8120)

codestral2501 pricing on vertex_ai

* Fix/db view names (#8119)

* Fix to case sensitive DB Views name

* Fix to case sensitive DB View names

* Added quotes to check query as well

* Added quotes to create view query

* test: handle server error  for flaky test

vertex ai has unstable endpoints

---------

Co-authored-by: Wanis Elabbar <70503629+elabbarw@users.noreply.github.com>
Co-authored-by: Honghua Dong <dhh1995@163.com>
Co-authored-by: superpoussin22 <vincent.nadal@orange.fr>
Co-authored-by: Miguel Armenta <37154380+ma-armenta@users.noreply.github.com>
  • Loading branch information
5 people authored Feb 1, 2025
1 parent d0c5639 commit 91ed05d
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 11 deletions.
4 changes: 2 additions & 2 deletions db_scripts/create_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,11 @@ async def check_view_exists(): # noqa: PLR0915
print("MonthlyGlobalSpendPerUserPerKey Created!") # noqa

try:
await db.query_raw("""SELECT 1 FROM DailyTagSpend LIMIT 1""")
await db.query_raw("""SELECT 1 FROM "DailyTagSpend" LIMIT 1""")
print("DailyTagSpend Exists!") # noqa
except Exception:
sql_query = """
CREATE OR REPLACE VIEW DailyTagSpend AS
CREATE OR REPLACE VIEW "DailyTagSpend" AS
SELECT
jsonb_array_elements_text(request_tags) AS individual_request_tag,
DATE(s."startTime") AS spend_date,
Expand Down
7 changes: 4 additions & 3 deletions litellm/litellm_core_utils/prompt_templates/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -2153,7 +2153,7 @@ def stringify_json_tool_call_content(messages: List) -> List:

import base64
import mimetypes
from cgi import parse_header
from email.message import Message

import httpx

Expand All @@ -2174,8 +2174,9 @@ def stringify_json_tool_call_content(messages: List) -> List:


def _parse_content_type(content_type: str) -> str:
main_type, _ = parse_header(content_type)
return main_type
m = Message()
m['content-type'] = content_type
return m.get_content_type()


class BedrockImageProcessor:
Expand Down
38 changes: 36 additions & 2 deletions litellm/model_prices_and_context_window_backup.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
"cache_read_input_token_cost": 0.00000055,
"litellm_provider": "openai",
"mode": "chat",
"supports_vision": true,
"supports_vision": false,
"supports_prompt_caching": true
},
"o3-mini-2025-01-31": {
Expand All @@ -223,7 +223,7 @@
"cache_read_input_token_cost": 0.00000055,
"litellm_provider": "openai",
"mode": "chat",
"supports_vision": true,
"supports_vision": false,
"supports_prompt_caching": true
},
"o1-mini-2024-09-12": {
Expand Down Expand Up @@ -929,6 +929,30 @@
"input_cost_per_character": 0.000030,
"litellm_provider": "openai"
},
"azure/o3-mini": {
"max_tokens": 100000,
"max_input_tokens": 200000,
"max_output_tokens": 100000,
"input_cost_per_token": 0.0000011,
"output_cost_per_token": 0.0000044,
"cache_read_input_token_cost": 0.00000055,
"litellm_provider": "openai",
"mode": "chat",
"supports_vision": false,
"supports_prompt_caching": true
},
"azure/o3-mini-2025-01-31": {
"max_tokens": 100000,
"max_input_tokens": 200000,
"max_output_tokens": 100000,
"input_cost_per_token": 0.0000011,
"output_cost_per_token": 0.0000044,
"cache_read_input_token_cost": 0.00000055,
"litellm_provider": "openai",
"mode": "chat",
"supports_vision": false,
"supports_prompt_caching": true
},
"azure/tts-1": {
"mode": "audio_speech",
"input_cost_per_character": 0.000015,
Expand Down Expand Up @@ -3876,6 +3900,16 @@
"mode": "chat",
"supports_function_calling": true
},
"vertex_ai/codestral@2405": {
"max_tokens": 128000,
"max_input_tokens": 128000,
"max_output_tokens": 128000,
"input_cost_per_token": 0.0000002,
"output_cost_per_token": 0.0000006,
"litellm_provider": "vertex_ai-mistral_models",
"mode": "chat",
"supports_function_calling": true
},
"vertex_ai/imagegeneration@006": {
"output_cost_per_image": 0.020,
"litellm_provider": "vertex_ai-image-models",
Expand Down
4 changes: 2 additions & 2 deletions litellm/proxy/db/create_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,11 @@ async def create_missing_views(db: _db): # noqa: PLR0915
print("MonthlyGlobalSpendPerUserPerKey Created!") # noqa

try:
await db.query_raw("""SELECT 1 FROM DailyTagSpend LIMIT 1""")
await db.query_raw("""SELECT 1 FROM "DailyTagSpend" LIMIT 1""")
print("DailyTagSpend Exists!") # noqa
except Exception:
sql_query = """
CREATE OR REPLACE VIEW DailyTagSpend AS
CREATE OR REPLACE VIEW "DailyTagSpend" AS
SELECT
jsonb_array_elements_text(request_tags) AS individual_request_tag,
DATE(s."startTime") AS spend_date,
Expand Down
38 changes: 36 additions & 2 deletions model_prices_and_context_window.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
"cache_read_input_token_cost": 0.00000055,
"litellm_provider": "openai",
"mode": "chat",
"supports_vision": true,
"supports_vision": false,
"supports_prompt_caching": true
},
"o3-mini-2025-01-31": {
Expand All @@ -223,7 +223,7 @@
"cache_read_input_token_cost": 0.00000055,
"litellm_provider": "openai",
"mode": "chat",
"supports_vision": true,
"supports_vision": false,
"supports_prompt_caching": true
},
"o1-mini-2024-09-12": {
Expand Down Expand Up @@ -929,6 +929,30 @@
"input_cost_per_character": 0.000030,
"litellm_provider": "openai"
},
"azure/o3-mini": {
"max_tokens": 100000,
"max_input_tokens": 200000,
"max_output_tokens": 100000,
"input_cost_per_token": 0.0000011,
"output_cost_per_token": 0.0000044,
"cache_read_input_token_cost": 0.00000055,
"litellm_provider": "openai",
"mode": "chat",
"supports_vision": false,
"supports_prompt_caching": true
},
"azure/o3-mini-2025-01-31": {
"max_tokens": 100000,
"max_input_tokens": 200000,
"max_output_tokens": 100000,
"input_cost_per_token": 0.0000011,
"output_cost_per_token": 0.0000044,
"cache_read_input_token_cost": 0.00000055,
"litellm_provider": "openai",
"mode": "chat",
"supports_vision": false,
"supports_prompt_caching": true
},
"azure/tts-1": {
"mode": "audio_speech",
"input_cost_per_character": 0.000015,
Expand Down Expand Up @@ -3876,6 +3900,16 @@
"mode": "chat",
"supports_function_calling": true
},
"vertex_ai/codestral@2405": {
"max_tokens": 128000,
"max_input_tokens": 128000,
"max_output_tokens": 128000,
"input_cost_per_token": 0.0000002,
"output_cost_per_token": 0.0000006,
"litellm_provider": "vertex_ai-mistral_models",
"mode": "chat",
"supports_function_calling": true
},
"vertex_ai/imagegeneration@006": {
"output_cost_per_image": 0.020,
"litellm_provider": "vertex_ai-image-models",
Expand Down
3 changes: 3 additions & 0 deletions tests/local_testing/test_batch_completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ def test_batch_completions():
except Timeout as e:
print(f"IN TIMEOUT")
pass
except litellm.InternalServerError as e:
print(f"IN INTERNAL SERVER ERROR")
pass
except Exception as e:
pytest.fail(f"An error occurred: {e}")

Expand Down

0 comments on commit 91ed05d

Please sign in to comment.