{"record":{"id":"348ada1ef716afa4","repo":"feder-cr/Jobs_Applier_AI_Agent_AIHawk","slug":"unsupported-model-type-llm-model-type","errorCode":null,"errorMessage":"Unsupported model type: {llm_model_type}","messagePattern":"Unsupported model type: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/libs/llm_manager.py","lineNumber":209,"sourceCode":"\n        llm_api_url = cfg.LLM_API_URL\n\n        logger.debug(f\"Using {llm_model_type} with {llm_model}\")\n\n        if llm_model_type == OPENAI:\n            return OpenAIModel(api_key, llm_model)\n        elif llm_model_type == CLAUDE:\n            return ClaudeModel(api_key, llm_model)\n        elif llm_model_type == OLLAMA:\n            return OllamaModel(llm_model, llm_api_url)\n        elif llm_model_type == GEMINI:\n            return GeminiModel(api_key, llm_model)\n        elif llm_model_type == HUGGINGFACE:\n            return HuggingFaceModel(api_key, llm_model)\n        elif llm_model_type == PERPLEXITY:\n            return PerplexityModel(api_key, llm_model)\n        else:\n            raise ValueError(f\"Unsupported model type: {llm_model_type}\")\n\n    def invoke(self, prompt: str) -> str:\n        return self.model.invoke(prompt)\n\n\nclass LLMLogger:\n    def __init__(self, llm: Union[OpenAIModel, OllamaModel, ClaudeModel, GeminiModel]):\n        self.llm = llm\n        logger.debug(f\"LLMLogger successfully initialized with LLM: {llm}\")\n\n    @staticmethod\n    def log_request(prompts, parsed_reply: Dict[str, Dict]):\n        logger.debug(\"Starting log_request method\")\n        logger.debug(f\"Prompts received: {prompts}\")\n        logger.debug(f\"Parsed reply received: {parsed_reply}\")\n\n        try:\n            calls_log = os.path.join(Path(\"data_folder/output\"), \"open_ai_calls.json\")","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/feder-cr/Jobs_Applier_AI_Agent_AIHawk/blob/79155b52faccfbd19b834680af285eac70dd2df4/src/libs/llm_manager.py#L191-L227","documentation":"LLMManager._create_model is a factory dispatching on the model-type string (OPENAI, GEMINI, HUGGINGFACE, PERPLEXITY, ...). If the configured string matches none of the known constants, it raises this ValueError because no client class can be constructed.","triggerScenarios":"Passing an llm_model_type string that is not one of the supported constants (typo, wrong case, or an API the version does not support) to the LLMManager constructor. Values come from config such as llm_model_type in settings YAML/JSON.","commonSituations":"Renamed or misspelled model type in the config file (e.g. 'open_ai' vs 'OPENAI'), upgrading/downgrading the library where supported constants changed, or a new provider string the installed version doesn't know.","solutions":["Check the supported model-type constants in the codebase (e.g. strings like OPENAI, GEMINI, HUGGINGFACE, PERPLEXITY) and correct llm_model_type in your config to exactly match one.","Ensure you are on a library version that supports the provider you configured.","If adding a new provider, extend _create_model with an elif branch and a model class instead of relying on an unsupported value."],"exampleFix":"# before\nllm_model_type: 'openai-chat'  # unsupported\n# after\nllm_model_type: 'OPENAI'  # must match the constant exactly","handlingStrategy":"validation","validationCode":"SUPPORTED = {'OPENAI', 'GEMINI', 'HUGGINGFACE', 'PERPLEXITY'}  # mirror the constants used in llm_manager.py\nassert cfg['llm_model_type'] in SUPPORTED, f\"unsupported llm_model_type: {cfg['llm_model_type']}\"","typeGuard":"def is_supported_model_type(v: str) -> bool:\n    return isinstance(v, str) and v in {'OPENAI', 'GEMINI', 'HUGGINGFACE', 'PERPLEXITY'}","tryCatchPattern":"try:\n    mgr = LLMManager(api_key, cfg['llm_model_type'], cfg['llm_model'])\nexcept ValueError as e:\n    raise ConfigError(f'Bad model config: {e}') from e","preventionTips":["Validate config values against the library's constants at startup.","Add config schema validation (e.g. jsonschema/pydantic) before constructing the LLM manager."],"tags":["python","llm","config","unsupported-value","factory"],"backgroundTag":"unsupported-config-value","analyzedSha":"79155b52faccfbd19b834680af285eac70dd2df4","analyzedAt":"2026-08-28T14:10:26.659Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}