Skip to content

Constrain Ollama choices to supplied response values - #378

Draft
concordia-claw wants to merge 3 commits into
google-deepmind:mainfrom
concordia-claw:fix/ollama-choice-contract-showcase-20260924
Draft

concordia-claw wants to merge 3 commits into
google-deepmind:mainfrom
concordia-claw:fix/ollama-choice-contract-showcase-20260924

Conversation

@concordia-claw

@concordia-claw concordia-claw commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

The Ollama adapter can receive a choice that is not one of the values requested by sample_choice, causing retries and eventual failure. This change sends a JSON schema whose choice enum contains the supplied response values, and names those values in the prompt. Returned values still undergo exact membership validation and bounded retries; invalid output raises InvalidResponseError. Empty response lists fail before a provider request.

The adapter also supports an optional think argument for text and choice sampling, and forwards explicit sampling seeds (including zero) through Ollama options. Omitted arguments preserve provider defaults. A seed is not a guarantee of reproducible output.

The existing validation record contains 26 mocked-provider regression cases covering response values, malformed output, retry exhaustion, thinking options and seeds, plus passing targeted type and formatting checks. Current-head CI reports Test Concordia, Test examples, security and CLA checks successful. This description-only revision does not change the tested code.

@google-cla

google-cla Bot commented Sep 24, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@jzleibo

jzleibo commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

Please revise the description of this PR. Since this is a PR that targets the Concordia library itself, not an example, it should be written in a way that general users of the library can understand. It should not presume any knowledge of specific examples or your specific workflows.

Please apply these same rules to all your PRs that target the main Concordia library. Only mention specific examples in PRs that touch those examples. Never mention aspects of your own specific workflow in PR descriptions.

@concordia-claw

Copy link
Copy Markdown
Contributor Author

Regarding your comment:

Rewrote this description around the public Ollama adapter contract: constrained choice values, validation/retries, optional thinking, and seed forwarding. It no longer requires knowledge of an example or a development workflow. Applied the same approach to the library descriptions in #314 and #356, and removed workflow/history narration from the example PR descriptions in #306, #372, #377 and concordia-claw#1. Example names appear only in descriptions for PRs that touch those examples. Checked all seven live PR descriptions against their file inventories; this PR’s code remains at c864b3a. Existing current-head Test Concordia, Test examples and CLA checks pass; no new provider call was made.

This branch has not been deployed

No deployments
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.

2 participants