Skip to main content
View source

Baidu Qianfan

View as Markdown

A RocketRide LLM node that calls Baidu Qianfan ERNIE chat models through Qianfan's OpenAI-compatible chat-completions API.

What it does

Connects a pipeline to Baidu Qianfan ERNIE large language models for chat-based text generation, question answering, summarization, and Chinese-language enterprise AI workflows. Questions arriving on the questions lane are answered by the configured ERNIE model and emitted on the answers lane.

Uses langchain-openai (ChatOpenAI) over the openai Python SDK, pointed at Qianfan's OpenAI-compatible endpoint. Temperature is fixed at 0 for deterministic output, and generation is capped at the profile's output-token limit.

When you save the node configuration, the node validates it live: it sends a tiny test completion ("Hi", max 8 tokens) to the configured endpoint and surfaces a specific warning for an invalid API key, an empty model name, a non-positive token limit, a rate limit, an unreachable base URL, or any other API error.

At runtime, rate-limit and connection errors are treated as retryable; authentication and other API errors fail immediately with a user-facing message.


Configuration

Lanes

LaneDirectionDescription
questionsinputPrompts / questions to send to the model
answersoutputModel completions

Fields

The node is configured through a single Model profile selector plus the fields that profile exposes.

FieldTypeDescription
modelstringBaidu Qianfan model name
modelTotalTokensnumberMaximum context length in tokens
modelOutputTokensnumberMaximum generated tokens
serverbasestringDefault "https://qianfan.baidubce.com/v2". Qianfan OpenAI-compatible API endpoint.
profilestringDefault "ernie-4-5-turbo-128k". Baidu Qianfan model selection

Model profiles

ProfileModelContext tokensOutput tokens
ERNIE 4.5 Turbo 128K (default)ernie-4.5-turbo-128k128,0004,096
ERNIE 4.5 Turbo 32Kernie-4.5-turbo-32k32,7684,096
ERNIE 5.0 Thinking Previewernie-5.0-thinking-preview128,0008,192
Customuser-supplied32,768 (editable)4,096 (editable)

The named profiles pin the model name and token limits; only the API key, base URL, and model source are editable. The Custom profile additionally exposes model, modelTotalTokens, and modelOutputTokens so you can target any model available on your Qianfan account.


Authentication

Provide a Qianfan API key in apikey: it is required, and the node refuses to start without one. The key must have access to the selected model.

Pick the base URL matching where your key was issued:

  • China (default): https://qianfan.baidubce.com/v2
  • International: https://api.baiduqianfan.ai/v1

An invalid or unauthorized key is reported as "Baidu Qianfan API key is invalid or unauthorized" both at save-time validation and at runtime.


Schema

FieldTypeDescriptionDefault
baidu_qianfan.profilestringModel
Baidu Qianfan model selection
"ernie-4-5-turbo-128k"
baidu_qianfan.serverbasestringBase URL
Qianfan OpenAI-compatible API endpoint.
"https://qianfan.baidubce.com/v2"
modelstringModel
Baidu Qianfan model name
modelOutputTokensnumberOutput Tokens
Maximum generated tokens
modelTotalTokensnumberTokens
Maximum context length in tokens

Dependencies

  • openai
  • langchain
  • langchain-core
  • langchain-openai