streamRunSession method
- RunSessionRequest request,
- String session, {
- String? $fields,
Initiates a single-turn interaction with the CES agent.
Uses server-side streaming to deliver incremental results and partial responses as they are generated. By default, complete responses (e.g., messages from callbacks or full LLM responses) are sent to the client as soon as they are available. To enable streaming individual text chunks directly from the model, set enable_text_streaming to true.
request - The metadata request object.
Request parameters:
session - Required. The unique identifier of the session. Format:
projects/{project}/locations/{location}/apps/{app}/sessions/{session}
Value must have pattern
^projects/\[^/\]+/locations/\[^/\]+/apps/\[^/\]+/sessions/\[^/\]+$.
$fields - Selector specifying which fields to include in a partial
response.
Completes with a RunSessionResponse.
Completes with a commons.ApiRequestError if the API endpoint returned an error.
If the used http.Client completes with an error when making a REST call,
this method will complete with the same error.
Implementation
async.Future<RunSessionResponse> streamRunSession(
RunSessionRequest request,
core.String session, {
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
'fields': ?$fields == null ? null : [$fields],
};
final url_ = 'v1/' + core.Uri.encodeFull('$session') + ':streamRunSession';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return RunSessionResponse.fromJson(
response_ as core.Map<core.String, core.dynamic>,
);
}