-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add optional header field to ask_user across all SDKs
#1624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,6 +28,9 @@ public class UserInputRequest { | |
| @JsonProperty("question") | ||
| private String question; | ||
|
|
||
| @JsonProperty("header") | ||
| private String header; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Java code correctly gains Consider adding a "User Input Requests" section to var session = client.createSession(new SessionConfig()
.setModel("gpt-5")
.setOnUserInputRequest((request, invocation) -> {
// request.getQuestion() - The question to ask
// request.getHeader() - Optional short title suitable as a dialog title
// request.getChoices() - Optional list of choices for multiple choice
// request.isAllowFreeform() - Whether freeform input is allowed (default: true)
return CompletableFuture.completedFuture(
new UserInputResponse().setAnswer("User's answer here").setWasFreeform(true)
);
})).get(); |
||
|
|
||
| @JsonProperty("choices") | ||
| private List<String> choices; | ||
|
|
||
|
|
@@ -55,6 +58,28 @@ public UserInputRequest setQuestion(String question) { | |
| return this; | ||
| } | ||
|
|
||
| /** | ||
| * Gets the optional short title summarizing the question, suitable for display | ||
| * as the dialog header/title. | ||
| * | ||
| * @return the header text, or {@code null} if not specified | ||
| */ | ||
| public String getHeader() { | ||
| return header; | ||
| } | ||
|
|
||
| /** | ||
| * Sets the optional short title summarizing the question. | ||
| * | ||
| * @param header | ||
| * the header text | ||
| * @return this instance for method chaining | ||
| */ | ||
| public UserInputRequest setHeader(String header) { | ||
| this.header = header; | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| * Gets the optional choices for multiple choice questions. | ||
| * | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
.NETcode is updated here, butdotnet/README.mdline 807 still documents onlyquestion,choices, andallowFreeformin theOnUserInputRequestexample. All other SDK READMEs (Node, Python, Go, Rust) were updated to mentionheader— .NET is the odd one out.Suggested addition at
dotnet/README.mdline 808 (after// request.Question - ...):// request.Header - Optional short title summarizing the question (suitable as a dialog title)