assafelovic/gpt-researcher · error · ValueError

Set SMART_LLM or FAST_LLM = '<llm_provider>:<llm_model>' Eg

Error message

Set SMART_LLM or FAST_LLM = '<llm_provider>:<llm_model>' Eg 'openai:gpt-4o-mini'

What it means

Config.parse_llm expects SMART_LLM/FAST_LLM strings of the form '<provider>:<model>'. When str.partition(':') fails to find a colon it raises ValueError, and the except ValueError branch re-raises this generic message with an example.

Source

Thrown at gpt_researcher/config/config.py:219

            )
        return retrievers

    @staticmethod
    def parse_llm(llm_str: str | None) -> tuple[str | None, str | None]:
        """Parse llm string into (llm_provider, llm_model)."""
        from gpt_researcher.llm_provider.generic.base import _SUPPORTED_PROVIDERS

        if llm_str is None:
            return None, None
        try:
            llm_provider, llm_model = llm_str.split(":", 1)
            assert llm_provider in _SUPPORTED_PROVIDERS, (
                f"Unsupported {llm_provider}.\nSupported llm providers are: "
                + ", ".join(_SUPPORTED_PROVIDERS)
            )
            return llm_provider, llm_model
        except ValueError:
            raise ValueError(
                "Set SMART_LLM or FAST_LLM = '<llm_provider>:<llm_model>' "
                "Eg 'openai:gpt-4o-mini'"
            )

    @staticmethod
    def parse_reasoning_effort(reasoning_effort_str: str | None) -> str | None:
        """Parse reasoning effort string into (reasoning_effort)."""
        if reasoning_effort_str is None:
            return ReasoningEfforts.Medium.value
        if reasoning_effort_str not in [effort.value for effort in ReasoningEfforts]:
            raise ValueError(f"Invalid reasoning effort: {reasoning_effort_str}. Valid options are: {', '.join([effort.value for effort in ReasoningEfforts])}")
        return reasoning_effort_str

    @staticmethod
    def parse_embedding(embedding_str: str | None) -> tuple[str | None, str | None]:
        """Parse embedding string into (embedding_provider, embedding_model)."""
        from gpt_researcher.memory.embeddings import _SUPPORTED_PROVIDERS

View on GitHub (pinned to 6f998577d5)

Solutions

  1. Set the variable as 'provider:model', e.g. FAST_LLM='openai:gpt-4o-mini'
  2. Ensure the provider is supported (openai, anthropic, groq, ...) If you meant the old style, remove it and use the combined form

Example fix

# before
FAST_LLM=gpt-4o-mini
# after
FAST_LLM=openai:gpt-4o-mini
Defensive patterns

Strategy: validation

Validate before calling

def parse_llm_ok(v: str) -> bool:
    return isinstance(v, str) and ":" in v and v.split(":", 1)[0] in {"openai","anthropic","groq","azure","ollama"}
assert parse_llm_ok(os.getenv("FAST_LLM",""))

Try / catch

try:
    cfg = Config()
except ValueError as e:
    if "SMART_LLM or FAST_LLM" in str(e):
        raise SystemExit("Set FAST_LLM='openai:gpt-4o-mini'")
    raise

Prevention

When it happens

Trigger: Setting FAST_LLM='gpt-4o-mini' without the 'openai:' prefix, using '=' instead of ':', or a value that is empty/None-shaped so no provider:model split is possible.

Common situations: Migrating from the deprecated LLM_PROVIDER + FAST_LLM_MODEL vars to the combined FAST_LLM syntax; quoting issues in .env that strip part of the value.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of assafelovic/gpt-researcher@6f998577d5 (2026-08-28). Data as JSON: /api/errors/85f220905955f3e0. Report an issue: GitHub.