{"record":{"id":"a811a0fce9b3f86f","repo":"hsliuping/TradingAgents-CN","slug":"model-self-model-is-not-in-the-known-model-lis","errorCode":null,"errorMessage":"Model '{self.model}' is not in the known model list for provider '{self.get_provider_name()}'. Continuing anyway.","messagePattern":"Model '(.+?)' is not in the known model list for provider '(.+?)'\\. Continuing anyway\\.","errorType":"console","errorClass":"RuntimeWarning","httpStatus":null,"severity":"warning","filePath":"tradingagents/llm_clients/base_client.py","lineNumber":48,"sourceCode":"class BaseLLMClient(ABC):\n    \"\"\"Minimal provider wrapper used by CLI and future graph integration.\"\"\"\n\n    def __init__(self, model: str, base_url: Optional[str] = None, **kwargs):\n        self.model = model\n        self.base_url = base_url\n        self.kwargs = kwargs\n\n    def get_provider_name(self) -> str:\n        provider = getattr(self, \"provider\", None)\n        if provider:\n            return str(provider)\n        return self.__class__.__name__.removesuffix(\"Client\").lower()\n\n    def warn_if_unknown_model(self) -> None:\n        if self.validate_model():\n            return\n\n        warnings.warn(\n            (\n                f\"Model '{self.model}' is not in the known model list for \"\n                f\"provider '{self.get_provider_name()}'. Continuing anyway.\"\n            ),\n            RuntimeWarning,\n            stacklevel=2,\n        )\n\n    @abstractmethod\n    def get_llm(self) -> Any:\n        \"\"\"Return the configured LangChain client.\"\"\"\n\n    @abstractmethod\n    def validate_model(self) -> bool:\n        \"\"\"Return whether the model is known for the provider.\"\"\"\n","sourceCodeStart":30,"sourceCodeEnd":64,"githubUrl":"https://github.com/hsliuping/TradingAgents-CN/blob/74783e8817d6cf6de29867880631cc555153f36b/tradingagents/llm_clients/base_client.py#L30-L64","documentation":"A RuntimeWarning from warn_if_unknown_model (invoked via get_llm): the configured model name is not in the provider's known model list, but the client proceeds anyway. Providers generally accept arbitrary model strings, so this is advisory — the request may still fail server-side with a model-not-found API error, or succeed if the model exists but the list is stale. It fires whenever validate_model() returns False for the chosen client class.","triggerScenarios":"Setting model to a newly released or typo'd name (e.g. 'claude-3-5-sonet', 'gpt-4o-mini-2048') and calling get_llm(); using a custom/fine-tuned model alias not in the hardcoded list; pointing base_url at a proxy with renamed models.","commonSituations":"Typos in model config/env vars; bleeding-edge models released after the library's model list; self-hosted gateways with custom model names; users alarmed by the warning in logs even though requests work.","solutions":["Verify the model string against the provider's current model list and fix typos (most common cause).","If the model genuinely exists (new release or custom deployment), ignore or filter the warning — requests will still be sent.","Upgrade the library so its known-model list includes recent models."],"exampleFix":"# before\nclient = OpenAIClient(model=\"gpt-4o-minni\")  # typo -> RuntimeWarning\n\n# after\nclient = OpenAIClient(model=\"gpt-4o-mini\")","handlingStrategy":"validation","validationCode":"known = {\"gpt-4o\", \"gpt-4o-mini\", \"claude-3-5-sonnet\", \"claude-3-5-haiku\"}  # mirror your provider's list\nif model not in known:\n    print(f\"warning: {model!r} may not exist on this provider; verify spelling\")\nclient = get_llm(model=model, ...)","typeGuard":"def looks_like_valid_model(model: str) -> bool:\n    \"\"\"Heuristic guard: non-empty string, no spaces, plausible provider prefix.\"\"\"\n    return isinstance(model, str) and 0 < len(model.strip()) and \" \" not in model","tryCatchPattern":"import warnings\nwith warnings.catch_warnings(record=True) as caught:\n    client = get_llm(model=model)\nfor w in caught:\n    if issubclass(w.category, RuntimeWarning) and \"not in the known model list\" in str(w.message):\n        logging.getLogger(__name__).warning(\"possible model typo: %s\", model)\n# then handle the real API error separately if the call fails","preventionTips":["Copy model IDs from the provider's docs/console, not from memory.","Centralize model names in config with a small allowlist and lint for typos.","If using new/custom models via a proxy, filter this RuntimeWarning by message substring instead of disabling warnings globally."],"tags":["llm","model-name","runtime-warning","configuration"],"backgroundTag":"invalid-model-name","analyzedSha":"74783e8817d6cf6de29867880631cc555153f36b","analyzedAt":"2026-08-28T11:39:07.729Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}