From 459c2936f9cdfab51ccfe365a3cdfa603e105ef2 Mon Sep 17 00:00:00 2001 From: azul Date: Wed, 5 Aug 2026 14:27:12 -0700 Subject: [PATCH] Revert "feat: add LiteLLM support via litellm: model prefix" --- pyproject.toml | 3 --- tests/test_live.py | 26 -------------------------- timecopilot/agent.py | 32 +------------------------------- 3 files changed, 1 insertion(+), 60 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 6f32ee0f..8fda773f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -122,9 +122,6 @@ distributed = [ "pyspark<4.1", "ray==2.48", ] -litellm = [ - "litellm>=1.80.0,<1.87.0", -] [project.scripts] timecopilot = "timecopilot._cli:main" diff --git a/tests/test_live.py b/tests/test_live.py index b402d5ca..01d2201f 100644 --- a/tests/test_live.py +++ b/tests/test_live.py @@ -153,32 +153,6 @@ async def test_async_is_queryable(): print(answer.output) -@pytest.mark.live -@pytest.mark.flaky(reruns=3, reruns_delay=2) -def test_litellm_forecast(): - h = 2 - df = generate_series( - n_series=1, - freq="D", - min_length=30, - static_as_categorical=False, - with_trend=True, - ) - tc = TimeCopilot( - llm="litellm:openai/gpt-4o-mini", - forecasters=[ - ZeroModel(), - ], - ) - result = tc.forecast( - df=df, - query=f"Please forecast the series with a horizon of {h} and frequency D.", - ) - assert len(result.fcst_df) == h - assert result.features_df is not None - assert result.eval_df is not None - - @pytest.mark.live @pytest.mark.asyncio @pytest.mark.flaky(reruns=3, reruns_delay=2) diff --git a/timecopilot/agent.py b/timecopilot/agent.py index 0e14203f..f24e0535 100644 --- a/timecopilot/agent.py +++ b/timecopilot/agent.py @@ -8,7 +8,6 @@ from pydantic_ai import Agent, ModelRetry, RunContext from pydantic_ai.agent import AgentRunResult from pydantic_ai.models import Model -from pydantic_ai.models.openai import OpenAIModel from rich.console import Console from rich.panel import Panel from rich.table import Table @@ -35,35 +34,6 @@ from .forecaster import Forecaster, TimeCopilotForecaster from .models.adapters.sktime import SKTimeAdapter - - -def _resolve_llm(llm: str | Model) -> str | Model: - """Resolve LLM string, adding LiteLLM support for 100+ providers. - - If the string starts with 'litellm:', creates a pydantic-ai OpenAI model - backed by litellm SDK (no proxy needed). LiteLLM reads provider API keys - from environment variables (ANTHROPIC_API_KEY, OPENAI_API_KEY, etc.). - - Examples: - --llm litellm:anthropic/claude-sonnet-4-6 - --llm litellm:groq/llama-3.3-70b-versatile - --llm litellm:deepseek/deepseek-chat - """ - if not (isinstance(llm, str) and llm.startswith("litellm:")): - return llm - - model_name = llm[len("litellm:"):] - try: - import litellm - - litellm.drop_params = True - client = litellm.AsyncOpenAI() - except ImportError: - raise ImportError( - "litellm package required for litellm: models. " - "Install with: pip install 'timecopilot[litellm]'" - ) - return OpenAIModel(model_name, openai_client=client) from .models.prophet import Prophet from .models.stats import ( ADIDA, @@ -571,7 +541,7 @@ def __init__( "model is not allowed to be passed as a keyword argument" "use `llm` instead" ) - self.llm = _resolve_llm(llm) + self.llm = llm self.forecasting_agent = Agent( deps_type=ExperimentDataset,