fix(api): showcase agent step runs on local Ollama (no API key needed)#341
Conversation
There was a problem hiding this comment.
Sorry @w7-mgfcode, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Root cause
On a local-Ollama stack (
agent_default_model = ollama:qwen3:8b), the showcaseagent_hitl_flowstep (and legacyagentstep) always ⏭️ skip with "no API key matching agent_default_model provider" — because_llm_key_present()inapp/features/demo/pipeline.pyonly recognized cloud providers and returnedFalseforollama, which needs no API key.Fix
Add an
ollamabranch to_llm_key_present()that returnsTrue(no key required). The step still degrades gracefully if Ollama is unreachable — the chat round-trip fails and the step skips via its existing error path — so we let it attempt the call rather than pre-skip.Tests
test_llm_key_present_ollama_needs_no_key—ollama:qwen3:8bwith no keys set →True.test_llm_key_present_cloud_still_requires_key—openai:*with empty key →False(cloud branch unchanged).Scope note
Demo-only. Interactive Agent Chat (Chat page) builds the model via
agents/base.py:build_agent_model(supportsollama:) and does not gate on_llm_key_present, so HITL already worked there on Ollama — this PR brings the showcase pipeline in line.Validation
ruff check✅ ·ruff format --check✅mypy app/✅ — only pre-existingxgboostoptional-dep import errors in untouched filespyright app/features/demo✅ 0 errorspytest -m "not integration"✅ 1653 passed, 12 skippedCloses #340