feder-cr/Jobs_Applier_AI_Agent_AIHawk · error · ValueError

Unsupported model type: {llm_model_type}

Error message

Unsupported model type: {llm_model_type}

What it means

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.

Source

Thrown at src/libs/llm_manager.py:209

        llm_api_url = cfg.LLM_API_URL

        logger.debug(f"Using {llm_model_type} with {llm_model}")

        if llm_model_type == OPENAI:
            return OpenAIModel(api_key, llm_model)
        elif llm_model_type == CLAUDE:
            return ClaudeModel(api_key, llm_model)
        elif llm_model_type == OLLAMA:
            return OllamaModel(llm_model, llm_api_url)
        elif llm_model_type == GEMINI:
            return GeminiModel(api_key, llm_model)
        elif llm_model_type == HUGGINGFACE:
            return HuggingFaceModel(api_key, llm_model)
        elif llm_model_type == PERPLEXITY:
            return PerplexityModel(api_key, llm_model)
        else:
            raise ValueError(f"Unsupported model type: {llm_model_type}")

    def invoke(self, prompt: str) -> str:
        return self.model.invoke(prompt)


class LLMLogger:
    def __init__(self, llm: Union[OpenAIModel, OllamaModel, ClaudeModel, GeminiModel]):
        self.llm = llm
        logger.debug(f"LLMLogger successfully initialized with LLM: {llm}")

    @staticmethod
    def log_request(prompts, parsed_reply: Dict[str, Dict]):
        logger.debug("Starting log_request method")
        logger.debug(f"Prompts received: {prompts}")
        logger.debug(f"Parsed reply received: {parsed_reply}")

        try:
            calls_log = os.path.join(Path("data_folder/output"), "open_ai_calls.json")

View on GitHub (pinned to 79155b52fa)

Solutions

  1. 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.
  2. Ensure you are on a library version that supports the provider you configured.
  3. If adding a new provider, extend _create_model with an elif branch and a model class instead of relying on an unsupported value.

Example fix

# before
llm_model_type: 'openai-chat'  # unsupported
# after
llm_model_type: 'OPENAI'  # must match the constant exactly
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED = {'OPENAI', 'GEMINI', 'HUGGINGFACE', 'PERPLEXITY'}  # mirror the constants used in llm_manager.py
assert cfg['llm_model_type'] in SUPPORTED, f"unsupported llm_model_type: {cfg['llm_model_type']}"

Type guard

def is_supported_model_type(v: str) -> bool:
    return isinstance(v, str) and v in {'OPENAI', 'GEMINI', 'HUGGINGFACE', 'PERPLEXITY'}

Try / catch

try:
    mgr = LLMManager(api_key, cfg['llm_model_type'], cfg['llm_model'])
except ValueError as e:
    raise ConfigError(f'Bad model config: {e}') from e

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of feder-cr/Jobs_Applier_AI_Agent_AIHawk@79155b52fa (2026-08-28). Data as JSON: /api/errors/348ada1ef716afa4. Report an issue: GitHub.