Skip to content

Fix several HasNext() that should rely on response.HasMore#182

Open
xoofx wants to merge 14 commits intoanthropics:nextfrom
xoofx:fix-HasNext-to-use-HasMore
Open

Fix several HasNext() that should rely on response.HasMore#182
xoofx wants to merge 14 commits intoanthropics:nextfrom
xoofx:fix-HasNext-to-use-HasMore

Conversation

@xoofx
Copy link
Copy Markdown
Contributor

@xoofx xoofx commented Apr 22, 2026

When trying the API on Kimi 2.6 provider, I discovered that the ModelListPage.cs with HasNext() was looping forever (and eventually failed).

Their LastId is not null and always equal to the FirstId. While the HasMore of the response is correctly set.

This PR is addressing this by replacing all HasNext() for which we can use a response.HasMore instead.

@xoofx xoofx requested a review from a team as a code owner April 22, 2026 05:52
stainless-app Bot and others added 7 commits April 23, 2026 21:09
- Filter sessions by attached memory store: GET /v1/sessions accepts a new
  optional `memory_store_id` query param
- BetaListUserProfilesResponse always returns `next_page` (now non-nullable
  in SDK types)
- Allow `max_tokens: 0` on message creation (previously rejected as below
  minimum)
- Rename "BYOC" to "self-hosted" in environment config docs
- Improve SDK reference docs: human-readable method summaries (e.g.
  "Delete a memory store"), richer parameter and field descriptions, and
  fuller enum docs across the managed-agents-memory beta
- CLI: accept `id` as an alias for memory-store, memory, agent, session,
  vault, environment, and credential identifiers on update commands for
  easier piping from stdin
@xoofx xoofx force-pushed the fix-HasNext-to-use-HasMore branch from 427f880 to d0930c3 Compare April 29, 2026 19:37
xoofx and others added 4 commits April 29, 2026 16:20
* feat(memory): add beta memory tool

* chrore: update memory tool example
…ck (anthropics#183)

When HostedFileContent has an image MediaType (e.g. image/png), map it to BetaImageBlockParam with BetaFileImageSource instead of always using BetaRequestDocumentBlock with BetaFileDocumentSource. This mirrors the OpenAI Responses adapter pattern (dotnet/extensions L1110-1117) and allows users to send hosted file images via MEAI abstractions without dropping down to RawRepresentation.

Applied in both user message content conversion and tool result content conversion paths.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sd-st
Copy link
Copy Markdown
Collaborator

sd-st commented Apr 30, 2026

Is this reproducible on Anthropic's API?

@xoofx
Copy link
Copy Markdown
Contributor Author

xoofx commented Apr 30, 2026

Is this reproducible on Anthropic's API?

I don't think so because the .NET SDK was built with the behavior of Anthropic endpoint.

I just tested it with an Anthropic endpoint and has_more seems to be correctly reported.

As has_more is part of the API and is explicitly stated to be used for pagination. I don't know why the previous pattern return this.Items.Count > 0 && response.LastID != null; was used, but it can break with other providers (e.g. LastId is never null and == FirstId, to it loops)

@xoofx xoofx force-pushed the fix-HasNext-to-use-HasMore branch from d0930c3 to 5f0597d Compare April 30, 2026 19:05
@xoofx
Copy link
Copy Markdown
Contributor Author

xoofx commented Apr 30, 2026

I have rebased on latest next branch.

@xoofx
Copy link
Copy Markdown
Contributor Author

xoofx commented May 4, 2026

Hello, would it be possible to merge this PR? It is blocking the usage of Anthropic API with other model providers. I have to maintain a fork of this project and add it to my projects locally in order to get this fix.

@sd-st
Copy link
Copy Markdown
Collaborator

sd-st commented May 4, 2026

@xoofx Hey sorry, just bringing this up with the team internally given that this only affects a 3rd party API.

@xoofx
Copy link
Copy Markdown
Contributor Author

xoofx commented May 4, 2026

@xoofx Hey sorry, just bringing this up with the team internally given that this only affects a 3rd party API.

Ok, thanks. In case this is not accepted, I would like to understand why the existing code is not using has_more (the rationale, was it not working before? was it introduced after?). If really that doesn't make it that's ok, I will fork the project in my own project, annoying but workaround-able. 🙂

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.

5 participants