Skip to content

Add tuple overloads for Choice and System One questions - #5

Merged
kblok merged 2 commits into
mainfrom
cursor/tuple-call-site-overloads-33c0
Sep 20, 2026
Merged

kblok merged 2 commits into
mainfrom
cursor/tuple-call-site-overloads-33c0

Conversation

@kblok

@kblok kblok commented Sep 20, 2026 •

Copy link
Copy Markdown
Member

Yes — for the call sites. Nested Dictionary<string, object?> / Dictionary<string, Question> initializers were the noisy part compared to Question.Score’s params form. Tuples belong at those construction sites, not as the stored model: Choice criteria and answers are maps on the wire, and GetChoice("name") still needs named lookup.

What changed

Convenience overloads convert labeled pairs into dictionaries (duplicate keys throw TypeSafeException):

var response = await client.SystemOneAsync(
    new { document = "I was charged twice. Please fix this ASAP." },
    ("category", Question.Choice("What is this ticket about?",
        ("billing", null),
        ("technical", null),
        ("other", null))));
  • Question.Choice(instructions, params (string Label, object? Description)[])
  • client.SystemOneAsync(state, params (string Name, Question Question)[]) (and WithResponse)
  • Question.Map(...) when you still need a dictionary (model, options, CancellationToken, or SystemOneRequest.Questions)

Existing dictionary overloads are unchanged. ChoiceQuestion.Criteria remains IReadOnlyDictionary<string, object?>.

Noul criteria stay a small type (NoulCriteria.Yes / .No omit a side on the wire); a 2-tuple would lose that. JSON DTOs are also unchanged.

Version

MinVerMinimumMajorMinor is now 0.2, so untagged packs are 0.2.0-preview.*. After merge, tag v0.2.0 on main to publish the stable package (per CONTRIBUTING).

Open in Web Open in Cursor 

cursoragent and others added 2 commits September 20, 2026 18:58
Nested Dictionary initializers made the common Choice and SystemOne
call sites much noisier than Score's params form. Accept labeled pairs
at those call sites, convert them to maps, and keep dictionaries as the
stored/wire representation.

Co-authored-by: Darío Kondratiuk <dariokondratiuk@gmail.com>
The tuple call-site overloads are a minor API addition. Raise
MinVerMinimumMajorMinor so untagged packs are 0.2.0-preview.* until
v0.2.0 is tagged on main.

Co-authored-by: Darío Kondratiuk <dariokondratiuk@gmail.com>
@kblok
kblok marked this pull request as ready for review September 20, 2026 19:04
@kblok
kblok merged commit caf6b29 into main Sep 20, 2026
1 check passed
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