Skip to content

Fix: ollama provider - #16519

Merged
wangq8 merged 2 commits into
infiniflow:mainfrom
Lynn-Inf:fix/ollama-provider
Jul 1, 2026
Merged

wangq8 merged 2 commits into
infiniflow:mainfrom
Lynn-Inf:fix/ollama-provider

Conversation

@Lynn-Inf

@Lynn-Inf Lynn-Inf commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Ollama: remove default model, allow empty api_key for non‑VLLM.

Close #16508

@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. 🐞 bug Something isn't working, pull request that fix bug. labels Jul 1, 2026
@Lynn-Inf Lynn-Inf added the ci Continue Integration label Jul 1, 2026
@coderabbitai

coderabbitai Bot commented Jul 1, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The provider instance creation endpoint now requires only instance_name, dropping the mandatory api_key check for non-VLLM providers and defaulting it to an empty string. The Ollama entry in the LLM factories config had its model list cleared.

Changes

Provider Instance Validation and Config Update

Layer / File(s) Summary
Relax api_key requirement
api/apps/restful_apis/provider_api.py
create_provider_instance validation now only requires instance_name; api_key defaults to empty string instead of being mandatory for non-VLLM providers, with updated error message.
Clear stale Ollama model config
conf/llm_factories.json
Ollama factory's llm list changed from containing agnuxo/cajal-4b-p2pclaw to an empty array.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

  • infiniflow/ragflow#16131: Modifies the same create_provider_instance validation logic in provider_api.py as part of provider/instance API migration.
  • infiniflow/ragflow#16352: Also adjusts create_provider_instance in provider_api.py to allow missing api_key for VLLM providers.

Poem

No key required, hop through the gate,
Ollama's list now sits lean and straight.
One line freed, one model gone,
This bunny's fix won't take too long. 🐰
Thump-thump — validation's right at last!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately points to the Ollama provider fix.
Description check ✅ Passed The description includes a brief summary and the issue reference, matching the repository template well enough.
Linked Issues check ✅ Passed The changes remove the default Ollama model and stop requiring api_key for non-VLLM instances, matching issue #16508.
Out of Scope Changes check ✅ Passed The PR only changes Ollama provider validation and configuration, with no clear unrelated additions.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Lynn-Inf
Lynn-Inf marked this pull request as draft July 1, 2026 04:06
@Lynn-Inf
Lynn-Inf marked this pull request as ready for review July 1, 2026 04:06

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
api/apps/restful_apis/provider_api.py (1)

314-340: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Update Swagger schema to match relaxed validation.

The required array in the docstring schema (Lines 316-318) still lists api_key as required, but the code now only enforces instance_name (Line 339). This will mislead API consumers or schema-generation tooling into believing api_key is mandatory.

📝 Proposed fix
         schema:
           type: object
           required:
             - instance_name
-            - api_key
           properties:
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@api/apps/restful_apis/provider_api.py` around lines 314 - 340, The Swagger
docstring schema in provider_api.py still marks api_key as required even though
create-instance validation only checks instance_name in the request handler.
Update the schema under the create endpoint’s docstring so the required list
matches the relaxed validation, keeping api_key optional while leaving the rest
of the properties unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@api/apps/restful_apis/provider_api.py`:
- Around line 314-340: The Swagger docstring schema in provider_api.py still
marks api_key as required even though create-instance validation only checks
instance_name in the request handler. Update the schema under the create
endpoint’s docstring so the required list matches the relaxed validation,
keeping api_key optional while leaving the rest of the properties unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 19b05a54-ae26-4a53-b212-3eb73f0acd2b

📥 Commits

Reviewing files that changed from the base of the PR and between 828c578 and 6b47be3.

📒 Files selected for processing (2)
  • api/apps/restful_apis/provider_api.py
  • conf/llm_factories.json

@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.16%. Comparing base (45fc7fe) to head (6b47be3).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16519      +/-   ##
==========================================
- Coverage   94.56%   93.16%   -1.40%     
==========================================
  Files          10       10              
  Lines         717      717              
  Branches      118      118              
==========================================
- Hits          678      668      -10     
- Misses         25       29       +4     
- Partials       14       20       +6     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@wangq8
wangq8 merged commit b6fa5ce into infiniflow:main Jul 1, 2026
11 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Add the ollama model prompt Fail to access model(Ollama/qwen3.5:9b) using this api key

2 participants