Skip to content

Default web/fetch max_chars to a tenth of the calling model's context window - #18

Open
sharmis-tp wants to merge 1 commit into
cppalliance:masterfrom
sharmis-tp:issue-7-max-chars-v2
Open

sharmis-tp wants to merge 1 commit into
cppalliance:masterfrom
sharmis-tp:issue-7-max-chars-v2

Conversation

@sharmis-tp

Copy link
Copy Markdown
Collaborator

For #7.

When a call leaves max_chars out, web/fetch now takes the default from the context in ToolCall::model: a tenth of the window at about four characters a token, so context * 2 / 5, and never over the ceiling of 40,000.

context default max_chars
8,000 3,200
32,768 13,107
100,000 or more 40,000
no model, or no positive whole context 40,000, as before

A max_chars the call names still wins, up to the ceiling. The schema stays the same for every model. Its max_chars description gains one sentence about the default.

Tests: unit tests cover the rule and unusable context values. A Pack test through the SDK's fake Host covers a small model, a large model, a script call, and a small model that names max_chars. It fails when the model is not passed through. All 182 tests, fmt, clippy and docs pass on Linux.

Two questions:

  1. Is a tenth of the window the share you want?
  2. The fallback from Fall back to the whole page when the article is a small part of it #8 uses the whole page only when it fits in max_chars, so a lower default makes it rarer. With an 8,000-token window, a short fragment of a page over 3,200 characters is kept, where before the whole page was returned. Should the fallback keep using the ceiling, or is the article the right choice for a small window?

This leaves out the description-only render, as I suggested in #7. If you agree, this closes #7.

@coderabbitai

coderabbitai Bot commented Dec 3, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 481784eb-771a-4ec8-bbfb-a1415ee6272e
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Render web/fetch and web/search for the model of a section

1 participant