OpenBMB/ChatDev · error · ValueError

Unsupported embedding model: {model}

Error message

Unsupported embedding model: {model}

What it means

create_embedding only supports provider 'openai' and 'local'. Any other value in embedding_config.provider raises this error before any embedding work starts.

Source

Thrown at runtime/node/agent/memory/embedding.py:78

                if current_chunk:
                    chunks.append(current_chunk.strip())
                current_chunk = sentence + "\u3002"
        
        if current_chunk:
            chunks.append(current_chunk.strip())
        
        return chunks

class EmbeddingFactory:
    @staticmethod
    def create_embedding(embedding_config: EmbeddingConfig) -> EmbeddingBase:
        model = embedding_config.provider
        if model == 'openai':
            return OpenAIEmbedding(embedding_config)
        elif model == 'local':
            return LocalEmbedding(embedding_config)
        else:
            raise ValueError(f"Unsupported embedding model: {model}")

class OpenAIEmbedding(EmbeddingBase):
    def __init__(self, embedding_config: EmbeddingConfig):
        super().__init__(embedding_config)
        self.base_url = embedding_config.base_url
        self.api_key = embedding_config.api_key
        self.model_name = embedding_config.model or "text-embedding-3-small"  # Default model
        self.max_length = embedding_config.params.get('max_length', 8191)
        self.use_chunking = embedding_config.params.get('use_chunking', False)
        self.chunk_strategy = embedding_config.params.get('chunk_strategy', 'average')
        self._fallback_dim = 1536  # Default; updated after first successful call

        if self.base_url:
            self.client = openai.OpenAI(api_key=self.api_key, base_url=self.base_url)
        else:
            self.client = openai.OpenAI(api_key=self.api_key)

    @retry(wait=wait_random_exponential(min=2, max=5), stop=stop_after_attempt(10))

View on GitHub (pinned to 4fb2db0ea9)

Solutions

  1. Set provider to exactly 'openai' or 'local'
  2. For local sentence-transformer models use provider='local' with params.model_path
  3. Check for casing/whitespace typos in the provider field

Example fix

# before
EmbeddingConfig(provider='OpenAI', ...)

# after
EmbeddingConfig(provider='openai', ...)
Defensive patterns

Strategy: validation

Validate before calling

if embedding_config.provider not in ('openai', 'local'):
    raise ConfigError(f"unsupported provider {embedding_config.provider!r}; use 'openai' or 'local'")
emb = create_embedding(embedding_config)

Prevention

When it happens

Trigger: Setting provider to 'azure', 'huggingface', 'sentence-transformers', 'ollama', or a typo like 'OpenAI' (case-sensitive) in the embedding config, then constructing the agent/memory that calls create_embedding.

Common situations: Assuming case-insensitive provider matching; migrating configs from other frameworks whose provider names differ; using an unsupported backend.

Related errors


AI-assisted analysis of OpenBMB/ChatDev@4fb2db0ea9 (2026-08-27). Data as JSON: /api/errors/4834ef5298862a7f. Report an issue: GitHub.