Skip to content

Replace the retired gemini-2.0-flash PDF reading default - #1460

Open
pcbeingused333 wants to merge 1 commit into
SciSharp:masterfrom
pcbeingused333:fix/pdf-reading-retired-gemini-default
Open

pcbeingused333 wants to merge 1 commit into
SciSharp:masterfrom
pcbeingused333:fix/pdf-reading-retired-gemini-default

Conversation

@pcbeingused333

Copy link
Copy Markdown

ReadPdfFn falls back to google-ai / gemini-2.0-flash when FileHandler:Pdf:Reading has no provider and model, and the sample appsettings.json sets the same model for PDF reading. Google shut gemini-2.0-flash down on June 1, 2026 (deprecations), so reading a PDF with the default settings now gets an error from the Gemini API.

This PR changes:

  • ReadPdfFn.GetLlmProviderModel: the fallback model is gemini-3.8-flash, the current stable Flash model.
  • src/WebStarter/appsettings.json: FileHandler:Pdf:Reading:Model and the google-ai chat model entry it points to (name, and costs per 1K tokens from Google's pricing page: $0.75 input, $0.075 cached input and $3.75 output per 1M tokens, the prices until 2026-12-31).
  • Test: ReadPdfFnDefaultModelTests checks the fallback. It needs a project reference from BotSharp.Core.UnitTests to BotSharp.Plugin.FileHandler.

The deprecations page names gemini-3.6-flash as the replacement, but gemini-3.8-flash is the current stable Flash model (Vertex AI already retires 3.6 Flash on 2026-11-19), so this PR uses 3.8.

The Google provider always sends temperature (0.0 unless the conversation state sets one). Gemini 3 accepts it, but Google recommends leaving it at the default of 1.0. This PR does not change that; FileHandler:Pdf:Reading can still point PDF reading at any other provider and model.

I left the gemini-2.0-flash-exp realtime entry and the realtime test settings alone, since they are a different model.

Tests

dotnet test tests/BotSharp.Core.UnitTests: 475 passed, 1 failed. The new test fails before the change (Expected: "gemini-3.8-flash", Actual: "gemini-2.0-flash"). The failing test is SharpCacheAgentMemoryTests.GetAgent_caches_per_scope_without_adding_shared_cache_entries; it fails the same way without this change.

This change was made with Claude Code, which also wrote the test and ran the checks above.

🤖 Generated with Claude Code

ReadPdfFn falls back to google-ai / gemini-2.0-flash when
FileHandler:Pdf:Reading has no provider and model, and the sample
appsettings.json configures the same model for PDF reading. Google shut
gemini-2.0-flash down on 2026-06-01, so reading a PDF with the default
settings returns an error from the Gemini API.

Use gemini-3.8-flash, the current stable Flash model, in the fallback and
in appsettings.json (the chat model entry and the FileHandler setting),
with its standard paid-tier prices per 1K tokens. The Google provider
sends a temperature (0.0 by default) that Gemini 3 accepts but recommends
leaving at its default.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@qodo-code-review

qodo-code-review Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Code Review by Qodo

Grey Divider

Sorry, something went wrong

We weren't able to complete the code review on our side. Please try again manually by commenting /agentic_review on this PR.

Grey Divider

Qodo Logo

@qodo-code-review

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Replace retired Gemini PDF-reading default

🐞 Bug fix 🧪 Tests ⚙️ Configuration changes 🕐 10-20 Minutes

Grey Divider

AI Description

• Replace the retired PDF-reading fallback with gemini-3.8-flash to restore default PDF reading.
• Align WebStarter’s PDF setting and Google AI model pricing with the new default.
• Add a unit test that guards the fallback provider and model.
Diagram

graph TD
  A["PDF settings"] --> B{"Provider and model?"}
  B -->|Yes| C["Configured model"] --> E["Chat completion"] --> F["Provider API"]
  B -->|No| D["Gemini 3.8 fallback"] --> E
Loading
High-Level Assessment

Updating both the code fallback and sample configuration is the appropriate scoped fix: changing only configuration would leave deployments without explicit PDF settings on the retired model. The existing ability to select another provider remains intact.

Files changed (4) +34 / -6

Bug fix (1) +1 / -1
ReadPdfFn.csUse gemini-3.8-flash for unconfigured PDF reading +1/-1

Use gemini-3.8-flash for unconfigured PDF reading

• Changes the Google AI fallback model from gemini-2.0-flash to gemini-3.8-flash. Explicitly configured provider/model pairs still take precedence.

src/Plugins/BotSharp.Plugin.FileHandler/Functions/ReadPdfFn.cs

Tests (2) +28 / -0
BotSharp.Core.UnitTests.csprojReference FileHandler from the unit-test project +2/-0

Reference FileHandler from the unit-test project

• Adds the FileHandler project reference needed to instantiate ReadPdfFn in the new regression test.

tests/BotSharp.Core.UnitTests/BotSharp.Core.UnitTests.csproj

ReadPdfFnDefaultModelTests.csGuard the PDF-reading fallback selection +26/-0

Guard the PDF-reading fallback selection

• Adds a unit test that invokes the private model-selection method with empty settings and asserts the google-ai / gemini-3.8-flash fallback.

tests/BotSharp.Core.UnitTests/Plugins/ReadPdfFnDefaultModelTests.cs

Other (1) +5 / -5
appsettings.jsonAlign sample PDF settings and model costs +5/-5

Align sample PDF settings and model costs

• Points PDF reading and its Google AI chat model entry at gemini-3.8-flash. Revises the entry’s per-1K-token input, cached-input, and output costs; the separate realtime entry is unchanged.

src/WebStarter/appsettings.json

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.

1 participant