Skip to content

Commit

Permalink
fix(openai/): allows 'reasoning_effort' param to be passed correctly (#…
Browse files Browse the repository at this point in the history
…8227)

* fix(openai/): allows 'reasoning_effort' param to be passed correctly

Fixes #8217

* test: update test to handle gemini token counter change

* fix(factory.py): fix bedrock http:// handling

* test: fix test

* test: update testing for new openai sdk
  • Loading branch information
krrishdholakia authored Feb 4, 2025
1 parent 302cc4f commit c17342a
Show file tree
Hide file tree
Showing 6 changed files with 216 additions and 194 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,6 @@ tests/local_testing/log.txt
.codegpt
litellm/proxy/_new_new_secret_config.yaml
litellm/proxy/custom_guardrail.py
litellm/proxy/_experimental/out/404.html
litellm/proxy/_experimental/out/404.html
litellm/proxy/_experimental/out/model_hub.html
376 changes: 190 additions & 186 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Documentation = "https://docs.litellm.ai"
[tool.poetry.dependencies]
python = ">=3.8.1,<4.0, !=3.9.7"
httpx = ">=0.23.0,<0.28.0"
openai = ">=1.55.3"
openai = ">=1.61.0"
python-dotenv = ">=0.2.0"
tiktoken = ">=0.7.0"
importlib-metadata = ">=6.8.0"
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# LITELLM PROXY DEPENDENCIES #
anyio==4.4.0 # openai + http req.
httpx==0.27.0 # Pin Httpx dependency
openai==1.55.3 # openai req.
openai==1.61.0 # openai req.
fastapi==0.115.5 # server dep
backoff==2.2.1 # server dep
pyyaml==6.0.2 # server dep
Expand Down
9 changes: 9 additions & 0 deletions tests/llm_translation/test_openai_o1.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,12 @@ def test_o1_supports_vision():
for k, v in litellm.model_cost.items():
if k.startswith("o1") and v.get("litellm_provider") == "openai":
assert v.get("supports_vision") is True, f"{k} does not support vision"


def test_o3_reasoning_effort():
resp = litellm.completion(
model="o3-mini",
messages=[{"role": "user", "content": "Hello!"}],
reasoning_effort="high",
)
assert resp.choices[0].message.content is not None
18 changes: 12 additions & 6 deletions tests/local_testing/test_router_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ def test_init_clients():
print(async_client._base_url)
assert (
async_client._base_url
== "https://openai-gpt-4-test-v-1.openai.azure.com//openai/"
) # openai python adds the extra /
== "https://openai-gpt-4-test-v-1.openai.azure.com/openai/"
)
assert (
stream_async_client._base_url
== "https://openai-gpt-4-test-v-1.openai.azure.com//openai/"
== "https://openai-gpt-4-test-v-1.openai.azure.com/openai/"
)

print("PASSED !")
Expand Down Expand Up @@ -448,7 +448,9 @@ async def test_openai_with_organization(sync_mode):
)
except Exception as e:
print("Got exception: " + str(e))
assert "header should match organization for API key" in str(e)
assert "header should match organization for API key" in str(
e
) or "No such organization" in str(e)

# good org works
response = router.completion(
Expand Down Expand Up @@ -478,7 +480,9 @@ async def test_openai_with_organization(sync_mode):
)
except Exception as e:
print("Got exception: " + str(e))
assert "header should match organization for API key" in str(e)
assert "header should match organization for API key" in str(
e
) or "No such organization" in str(e)

# good org works
response = await router.acompletion(
Expand Down Expand Up @@ -581,7 +585,9 @@ async def test_aaaaatext_completion_with_organization():
pytest.fail("Request should have failed - This organization does not exist")
except Exception as e:
print("Got exception: " + str(e))
assert "header should match organization for API key" in str(e)
assert "header should match organization for API key" in str(
e
) or "No such organization" in str(e)

# good org works
response = await router.atext_completion(
Expand Down

0 comments on commit c17342a

Please sign in to comment.