Repository navigation
fix: make the edenai embedder selectable and honoured by serve - #1820
Conversation
docs/reference/CLI_REFERENCE.md documents --embedder edenai and the embedder is in the registry, but the flag's click.Choice and the two interactive prompts were left on the older five-backend list, so the flag was rejected and neither prompt offered the option. _resolve_embedder_from_env in mode_selection.py is a third copy of the detection chain and did not read EDENAI_API_KEY, so a machine whose only key is that one defaulted to the mock and semantic search ran on vectors that cannot match the index. It is read last, before the mock, mirroring the shared resolver in cli/providers/embedders.py: an unrelated key in the environment must not outrank a backend the user was already resolving to. The --provider help string also omitted edenai. That option has no Choice, so the provider worked, it was just undocumented in --help.
docs/reference/CONFIG.md lists edenai among the accepted values, but _build_embedder resolved backends through a hardcoded chain that stopped at openrouter, so the value fell through to KeylessEmbedder with only a warning. The server then reported healthy while semantic search ran on vectors that cannot match the index, the same failure as repowise-dev#306. repowise-dev#324 fixed this class of bug for the MCP server by going through the shared registry, and _resolve_embedder there is correct today. This chain is the remaining hardcoded copy; converging it on get_embedder would fix every registered embedder at once, but that changes behaviour for the four existing backends, so this keeps the change small.
|
✅ Health of changed files: 2.0 → 2.4 (+0.4) 📋 At a glance Files & modules (2)
✅ Health gate: passed 📌 Before you merge
🔎 More signals (3)🗺️ Change map flowchart LR
subgraph PR ["Changed in this PR (4 with dependents)"]
f_packages_cli_src_repowise_cli_commands_init_cmd_command_py[".../init_cmd/command.py 🔥"]:::changed
f_packages_cli_src_repowise_cli_commands_reindex_cmd_py[".../commands/reindex_cmd.py 🔥"]:::changed
f_packages_cli_src_repowise_cli_ui_mode_selection_py[".../ui/mode_selection.py 🔥"]:::changed
f_packages_server_src_repowise_server_app_py[".../server/app.py 🔥"]:::changed
end
f_packages_cli_src_repowise_cli_commands_doctor_cmd_repo_checks_py[".../doctor_cmd/repo_checks.py"]
f_packages_cli_src_repowise_cli_commands_init_cmd_command_py --> f_packages_cli_src_repowise_cli_commands_doctor_cmd_repo_checks_py
f_packages_cli_src_repowise_cli_commands_generate_cmd_command_py[".../generate_cmd/command.py"]
f_packages_cli_src_repowise_cli_commands_init_cmd_command_py --> f_packages_cli_src_repowise_cli_commands_generate_cmd_command_py
f_packages_cli_src_repowise_cli_commands_hook_cmd_py[".../commands/hook_cmd.py"]
f_packages_cli_src_repowise_cli_commands_init_cmd_command_py --> f_packages_cli_src_repowise_cli_commands_hook_cmd_py
f_packages_cli_src_repowise_cli_commands_init_cmd___init___py[".../init_cmd/__init__.py"]
f_packages_cli_src_repowise_cli_commands_init_cmd_command_py --> f_packages_cli_src_repowise_cli_commands_init_cmd___init___py
f_packages_cli_src_repowise_cli_commands_reindex_cmd_py --> f_packages_cli_src_repowise_cli_commands_doctor_cmd_repo_checks_py
f_packages_cli_src_repowise_cli_commands_reindex_cmd_py --> f_packages_cli_src_repowise_cli_commands_generate_cmd_command_py
f_packages_cli_src_repowise_cli_upgrade_py[".../cli/upgrade.py"]
f_packages_cli_src_repowise_cli_commands_reindex_cmd_py --> f_packages_cli_src_repowise_cli_upgrade_py
f_packages_cli_src_repowise_cli_commands_init_cmd_generation_py[".../init_cmd/generation.py"]
f_packages_cli_src_repowise_cli_ui_mode_selection_py --> f_packages_cli_src_repowise_cli_commands_init_cmd_generation_py
f_packages_cli_src_repowise_cli_commands_init_cmd_reporting_py[".../init_cmd/reporting.py"]
f_packages_cli_src_repowise_cli_ui_mode_selection_py --> f_packages_cli_src_repowise_cli_commands_init_cmd_reporting_py
f_packages_cli_src_repowise_cli_commands_init_cmd_workspace_py[".../init_cmd/workspace.py"]
f_packages_cli_src_repowise_cli_ui_mode_selection_py --> f_packages_cli_src_repowise_cli_commands_init_cmd_workspace_py
f_packages_cli_src_repowise_cli_commands_update_cmd_command_py[".../update_cmd/command.py"]
f_packages_cli_src_repowise_cli_ui_mode_selection_py --> f_packages_cli_src_repowise_cli_commands_update_cmd_command_py
f_packages_cli_src_repowise_cli_helpers_py[".../cli/helpers.py"]
f_packages_server_src_repowise_server_app_py --> f_packages_cli_src_repowise_cli_helpers_py
f_packages_cli_src_repowise_cli_main_py[".../cli/main.py"]
f_packages_server_src_repowise_server_app_py --> f_packages_cli_src_repowise_cli_main_py
f_packages_core_src_repowise_core_pipeline_orchestrator_py[".../pipeline/orchestrator.py"]
f_packages_server_src_repowise_server_app_py --> f_packages_core_src_repowise_core_pipeline_orchestrator_py
more(["+4 more dependents"])
PR --> more
w_packages_cli_src_repowise_cli_commands_init_cmd_workspace_py(["⚠️ .../init_cmd/workspace.py changed together 22×, not in PR"]):::warn
f_packages_cli_src_repowise_cli_commands_init_cmd_command_py -.- w_packages_cli_src_repowise_cli_commands_init_cmd_workspace_py
w_packages_cli_src_repowise_cli_helpers_py(["⚠️ .../cli/helpers.py changed together 14×, not in PR"]):::warn
f_packages_cli_src_repowise_cli_commands_init_cmd_command_py -.- w_packages_cli_src_repowise_cli_helpers_py
t_tests_unit_cli_test_editor_setup_py(["✅ .../cli/test_editor_setup.py"]):::guard
t_tests_unit_cli_test_editor_setup_py -.-> f_packages_cli_src_repowise_cli_commands_init_cmd_command_py
t_tests_unit_cli_test_embedder_resolution_py(["✅ .../cli/test_embedder_resolution.py"]):::guard
t_tests_unit_cli_test_embedder_resolution_py -.-> f_packages_cli_src_repowise_cli_commands_reindex_cmd_py
t_tests_unit_cli_test_file_page_volume_prompt_py(["✅ .../cli/test_file_page_volume_prompt.py"]):::guard
t_tests_unit_cli_test_file_page_volume_prompt_py -.-> f_packages_cli_src_repowise_cli_ui_mode_selection_py
classDef changed fill:#dbeafe,stroke:#1d4ed8,color:#1e3a5f
classDef warn fill:#fef3c7,stroke:#b45309,color:#78350f
classDef guard fill:#dcfce7,stroke:#15803d,color:#14532d
Solid arrows: code that imports the changed files (16 direct dependents, from the last indexed snapshot). Dashed: history/tests. 🔥 Hotspots touched (5)
2 more
🔗 Hidden coupling (1 file)
👀 Suggested reviewers @RaghavChamadiya 📊 See the full report for this PR |
The reindex flag carries its own click.Choice and was left on the same older list, so `repowise reindex --embedder edenai` was rejected while CLI_REFERENCE.md documents it alongside the init flag. Spotted by @sloemo01 while working the same issue in repowise-dev#1819, which found this one where my own sweep of the choice lists had missed it.
|
Update: this raced with #1819 by @sloemo01, opened one second apart on the same issue. Context in #1815. Their PR caught I re-swept afterwards to be sure nothing else is left: Happy to close this in favour of #1819 if that is easier for you, no strong feelings. The three spots that would then still need doing are listed in a comment over there. |
RaghavChamadiya
left a comment
There was a problem hiding this comment.
Thanks @MVS-source. Filing the bug against your own merge before anyone noticed, and saying plainly that #705 was your omission, is the part worth naming here. That is a harder thing to do than the fix.
I checked the two judgement calls rather than taking the description for them.
The _resolve_embedder_from_env ordering is right. It mirrors the shared resolver at cli/providers/embedders.py:74-84 exactly, gemini then openai then openrouter then ollama then edenai then mock, so EDENAI_API_KEY only decides when nothing else has. That matters more than usual given you work at Eden AI, and putting your own backend last in the precedence chain is the correct answer rather than the convenient one. The parametrized test pinning it means it cannot quietly drift later either.
The default model is also right: amazon/amazon.titan-embed-text-v2:0 matches EdenAIEmbedder.__init__, not the value the registry docstring claims.
On the four symptoms in #1815, this covers all four. The two that make it worth taking before a release rather than after are the ones that are quiet:
_prompt_index_only_search is a second prompt that is easy to miss when you are reading for the obvious one, and _resolve_embedder_from_env is the one where nothing errors at all. A machine whose only key is EDENAI_API_KEY gets the mock, the server logs healthy, and semantic search runs on vectors that cannot match the index. That is the same shape as #1678, which shipped a fix for this morning, and it is not a failure anyone diagnoses from the outside.
Two follow-ups, neither for this PR.
Yes to converging _build_embedder on get_embedder, and you are right that it is the last hardcoded copy after #324 moved the MCP server across. Send it separately after the release, since it changes behaviour for four existing backends and that wants its own diff and its own week.
registry.py:9 says edenai defaults to openai/text-embedding-3-small, which is wrong against the class default your PR correctly uses. Pre-existing, unrelated to this change, worth a line whenever you are next in that file.
The flaky test_watch_cmd runs are an inotify limit on your machine and not something you needed to apologise for. Running the same command on main to show your branch fails strictly fewer tests than the base was the right way to settle it, and more rigour than most people bring to a "tests are flaky" claim.
Crediting @sloemo01 in the reindex commit for the one your own sweep missed was a good call.
Summary
edenaiembedder selectable: adds it to the--embedderclick.Choiceand its help, to both interactive embedder prompts, and to the env detection that supplies the advanced-mode default.REPOWISE_EMBEDDER=edenai, which made the server report healthy while semantic search ran on vectors that cannot match the index.edenaigap in the existingresolve_embedderparametrize.Related Issues
Fixes #1815
Follow-up to #705, which added the embedder and the docs but left four older lists behind. My omission, so this closes it out.
Test Plan
pytest)ruff check .)npm run build) (if frontend changes)No frontend change, so the web build is untouched.
What I ran:
pytest tests/unit/cli/test_edenai_reachability.py tests/unit/server/test_app_embedder_backends.pygives 13 passed, andtests/unit/cli/test_shared_helpers.py25 passed with the two new parametrize cases.pytest tests/unit/cli tests/unit/serverfor regressions, since the change touches prompt construction that other UI tests drive. This branch gives 6 failed, 4500 passed. I then ran the same command onmainat 9c16233 with nothing of mine applied, and it gives 9 failed, 4482 passed, so this branch fails strictly fewer tests than the base and every failure on it also fails without the change. They are all intest_update_e2e.py,test_update_persist_reliability.py, andtest_watch_cmd.py, none of which this diff touches, and the set varies between runs, which is what flaky looks like.One of them I can now explain, and it corrects something I said on feat: add Eden AI as a first-class LLM provider and embedder #705. The two
test_watch_cmd::TestSingleRepoTriggerfailures areOSError: [Errno 28] inotify watch limit reachedon my machine, not anything in your code. Sorry for the earlier noise on that.ruff check .clean across the repo. For formatting I checked against ruff 0.6.9, the version your.pre-commit-config.yamlpins, rather than the 0.15.6 the venv resolves under>=0.6,<1. Every line this PR adds is already formatted. Two of the files carry one pre-existing line each that 0.6.9 would rewrap, inmode_selection.pyandcommand.py, both untouched here and both already like that onmain, so I ranformat --diffrather thanformat --writeand left them alone.Both failures reproduce before the change and pass after:
Checklist
Docs needed no change here:
CLI_REFERENCE.mdandCONFIG.mdalready listedenai, which is what made this a bug rather than a feature.Notes on two judgement calls
_resolve_embedder_from_envinmode_selection.pyreadsEDENAI_API_KEYlast, immediately before the mock, mirroring the shared resolver incli/providers/embedders.py. Same reasoning you gave on #705: an unrelated key in the environment must not outrank a backend the user was already resolving to. There is a parametrized test pinning that, so it cannot drift back.For
server/app.pyI added a branch next to the others rather than routing throughget_embedder. Your #324 moved the MCP server onto the shared registry, and_build_embedderis the last hardcoded copy, so converging it would fix this class of bug for every registered embedder instead of one. I did not do it here because it changes behaviour for the four existing backends and this PR should stay small, but say the word and I will send that separately.I left the numbered embedder menu in
serve_cmd.pyalone for the same reason, details in the issue.I do work at Eden AI.