Repository navigation
Add CAJAL scientific paper agent template - #14641
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughAdds a CAJAL scientific paper agent template with Begin → Agent → Message graph wiring, retrieval-grounded generation settings, Ollama model registration, and unit tests covering template, graph, and factory consistency. ChangesCAJAL Scientific Paper Agent
Sequence Diagram(s)sequenceDiagram
participant Begin as Begin
participant Agent as Agent:NewPumasLick
participant Retrieval as Retrieval
participant Message as Message:OrangeYearsShine
Begin->>Agent: provide prologue and query
Agent->>Retrieval: request evidence
Retrieval->>Agent: return retrieved documents
Agent->>Message: forward content
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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.
Inline comments:
In `@agent/templates/cajal_scientific_paper_agent.json`:
- Around line 163-168: Remove the dangling graph edge and node referencing the
unused tool: delete the edge object with id
"xy-edge__Agent:NewPumasLicktool-Tool:AllBirdsNail" and any corresponding node
entries named "Tool:AllBirdsNail" from the JSON so the Agent
"Agent:NewPumasLick" does not reference a non-existent tool; also search for and
remove any other occurrences of "Tool:AllBirdsNail" or identical edge ids
elsewhere in the file and ensure no edges point to a tool that isn't defined in
the CAJAL retrieval tool configuration.
- Line 35: The template pins the LLM by the literal llm_id
"agnuxo/cajal-4b-p2pclaw@Ollama" which is not publicly available and causes
failures; update the agent template to either (A) add a clear note in the
template description that this model must be pre-pulled from Ollama before use
(documenting the prerequisite), or (B) implement a runtime fallback: detect
availability of the specified llm_id and if unreachable, switch to a publicly
available fallback llm_id (e.g., a known public Ollama or other provider model)
and log a clear warning; apply the chosen change to all occurrences of the
llm_id in the template (the four entries using "agnuxo/cajal-4b-p2pclaw@Ollama")
so the behavior is consistent.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 03c8ee4e-27f2-4b17-bc23-4af3ff6f0475
📒 Files selected for processing (3)
agent/templates/cajal_scientific_paper_agent.jsonconf/llm_factories.jsontest/test_cajal_template_unit.py
| "exception_method": null, | ||
| "frequencyPenaltyEnabled": false, | ||
| "frequency_penalty": 0.5, | ||
| "llm_id": "agnuxo/cajal-4b-p2pclaw@Ollama", |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "Checking public Ollama manifest endpoint for the configured model..."
curl -sS -o /tmp/cajal_manifest.json -w "HTTP %{http_code}\n" \
https://registry.ollama.ai/v2/agnuxo/cajal-4b-p2pclaw/manifests/latest || true
echo "Checking Hugging Face repo file list for GGUF artifacts..."
curl -sS https://huggingface.co/api/models/Agnuxo/CAJAL-4B-P2PCLAW \
| jq -r '.siblings[]?.rfilename' \
| grep -Ei '\.gguf$' || trueRepository: infiniflow/ragflow
Length of output: 199
🏁 Script executed:
find . -name "cajal_scientific_paper_agent.json" -type fRepository: infiniflow/ragflow
Length of output: 114
🏁 Script executed:
cat -n agent/templates/cajal_scientific_paper_agent.json | head -100Repository: infiniflow/ragflow
Length of output: 6251
🏁 Script executed:
# Check if there are fallback mechanisms or model availability checks in the codebase
rg -i "agnuxo|cajal.*model|fallback.*model|llm.*resolve" --type json --type py --type ts --type js -A 3 -B 3Repository: infiniflow/ragflow
Length of output: 50376
🏁 Script executed:
sed -n '230,260p' agent/templates/cajal_scientific_paper_agent.jsonRepository: infiniflow/ragflow
Length of output: 3131
🏁 Script executed:
cat -n conf/llm_factories.json | grep -A 5 -B 5 "cajal"Repository: infiniflow/ragflow
Length of output: 558
🏁 Script executed:
# Search for model resolution and fallback logic
rg -i "resolve.*model|pull.*model|fallback|default.*model" --type py -A 3 -B 3 | head -100Repository: infiniflow/ragflow
Length of output: 6625
🏁 Script executed:
# Check lines 234 and 256 directly
sed -n '234p;256p' agent/templates/cajal_scientific_paper_agent.jsonRepository: infiniflow/ragflow
Length of output: 2049
🏁 Script executed:
# Look for how llm_id is resolved at runtime - search for model resolution logic
rg "llm_id" --type py -A 5 -B 5 | head -150Repository: infiniflow/ragflow
Length of output: 16054
🏁 Script executed:
# Check if there's error handling or validation for missing models
rg -i "model.*not.*found|llm.*unavailable|cannot.*resolve|pull.*model" --type py -A 3 -B 3 | head -80Repository: infiniflow/ragflow
Length of output: 6638
🏁 Script executed:
# Check if there's any documentation about model availability/requirements for templates
find . -name "*.md" -o -name "*.txt" | xargs grep -l -i "template.*model\|agent.*requirement\|ollama.*pull\|model.*prerequisite" 2>/dev/null | head -5Repository: infiniflow/ragflow
Length of output: 128
🏁 Script executed:
# Verify what happens when a template is instantiated - check agent/template loading logic
rg "load.*template|template.*agent" --type py -A 5 -B 2 | head -100Repository: infiniflow/ragflow
Length of output: 4802
🏁 Script executed:
# Check documentation about template requirements and model setup
cat docs/guides/models/llm_api_key_setup.md | grep -A 10 -B 10 -i "template\|ollama\|local" | head -80Repository: infiniflow/ragflow
Length of output: 2443
🏁 Script executed:
# Look for any documentation about the CAJAL model specifically
find . -type f \( -name "*.md" -o -name "*.json" -o -name "*.txt" \) | xargs grep -l "CAJAL\|cajal\|agnuxo" 2>/dev/null | head -10Repository: infiniflow/ragflow
Length of output: 140
🏁 Script executed:
# Check the deploy_local_llm documentation for guidance on local model setup
find . -name "deploy_local_llm*" -o -name "*local*llm*" | head -10Repository: infiniflow/ragflow
Length of output: 104
🏁 Script executed:
# Examine if there's any README or guidance about the CAJAL template
cat docs/release_notes.md | grep -A 5 -B 5 -i "cajal\|scientific" | head -60Repository: infiniflow/ragflow
Length of output: 44
🏁 Script executed:
# Look for how agents handle missing/unavailable models at runtime
rg "Error.*model|unavailable.*model|cannot.*find.*model" --type py -A 3 -B 1 | head -80Repository: infiniflow/ragflow
Length of output: 5468
🏁 Script executed:
# Check if there's any documentation about prerequisites or setup for the CAJAL template
cat docs/guides/models/deploy_local_llm.mdx | head -100Repository: infiniflow/ragflow
Length of output: 4776
🏁 Script executed:
# Verify all occurrences of the model reference to understand scope
rg "agnuxo/cajal-4b-p2pclaw" --type json --type pyRepository: infiniflow/ragflow
Length of output: 4552
🏁 Script executed:
# Check the template description field to see if it mentions the prerequisite
sed -n '1,20p' agent/templates/cajal_scientific_paper_agent.jsonRepository: infiniflow/ragflow
Length of output: 1003
🏁 Script executed:
# Check if there's any README or setup guide specific to CAJAL template
find . -type f -name "*cajal*" -o -name "*CAJAL*" 2>/dev/nullRepository: infiniflow/ragflow
Length of output: 149
Add documentation or provide a fallback for the CAJAL model dependency.
This template pins to agnuxo/cajal-4b-p2pclaw@Ollama, which is not publicly available (HTTP 404 from registry) and requires users to manually pull the model via Ollama first. The template description says "preconfigured" but omits this prerequisite, making "Recommended" templates fail on first run for unprepared users. Either document the requirement in the template description or add a fallback model with availability detection.
All 4 occurrences (lines 35, 57, 234, 256) use the same model; fixes should be applied consistently.
🤖 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 `@agent/templates/cajal_scientific_paper_agent.json` at line 35, The template
pins the LLM by the literal llm_id "agnuxo/cajal-4b-p2pclaw@Ollama" which is not
publicly available and causes failures; update the agent template to either (A)
add a clear note in the template description that this model must be pre-pulled
from Ollama before use (documenting the prerequisite), or (B) implement a
runtime fallback: detect availability of the specified llm_id and if
unreachable, switch to a publicly available fallback llm_id (e.g., a known
public Ollama or other provider model) and log a clear warning; apply the chosen
change to all occurrences of the llm_id in the template (the four entries using
"agnuxo/cajal-4b-p2pclaw@Ollama") so the behavior is consistent.
Per CodeRabbit review on PR infiniflow#14641: the CAJAL agent graph wired a 'Tool:AllBirdsNail' node and the edge connecting it to Agent:NewPumasLick, but the node was never part of the actual retrieval tool configuration. Carrying an orphan node/edge through the template would surface as a confusing placeholder in the agent editor and risks data drift if anyone tries to reattach it. Removes: - the xy-edge__Agent:NewPumasLicktool-Tool:AllBirdsNailend edge - the Tool:AllBirdsNail node block Leaves the rest of the graph intact.
|
Addressed CodeRabbit's dangling-tool review in Removed the orphan
Confirmed by On CodeRabbit's other comment (model-availability probe at line 35): the probes are inconclusive without a live RAGFlow runtime to evaluate model resolution, and the agent template references the model name as a plain string for downstream resolution. Leaving as-is unless a maintainer wants me to expand on the model-handling section. |
| "status": "1", | ||
| "rank": "830", | ||
| "llm": [] | ||
| "llm": [ |
There was a problem hiding this comment.
Appreciations!
But this should not be added. Other users does not have this model.
|
This PR currently has merge conflicts with Please run locally: git fetch origin main
git rebase origin/main
# or
git merge origin/mainAfter resolving the conflicts, push to the current head branch and CI will re-run the review checks.
|
…1-7fio4 Resolved conflict in conf/llm_factories.json: kept the PR-side change that adds the agnuxo/cajal-4b-p2pclaw Ollama chat model entry (with 32K context, scientific writing tags) and its rank=830 ordering, since the two sides were mutually exclusive for that single Ollama factory entry (main had rank=988 with an empty llm list, the PR replaced both with rank=830 + the populated list).
|
CI ran end-to-end after the conflict-resolved merge to This is a pre-existing bug on
// src/components/ui/modal.tsx
import React from 'react'; // line 2 — duplicate
import { cn } from '@/lib/utils';
import * as DialogPrimitive from '@radix-ui/react-dialog';
import { AlertCircle, CheckCircle, Info, Loader, X } from 'lucide-react';
import React, { FC, ReactNode, useCallback, useEffect, useMemo } from 'react'; // line 5
Per PR-side verification I did locally after the merge commit (these all passed):
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #14641 +/- ##
=======================================
Coverage 93.16% 93.16%
=======================================
Files 10 10
Lines 717 717
Branches 118 118
=======================================
Hits 668 668
Misses 29 29
Partials 20 20 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
What problem does this PR solve?
Closes #14571.
Adds CAJAL as a first-class local scientific-writing option in RAGFlow:
agnuxo/cajal-4b-p2pclawas a known Ollama chat model with a 32K context settingBehavior/evidence gathered for the requested model:
Agnuxo/CAJAL-4B-P2PCLAWreportspipeline_tag=text-generationand tags includinggguf,llama.cpp,vllm,scientific-research,papers,academic-writing,latex, andlicense:apache-2.0.https://registry.ollama.ai/v2/agnuxo/cajal-4b-p2pclaw/manifests/latestandhttps://registry.ollama.ai/v2/library/agnuxo/cajal-4b-p2pclaw/manifests/latestreturned404 Not Found; the Hugging Face repo tree currently exposes an 8.4 GBmodel.safetensorsbut no GGUF artifact inmain. The template therefore targets the documented Ollama model name for users who have the local CAJAL deployment/model file available.Verification run locally:
uv run pytest test/testcases/test_web_api/test_agent_app/test_cajal_template_unit.py -qwas also attempted first, but dependency setup failed before test collection while buildingormsgpack==1.5.0from uv with a package metadata parse error. Clearing uv’sormsgpackcache and retrying reproduced the same build failure, so the focused unit test was run with the system Python environment instead.Type of change