Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[BUG] OpenAI-compatible embedding model alias breaks embedder construction

Open Beginner friendly
#8,761 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@gokay-ai is already working on this.

Since Oct 29, 2026.

  • #8762 by @gokay-ai — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
65/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
ai, backend

Research direction

Start in crewai/rag/embeddings/factory.py and trace how build_embedder passes provider configuration into the OpenAI and OpenRouter embedding functions. Check the provider model definitions and existing regression tests for alias handling and precedence when both keys are present. Done means construction succeeds for model alone and with both keys, while model_name retains precedence; run the focused offline factory tests.

Written by the indexing model from the issue text.

Description

Description

model is accepted as a backward-compatible alias for model_name by the OpenAI and OpenRouter embedding providers. However, constructing the actual embedding function with that alias raises:

TypeError: OpenAIEmbeddingFunction.__init__() got an unexpected keyword argument 'model'

Both alias-only configuration and configuration containing both keys fail. Configuration containing only model_name succeeds. This affects dictionary specifications and provider instances passed to build_embedder.

Reproduction

From a development checkout with core dependencies installed:

from crewai.rag.embeddings.factory import build_embedder

build_embedder({
    "provider": "openai",  # also reproducible with "openrouter"
    "config": {
        "api_key": "offline-test-key",
        "model": "text-embedding-3-small",
    },
})

This only constructs the embedding function; it does not call an embedding API or require a real key.

Expected behavior

Consume the model alias before building the embedding function, retaining model_name as the canonical key. If both keys are supplied, preserve the existing documented/tested precedence of model_name.

Evidence and scope

Verified against main 90266d5257055e05fabeced6d848eda8d0280cbf (CrewAI 1.15.33), Python 3.12.7, Pydantic 2.12.5 and ChromaDB 1.5.9 on Windows. Twelve offline regression cases use the real factory and OpenAIEmbeddingFunction: eight alias cases fail with the TypeError above, and four canonical-key controls pass on the unchanged implementation. After the local fix, all twelve pass.

The providers copy model into model_name, but leave model in Pydantic's allowed extra fields. build_embedder_from_provider then expands provider.model_dump() into the downstream constructor, which does not accept model.

This problem was previously mentioned as an out-of-scope observation in #7978. That PR's changed files do not include either of these provider implementations. Searches of related issues, PRs in all states, and the provider's recent commit history did not identify a separate fix at the time of this check. A focused local fix and regression tests are prepared.

AI disclosure

Prepared with OpenAI Codex for investigation, implementation and local validation. This is an AI-generated contribution under CONTRIBUTING.md; please apply llm-generated if the creating account cannot apply repository labels.

Dominant language
Python
Stars
60.1k
Forks
8.9k
Avg merge
1d 7h
Merged PRs (30d)
184

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from crewAIInc/crewAI

All issues in crewAIInc/crewAI

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.