Skip to content

Commit 5ed0a19

Browse files
committed
Lazy import LiteLLM, skip on 3.9
1 parent 76bdd71 commit 5ed0a19

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/contrib/openai_agents/test_openai.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import json
22
import os
3+
import sys
34
import uuid
45
from dataclasses import dataclass
56
from datetime import timedelta
@@ -39,7 +40,6 @@
3940
trace,
4041
)
4142
from agents.extensions.handoff_prompt import RECOMMENDED_PROMPT_PREFIX
42-
from agents.extensions.models.litellm_provider import LitellmProvider
4343
from agents.items import (
4444
HandoffOutputItem,
4545
ToolCallItem,
@@ -1853,9 +1853,14 @@ async def test_exception_handling(client: Client):
18531853
await assert_status_retry_behavior(404, client, should_retry=False)
18541854

18551855

1856-
async def test_lite_llm(client: Client):
1856+
async def test_lite_llm(client: Client, env: WorkflowEnvironment):
18571857
if not os.environ.get("OPENAI_API_KEY"):
18581858
pytest.skip("No openai API key")
1859+
if sys.version_info < (3, 10):
1860+
pytest.skip("Lite LLM does not import below 3.10")
1861+
1862+
from agents.extensions.models.litellm_provider import LitellmProvider
1863+
18591864
new_config = client.config()
18601865
new_config["plugins"] = [
18611866
openai_agents.OpenAIAgentsPlugin(

0 commit comments

Comments
 (0)