Skip to content

feat(nodes): add Baidu Qianfan ERNIE LLM node - #1006

Merged
asclearuc merged 7 commits into
rocketride-org:developfrom
jimmyzhuu:feat/RR-1005-add-baidu-qianfan-llm
Jun 4, 2026
Merged

asclearuc merged 7 commits into
rocketride-org:developfrom
jimmyzhuu:feat/RR-1005-add-baidu-qianfan-llm

Conversation

@jimmyzhuu

@jimmyzhuu jimmyzhuu commented May 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR adds first-class Baidu Qianfan / ERNIE support as a dedicated RocketRide LLM node.

Instead of requiring users to configure Baidu through the generic OpenAI-compatible node, the new llm_baidu_qianfan node exposes Qianfan-specific defaults, provider branding, model profiles, runtime validation, sync-models support, and targeted tests.

Closes #1005

Motivation

RocketRide already includes dedicated nodes for major LLM providers such as OpenAI, Anthropic, Gemini, Mistral, DeepSeek, Perplexity, xAI, and Qwen. Baidu Qianfan is an important provider for Chinese-language and enterprise AI workflows, and Qianfan now exposes OpenAI-compatible chat-completions endpoints.

A dedicated node improves the user experience in three ways:

  • Users can select Baidu Qianfan directly from the node catalogue.
  • ERNIE model profiles are discoverable without manual base URL setup.
  • The model sync tooling can validate and maintain Qianfan profiles like other cloud providers.

What Changed

New node runtime

  • Added nodes/src/nodes/llm_baidu_qianfan/.
  • Implemented IGlobal, IInstance, and qianfan_client.Chat.
  • Uses langchain_openai.ChatOpenAI against Qianfan's OpenAI-compatible API.
  • Defaults to https://qianfan.baidubce.com/v2.
  • Keeps serverbase configurable so users can switch endpoints, including Baidu's international endpoint when needed.
  • Validates configuration with a 1-token chat-completions probe.
  • Maps common OpenAI SDK exceptions into provider-specific user-facing messages.

Node metadata and profiles

  • Added services.json for llm_baidu_qianfan://.
  • Added default ERNIE profiles:
    • ernie-4.5-turbo-128k
    • ernie-4.5-turbo-32k
    • ernie-5.0-thinking-preview
    • custom
  • Marked the API-confirmed ERNIE profiles with modelSource: "provider".
  • Added a dynamic node test case using the existing mocked LLM response path.
  • Added node README documentation.
  • Added test mock credentials for llm_baidu_qianfan.

Shared UI

  • Added a Baidu node icon asset.
  • Registered baidu-qianfan.svg in the shared UI icon resolver.
  • Kept the Baidu icon out of THEME_DYNAMIC_ICONS because it is a colored brand asset and should not be filtered as a single-color icon.

Model sync tooling

  • Added BaiduQianfanProvider.
  • Registered llm_baidu_qianfan in _PROVIDER_REGISTRY and _SERVICES_JSON_PATHS.
  • Added Qianfan config to sync_models.config.json.
  • Added ERNIE title mapping and token/output-token overrides.
  • Added ROCKETRIDE_BAIDU_QIANFAN_KEY live-test marker.
  • Added live profile-existence coverage for Qianfan.
  • Added focused provider unit tests.
  • Updated tools/SYNC_MODELS.md.

Implementation Notes

  • Qianfan API keys are not forced to start with sk-. The runtime only validates that a non-empty key is configured because Baidu keys can use other formats.
  • The first version intentionally sticks to standard OpenAI-compatible chat completions. Qianfan-specific reasoning controls are not added yet, keeping this PR focused on the base provider integration.
  • custom remains protected from sync-models deprecation.
  • The sync dry run with real Qianfan credentials reports no changes after this PR's checked-in profiles.

Testing

Local focused tests:

  • PYTHONPATH=tools/src pytest tools/test/test_baidu_qianfan_provider.py -v
  • PYTHONPATH=nodes/src uv run --with pytest --with pytest-asyncio --with pytest-timeout --with pytest-xdist --with pytest-mock --with json5 --with requests --with httpx --with openai pytest nodes/test/test_contracts.py -k llm_baidu_qianfan -v
  • python -m py_compile nodes/src/nodes/llm_baidu_qianfan/IGlobal.py nodes/src/nodes/llm_baidu_qianfan/qianfan_client.py tools/src/providers/baidu_qianfan.py
  • git diff --check

Live/API validation:

  • PYTHONPATH=tools/src uv run --with pytest --with json5 --with openai pytest tools/test/test_sync_live.py -k baidu_qianfan -v
    Verified this skips cleanly without credentials.
  • ROCKETRIDE_BAIDU_QIANFAN_KEY=*** PYTHONPATH=tools/src uv run --with pytest --with json5 --with openai pytest tools/test/test_sync_live.py -k baidu_qianfan -v
    Verified this passes with a real Qianfan key.
  • Real Qianfan chat-completions smoke test with ernie-4.5-turbo-128k.
  • ROCKETRIDE_BAIDU_QIANFAN_KEY=*** PYTHONPATH=tools/src uv run --with json5 --with openai python tools/src/sync_models.py --provider llm_baidu_qianfan --model-source provider
    Verified dry run reports no changes.

Local Environment Note

./builder nodes:test-contracts was not runnable in this local environment because the default pnpm is 9.15.9, while this repository requires pnpm >=10.0.0. Direct pytest contract coverage for the new node passed.

Security

  • No API keys or credentials are committed.
  • Live Qianfan credentials were only supplied through environment variables during local verification.

Summary by CodeRabbit

  • New Features

    • Added Baidu Qianfan (ERNIE) as a new LLM provider with API key, model selection, token limits, selectable China/International endpoints, connectivity validation, and user-facing warnings.
  • Documentation

    • Added provider README and updated provider tables and sync docs.
  • Tests

    • Added unit and live tests, a pytest marker for Qianfan, and mock/test support.
  • Chores

    • Added provider sync/config entries and model metadata for ERNIE profiles.

@coderabbitai

coderabbitai Bot commented May 27, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a Baidu Qianfan (ERNIE) LLM node: runtime with config validation and lifecycle, a Chat adapter, services.json profiles, model-sync provider, docs, and tests.

Changes

Baidu Qianfan LLM Node Integration

Layer / File(s) Summary
Node Runtime: Validation, Client, and Lifecycle
nodes/src/nodes/llm_baidu_qianfan/IGlobal.py, nodes/src/nodes/llm_baidu_qianfan/qianfan_client.py, nodes/src/nodes/llm_baidu_qianfan/IInstance.py, nodes/src/nodes/llm_baidu_qianfan/__init__.py, nodes/src/nodes/llm_baidu_qianfan/requirements.txt
IGlobal validates configuration by instantiating an OpenAI-compatible client and performing a test chat completion, translating auth/rate-limit/network errors into user-facing warnings with JSON payload parsing. Chat adapter configures ChatOpenAI with Qianfan's base URL and API key, customizes retry behavior (non-retryable auth errors, retryable rate-limits), and maps provider exceptions to structured messages. Global lifecycle ensures dependencies, constructs the client, and clears it on shutdown.
Service Definition with Profiles and UI Fields
nodes/src/nodes/llm_baidu_qianfan/services.json
Declares the node as an LLM provider with pipe routing from questions to answers. Defines preconfig model profiles (default ernie-4-5-turbo-128k, plus variants and custom), with per-profile token limits, context windows, and selectable base URL. Configurable fields control model selection and token boundaries. Conditional profile mapping exposes relevant config properties. Includes mock test case validating responses.
Documentation and Public Registration
nodes/src/nodes/llm_baidu_qianfan/README.md, docs/README-nodes.md, tools/SYNC_MODELS.md
Node README describes ERNIE models via Qianfan's OpenAI-compatible API and required fields (model, API key, optional base URL). LLM Providers tables in user and operator docs register the new node and document the ROCKETRIDE_BAIDU_QIANFAN_KEY environment variable.
Model Sync Provider: Handler and Configuration
tools/src/providers/baidu_qianfan.py, tools/src/sync_models.config.json, tools/src/sync_models.py
BaiduQianfanProvider creates OpenAI-compatible clients and fetches available ERNIE models. sync_models.config.json defines provider endpoint, auth, model filtering rules (ernie- prefix, excluding embedding/rerank/image families), protected profile keys, context windows, and per-model token limit overrides. sync_models.py registers the provider and services.json path.
Tests: Infrastructure, Validation, and Live Sync
nodes/test/framework/pipeline.py, nodes/test/test_baidu_qianfan_global_validation.py, tools/test/markers.py, tools/test/test_baidu_qianfan_provider.py, tools/test/test_sync_live.py
Mock credentials support test mode. IGlobal validation tests verify correct error warnings for auth and rate-limit failures via stubbed openai exceptions. Provider registration test confirms handler and services.json path. Provider endpoint test validates OpenAI-compatible client construction with correct base URL. Live sync test (guarded by environment variable marker) verifies configured ERNIE profiles exist in live API.

Sequence Diagram

sequenceDiagram
  participant Framework
  participant IGlobal
  participant ChatAdapter
  participant QianfanAPI

  Framework->>IGlobal: validateConfig()
  IGlobal->>ChatAdapter: build OpenAI-compatible client
  ChatAdapter->>QianfanAPI: chat.completions.create (probe)
  QianfanAPI-->>ChatAdapter: response / error
  ChatAdapter-->>IGlobal: return or mapped exception
  IGlobal-->>Framework: emit warning or success
  Framework->>IGlobal: beginGlobal()
  IGlobal->>ChatAdapter: instantiate Chat and store in bag
  Framework->>IGlobal: endGlobal()
  IGlobal->>ChatAdapter: clear chat reference
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

module:ui

Suggested reviewers

  • jmaionchi
  • stepmikhaylov
  • Rod-Christensen

🐰 I hopped through code to add ERNIE's light,
Chat adapters stitched and profiles bright,
Tests in place and docs in line,
A Qianfan node, ready to shine. ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 26.92% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the primary change: adding a dedicated Baidu Qianfan ERNIE LLM node to the nodes framework.
Linked Issues check ✅ Passed All code objectives from #1005 are met: node runtime implementation (IGlobal, IInstance, qianfan_client), services.json profiles, provider tooling integration, tests, and documentation.
Out of Scope Changes check ✅ Passed All changes align with the stated scope of adding the Baidu Qianfan node, provider integration, and related testing/documentation infrastructure.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@github-actions github-actions Bot added docs Documentation module:nodes Python pipeline nodes module:ui Chat UI and Dropper UI labels May 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

No description provided.

@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.

Actionable comments posted: 1

🤖 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 `@nodes/src/nodes/llm_baidu_qianfan/qianfan_client.py`:
- Around line 69-97: The APIConnectionError checks in is_retryable_error and
map_exception are unreachable because APIConnectionError subclasses APIError;
update both methods (is_retryable_error and map_exception) to check for
APIConnectionError before checking for APIError, preserving the existing return
values/messages for AuthenticationError, RateLimitError, APIConnectionError, and
APIError so connection-specific logic runs as intended.
🪄 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7130dc6d-1b61-4157-9c57-faedc6e54c80

📥 Commits

Reviewing files that changed from the base of the PR and between a57a379 and 72734c7.

⛔ Files ignored due to path filters (1)
  • packages/shared-ui/src/assets/nodes/baidu-qianfan.svg is excluded by !**/*.svg
📒 Files selected for processing (17)
  • docs/README-nodes.md
  • nodes/src/nodes/llm_baidu_qianfan/IGlobal.py
  • nodes/src/nodes/llm_baidu_qianfan/IInstance.py
  • nodes/src/nodes/llm_baidu_qianfan/README.md
  • nodes/src/nodes/llm_baidu_qianfan/__init__.py
  • nodes/src/nodes/llm_baidu_qianfan/qianfan_client.py
  • nodes/src/nodes/llm_baidu_qianfan/requirements.txt
  • nodes/src/nodes/llm_baidu_qianfan/services.json
  • nodes/test/framework/pipeline.py
  • packages/shared-ui/src/components/canvas/util/get-icon-path.ts
  • tools/SYNC_MODELS.md
  • tools/src/providers/baidu_qianfan.py
  • tools/src/sync_models.config.json
  • tools/src/sync_models.py
  • tools/test/markers.py
  • tools/test/test_baidu_qianfan_provider.py
  • tools/test/test_sync_live.py

Comment thread nodes/src/nodes/llm_baidu_qianfan/qianfan_client.py

@asclearuc asclearuc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks @jimmyzhuu — this is a clean, complete provider integration (node runtime, ERNIE profiles, model-sync tooling, tests, and icon), and it follows the existing OpenAI-compatible node pattern well.

Before it can merge it needs a rebase onto develop, because #926 changed how node icons work and it rewrote the exact files your PR touches under packages/. Points to pay attention to during the rebase:

  • packages/shared-ui/src/assets/nodes/ no longer exists. Move your baidu-qianfan.svg to nodes/src/nodes/llm_baidu_qianfan/baidu-qianfan.svg (next to services.json). Keep "icon": "baidu-qianfan.svg" in services.json unchanged — only the file location moves.
  • get-icon-path.ts is gone, replaced by Icon.tsx, which auto-discovers nodes/src/nodes/**/*.svg at build time. Drop all your changes to it — there is no manual icon registration anymore.
  • THEME_DYNAMIC_ICONS is gone. Theming is now automatic: a build step rewrites single-color SVGs to currentColor (so they follow the light/dark theme) and passes multicolor logos through unchanged. Your note about keeping Baidu out of the dynamic set no longer applies — instead, make sure the Baidu SVG is genuinely multicolor if you want it to keep its brand blue, otherwise it will be theme-tinted.
  • docs/README-nodes.md was also edited by #926 — expect a conflict there and resolve it.

After rebasing, please run builder shared-ui:test and the icon audit (node scripts/audit-icons.mjs); the audit asserts every services.json icon exists inside its node folder.

There are also a few code findings to address for a clean PR — see the inline comments below. CodeRabbit's notes are worth a pass too.

Comment thread nodes/src/nodes/llm_baidu_qianfan/IGlobal.py
Comment thread nodes/src/nodes/llm_baidu_qianfan/services.json
@jimmyzhuu
jimmyzhuu force-pushed the feat/RR-1005-add-baidu-qianfan-llm branch from 89a5bc7 to 07af0f2 Compare June 2, 2026 00:12
@github-actions github-actions Bot removed the module:ui Chat UI and Dropper UI label Jun 2, 2026
@jimmyzhuu

Copy link
Copy Markdown
Contributor Author

@asclearuc Thanks for your detailed review! Rebased this PR onto the latest develop and resolved the #926 icon-system changes:

  • Moved baidu-qianfan.svg next to the Qianfan node under nodes/src/nodes/llm_baidu_qianfan/.
  • Dropped the legacy shared-ui icon resolver/asset changes from the old branch shape.
  • Resolved the docs/README-nodes.md conflict.
  • Addressed the two inline findings: validateConfig() exception ordering now preserves the specific auth/rate-limit warnings, and Base URL is a labeled China/International enum. The international endpoint was verified against official Baidu AI Cloud Qianfan docs before being added.

Verification run locally:

  • PATH=/private/tmp/rocketride-pnpm10:$PATH ./builder shared-ui:test — passed, 19 tests.
  • node scripts/audit-icons.mjs — exit 0; existing unrelated fallback-icon warnings only.
  • PYTHONPATH=nodes/src uv run --with pytest --with pytest-asyncio --with pytest-timeout --with pytest-xdist --with pytest-mock pytest nodes/test/test_baidu_qianfan_global_validation.py -v — passed, 2 tests.
  • PYTHONPATH=nodes/src uv run --with pytest --with pytest-asyncio --with pytest-timeout --with pytest-xdist --with pytest-mock --with json5 --with requests --with httpx --with openai pytest nodes/test/test_contracts.py -k llm_baidu_qianfan -v — passed, 2 tests.
  • PYTHONPATH=tools/src pytest tools/test/test_baidu_qianfan_provider.py -v — passed, 2 tests.
  • PYTHONPATH=tools/src uv run --with pytest --with json5 --with openai pytest tools/test/test_sync_live.py -k baidu_qianfan -v — skipped as expected without ROCKETRIDE_BAIDU_QIANFAN_KEY.
  • python -m py_compile nodes/src/nodes/llm_baidu_qianfan/IGlobal.py nodes/src/nodes/llm_baidu_qianfan/qianfan_client.py tools/src/providers/baidu_qianfan.py — passed.
  • git diff --check origin/develop...HEAD — passed.

@asclearuc asclearuc left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks @jimmyzhuu — good progress: the rebase onto develop is clean (icon co-located, no packages/ changes), and the validateConfig exception-ordering fix from the last round is correct and now has a focused regression test.

This PR can be merged only once CI is fully green. Right now it's red:

  1. 🔴 CI — new validation tests fail on all 3 platforms (macOS / Windows / Linux). Check how other nodes run tests. As a clue - builder test starts from the root folder.

  2. 🔴 CI — ruff format --check fails.

Non-blocking nit: please run (and confirm that it works) one save-time validation against ernie-5.0-thinking-preview with a real key, since the max_tokens=1 probe can false-fail on reasoning models.

@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.

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 `@nodes/src/nodes/llm_baidu_qianfan/IGlobal.py`:
- Around line 68-80: The validation for modelTotalTokens in the IGlobal logic
currently compares config-derived modelTotalTokens directly (modelTotalTokens <=
0) which can raise TypeError for non-numeric strings; update the checks in the
block handling modelTotalTokens (and the identical logic around lines 122-124)
to normalize/coerce the value to an int first (e.g., attempt
int(modelTotalTokens) inside a safe try/except), treat non-coercible values as
invalid and call warning('Token limit must be greater than 0'), and only perform
the <= 0 numeric check on the successfully parsed integer to avoid TypeError and
surface a clean validation warning instead of an exception.
- Around line 141-155: The _format_error function can return just "Error
{status}:" when emsg/etype are missing; update _format_error (parameters status,
etype, emsg, fallback) so that if only a status was parsed (i.e., parts contains
only the status token) you include the provided fallback message (either replace
the bare status output with fallback or append fallback to parts) before
collapsing whitespace and truncating; keep the existing regex whitespace
normalization and 500-char truncation behavior.
🪄 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: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 453f382c-b97b-4c8c-8813-70b14075a16b

📥 Commits

Reviewing files that changed from the base of the PR and between 89a5bc7 and 3f10ba8.

⛔ Files ignored due to path filters (1)
  • nodes/src/nodes/llm_baidu_qianfan/baidu-qianfan.svg is excluded by !**/*.svg
📒 Files selected for processing (17)
  • docs/README-nodes.md
  • nodes/src/nodes/llm_baidu_qianfan/IGlobal.py
  • nodes/src/nodes/llm_baidu_qianfan/IInstance.py
  • nodes/src/nodes/llm_baidu_qianfan/README.md
  • nodes/src/nodes/llm_baidu_qianfan/__init__.py
  • nodes/src/nodes/llm_baidu_qianfan/qianfan_client.py
  • nodes/src/nodes/llm_baidu_qianfan/requirements.txt
  • nodes/src/nodes/llm_baidu_qianfan/services.json
  • nodes/test/framework/pipeline.py
  • nodes/test/test_baidu_qianfan_global_validation.py
  • tools/SYNC_MODELS.md
  • tools/src/providers/baidu_qianfan.py
  • tools/src/sync_models.config.json
  • tools/src/sync_models.py
  • tools/test/markers.py
  • tools/test/test_baidu_qianfan_provider.py
  • tools/test/test_sync_live.py

Comment thread nodes/src/nodes/llm_baidu_qianfan/IGlobal.py Outdated
Comment thread nodes/src/nodes/llm_baidu_qianfan/IGlobal.py

@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.

♻️ Duplicate comments (2)
nodes/src/nodes/llm_baidu_qianfan/IGlobal.py (2)

69-80: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Normalize modelTotalTokens before comparing it.

Config.getNodeConfig(...) returns untyped input, so values like '128000' or 'abc' still make modelTotalTokens <= 0 raise TypeError. That falls through to the outer except Exception and surfaces a raw Python error instead of the intended validation warning. Parse to int first and reject non-numeric values with the same user-facing warning.

🤖 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 `@nodes/src/nodes/llm_baidu_qianfan/IGlobal.py` around lines 69 - 80, The value
returned into modelTotalTokens (from config.get('modelTotalTokens')) must be
normalized to an integer before comparing; update the validation in IGlobal.py
so that you attempt to coerce modelTotalTokens to int (catching
ValueError/TypeError) and if coercion fails or the resulting integer is <= 0
emit the same warning('Token limit must be greater than 0') and return,
otherwise proceed using the parsed int; reference the modelTotalTokens variable
and the existing warning call to locate where to add the int() conversion and
error handling.

142-152: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Keep the fallback text when parsing yields only an HTTP status.

If APIStatusError.response.json() has no structured error/message, _format_error() still returns only Error 4xx: / Error 5xx: here and drops str(e). That makes provider-side validation failures much less actionable than the raw fallback you already have available.

🤖 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 `@nodes/src/nodes/llm_baidu_qianfan/IGlobal.py` around lines 142 - 152, The
_format_error function currently drops the fallback when only a status is
present; change the final assembly so that if only status is available (status
set but both etype and emsg are falsey) the returned message includes the
fallback text (e.g., "Error {status}: {fallback}") instead of just "Error
{status}:"; update the logic around variables status, etype, emsg, and fallback
in _format_error to append or merge fallback when no structured error/message
exists so callers still see the raw exception text.
🤖 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.

Duplicate comments:
In `@nodes/src/nodes/llm_baidu_qianfan/IGlobal.py`:
- Around line 69-80: The value returned into modelTotalTokens (from
config.get('modelTotalTokens')) must be normalized to an integer before
comparing; update the validation in IGlobal.py so that you attempt to coerce
modelTotalTokens to int (catching ValueError/TypeError) and if coercion fails or
the resulting integer is <= 0 emit the same warning('Token limit must be greater
than 0') and return, otherwise proceed using the parsed int; reference the
modelTotalTokens variable and the existing warning call to locate where to add
the int() conversion and error handling.
- Around line 142-152: The _format_error function currently drops the fallback
when only a status is present; change the final assembly so that if only status
is available (status set but both etype and emsg are falsey) the returned
message includes the fallback text (e.g., "Error {status}: {fallback}") instead
of just "Error {status}:"; update the logic around variables status, etype,
emsg, and fallback in _format_error to append or merge fallback when no
structured error/message exists so callers still see the raw exception text.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7b958ae3-e6ae-4345-8ab1-29826783b088

📥 Commits

Reviewing files that changed from the base of the PR and between 3f10ba8 and cd37f1b.

📒 Files selected for processing (2)
  • nodes/src/nodes/llm_baidu_qianfan/IGlobal.py
  • nodes/test/test_baidu_qianfan_global_validation.py

@jimmyzhuu

Copy link
Copy Markdown
Contributor Author

@asclearuc Hi Alexandru, addressed the CI blockers and validation nit.

  • Fixed the cwd-dependent validation test path and ruff formatting.
  • Verified ernie-5.0-thinking-preview save-time validation with a real key: max_tokens=1 false-failed, while max_tokens=8 succeeded, so the probe now uses 8.
  • Also fixed the latest CodeRabbit validation nits.

Local checks passed: Qianfan validation tests, ruff check/format, contract/provider tests, py_compile, and icon audit.

Thanks!
:)

@asclearuc
asclearuc merged commit 64ebf8c into rocketride-org:develop Jun 4, 2026
42 of 46 checks passed
@asclearuc

Copy link
Copy Markdown
Collaborator

@jimmyzhuu Thank you for the contribution!

kwit75 pushed a commit that referenced this pull request Jul 2, 2026
) (#1234)

embedding_transformer (miniLM) and embedding_video (openai-patch16)
download model weights from huggingface.co while test_dynamic.py runs, so
when the HF hub is unreachable or rate-limited they fail and turn the only
required check (ci-ok) red — on PRs unrelated to embeddings. This has hit
docs-only PRs, the Baidu Qianfan #1006 run, and the 2026-06-04 release prep.

Add both to the existing skip_nodes set in conftest.py, matching the
embedding_image precedent (same heavy-model category). They remain runnable
on demand via ROCKETRIDE_INCLUDE_SKIP=embedding_transformer,embedding_video.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation module:nodes Python pipeline nodes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Baidu Qianfan ERNIE LLM node

2 participants