DSPy: The framework for programming—not prompting—language models
Python
chore: refresh model metadata to LiteLLM 1.103.1 (#10517)
Isaac Miller0fc0fa8d170e
diff --git a/dspy/clients/model_metadata/__init__.py b/dspy/clients/model_metadata/__init__.pyindex fcfbb1c44..f1ca818dc 100644--- a/dspy/clients/model_metadata/__init__.py+++ b/dspy/clients/model_metadata/__init__.py@@ -141,6 +141,9 @@ def model_info(provider, model, *, namespaces=None):for rule in rules if isinstance(rules, list) else []:if not isinstance(rule, dict) or not isinstance(rule.get("pattern"), str):continue+ providers = rule.get("fill_missing_for_providers")+ if found is not None and providers is not None and found.get("litellm_provider") not in providers:+ continuetry:matches = re.search(rule["pattern"], model) is not Noneexcept re.error:diff --git a/dspy/clients/model_metadata/provenance.json b/dspy/clients/model_metadata/provenance.jsonindex 5e6db1ba7..a2555e05a 100644--- a/dspy/clients/model_metadata/provenance.json+++ b/dspy/clients/model_metadata/provenance.json@@ -1,6 +1,6 @@{- "source": "https://files.pythonhosted.org/packages/21/fa/fe602c696b916db036675eb6f8b0ad27a8dd398f0190a8a813596b4c0405/litellm-1.102.1-cp310-abi3-macosx_10_12_x86_64.whl",- "version": "1.102.1",- "wheel_sha256": "01550e79e052249dc5df53631ed9bdff030ca7c2a22107c5ce482d53ecf5c8d8",- "snapshot_sha256": "a33bce9dc5238cd84b2c9b9fa807d7a5fe57ff499d146ebccba8ad2b4b1ae417"+ "source": "https://files.pythonhosted.org/packages/73/e5/daccc97a538115913e32e8f901cc5967b02be9f4063bb11ff76563f9ad9f/litellm-1.103.1-cp310-abi3-macosx_10_12_x86_64.whl",+ "version": "1.103.1",+ "wheel_sha256": "78d92d1e268fa23410a612fabe3970863b78efb9582c24a503a19d84aeed5155",+ "snapshot_sha256": "56c7afe18b6166afcd54a4ac784fabb59fe8638122709900e6b7ee8c64f2e705"}diff --git a/dspy/clients/model_metadata/snapshot.json.gz b/dspy/clients/model_metadata/snapshot.json.gzindex 1331ae4eb..214fe1a09 100644Binary files a/dspy/clients/model_metadata/snapshot.json.gz and b/dspy/clients/model_metadata/snapshot.json.gz differdiff --git a/tests/clients/test_native_metadata.py b/tests/clients/test_native_metadata.pyindex 470b86002..17a106a2e 100644--- a/tests/clients/test_native_metadata.py+++ b/tests/clients/test_native_metadata.py@@ -145,3 +145,22 @@ def test_cost_provenance_survives_cache_record():assert cached.cost_details == result.cost_detailsassert cached.usage == {}assert combine([result, result], model_type="chat").cost == result.cost * 2+++def test_family_rule_provider_limits_only_known_entries(monkeypatch):+ monkeypatch.setattr(metadata, "_data", {+ "openai/gpt-test": {"litellm_provider": "openai", "supports_vision": False},+ "proxy/gpt-test": {"litellm_provider": "proxy"},+ "fallback_generalizations": {"rules": [{+ "pattern": "^gpt-",+ "fill_missing_for_providers": ["openai"],+ "model_info": {"supports_reasoning": True, "supports_vision": True,+ "input_cost_per_token": 99},+ }]},+ })+ assert dspy.LM("openai/gpt-test", engine="lm15").supports_reasoning+ assert metadata.model_info("openai-chat", "gpt-test")["supports_vision"] is False+ assert "supports_reasoning" not in metadata.model_info("proxy", "gpt-test")+ unknown = metadata.model_info("proxy", "gpt-unlisted")+ assert unknown["supports_reasoning"] is True+ assert "input_cost_per_token" not in unknown