Package com.github.copilot.sdk.json
Interface ElicitationHandler
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Functional interface for handling elicitation requests from the server.
Register an elicitation handler via
SessionConfig.setOnElicitationRequest(ElicitationHandler) or
ResumeSessionConfig.setOnElicitationRequest(ElicitationHandler). When
provided, the server routes elicitation requests to this handler and reports
elicitation as a supported capability.
Example Usage
ElicitationHandler handler = context -> {
// Show the form to the user and collect responses
Map<String, Object> formValues = showForm(context.getMessage(), context.getRequestedSchema());
return CompletableFuture.completedFuture(
new ElicitationResult().setAction(ElicitationResultAction.ACCEPT).setContent(formValues));
};
- Since:
- 1.0.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionhandle(ElicitationContext context) Handles an elicitation request from the server.
-
Method Details
-
handle
Handles an elicitation request from the server.- Parameters:
context- the elicitation context containing the message, schema, and mode- Returns:
- a future that resolves with the elicitation result
-