Session service provides APIs for interacting with CES agents. v1
Package
@google-cloud/cesConstructors
(constructor)(opts, gaxInstance)
constructor
(
opts
?:
ClientOptions
,
gaxInstance
?:
typeof
gax
|
typeof
gax
.
fallback
);
Construct an instance of SessionServiceClient.
opts
ClientOptions
gaxInstance
typeof gax
| typeof fallback
: loaded instance of google-gax
. Useful if you need to avoid loading the default gRPC version and want to use the fallback HTTP implementation. Load only fallback version and pass it to the constructor: ``` const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC const client = new SessionServiceClient({fallback: true}, gax); ```
Properties
apiEndpoint
get
apiEndpoint
()
:
string
;
The DNS address for this API service.
apiEndpoint
static
get
apiEndpoint
()
:
string
;
The DNS address for this API service - same as servicePath.
auth
auth
:
gax
.
GoogleAuth
;
descriptors
descriptors
:
Descriptors
;
innerApiCalls
innerApiCalls
:
{
[
name
:
string
]
:
Function
;
};
locationsClient
locationsClient
:
LocationsClient
;
pathTemplates
pathTemplates
:
{
[
name
:
string
]
:
gax
.
PathTemplate
;
};
port
static
get
port
()
:
number
;
The port for this API service.
scopes
static
get
scopes
()
:
string
[];
The scopes needed to make gRPC calls for every method defined in this service.
servicePath
static
get
servicePath
()
:
string
;
The DNS address for this API service.
sessionServiceStub
sessionServiceStub
?:
Promise
< {
[
name
:
string
]
:
Function
;
}>;
universeDomain
get
universeDomain
()
:
string
;
warn
warn
:
(
code
:
string
,
message
:
string
,
warnType
?:
string
)
=
>
void
;
Methods
agentPath(project, location, app, agent)
agentPath
(
project
:
string
,
location
:
string
,
app
:
string
,
agent
:
string
)
:
string
;
Return a fully-qualified agent resource name string.
project
string
location
string
app
string
agent
string
string
{string} Resource name string.
appPath(project, location, app)
appPath
(
project
:
string
,
location
:
string
,
app
:
string
)
:
string
;
Return a fully-qualified app resource name string.
project
string
location
string
app
string
string
{string} Resource name string.
appVersionPath(project, location, app, version)
appVersionPath
(
project
:
string
,
location
:
string
,
app
:
string
,
version
:
string
)
:
string
;
Return a fully-qualified appVersion resource name string.
project
string
location
string
app
string
version
string
string
{string} Resource name string.
bidiRunSession(options)
bidiRunSession
(
options
?:
CallOptions
)
:
gax
.
CancellableStream
;
Establishes a bidirectional streaming connection with the CES agent. The agent processes continuous multimodal inputs (e.g., text, audio) and generates real-time multimodal output streams.
--- Client Request Stream --- The client streams requests in the following order:
-
Initialization: The first message must contain SessionConfig . For audio sessions, this should also include and to define audio processing and synthesis parameters.
-
Interaction: Subsequent messages stream containing real-time user input data.
-
Termination: The client should half-close the stream when there is no more user input. It should also half-close upon receiving or from the agent.
--- Server Response Stream --- For each interaction turn, the agent streams messages in the following sequence:
-
Speech Recognition (First N messages): Contains representing the concatenated user speech segments captured so far. This is only populated for audio sessions.
-
Response (Next M messages): Contains delivering the agent's response in various modalities (e.g., text, audio).
-
Turn Completion (Final message of the turn): Contains with set to true. This signals the end of the current turn and includes with execution details.
--- Audio Best Practices --- 1. Streaming: Stream audio data **CONTINUOUSLY**, even during silence. Recommended chunk size: 40-120ms (balances latency vs. efficiency).
- Playback & Interruption: Play upon receipt. Stop playback immediately if an is received (e.g., user barge-in or new agent response).
gax.CancellableStream
{Stream} An object stream which is both readable and writable. It accepts objects representing BidiSessionClientMessage for write() method, and will emit objects representing BidiSessionServerMessage on 'data' event asynchronously. Please see the documentation for more details and examples.
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Optional. The initial config message for the session.
*/
// const config = {}
/**
* Optional. Realtime input for the session.
*/
// const realtimeInput = {}
// Imports the Ces library
const
{
SessionServiceClient
}
=
require
(
' @google-cloud/ces
'
).
v1
;
// Instantiates a client
const
cesClient
=
new
SessionServiceClient
();
async
function
callBidiRunSession
()
{
// Construct request
const
request
=
{
};
// Run request
const
stream
=
await
cesClient
.
bidiRunSession
();
stream
.
on
(
'data'
,
(
response
)
=
>
{
console
.
log
(
response
)
});
stream
.
on
(
'error'
,
(
err
)
=
>
{
throw
(
err
)
});
stream
.
on
(
'end'
,
()
=
>
{
/* API call completed */
});
stream
.
write
(
request
);
stream
.
end
();
}
callBidiRunSession
();
changelogPath(project, location, app, changelog)
changelogPath
(
project
:
string
,
location
:
string
,
app
:
string
,
changelog
:
string
)
:
string
;
Return a fully-qualified changelog resource name string.
project
string
location
string
app
string
changelog
string
string
{string} Resource name string.
close()
close
()
:
Promise<void>
;
Terminate the gRPC channel and close the client.
The client will no longer be usable and all future behavior is undefined.
Promise
<void>
{Promise} A promise that resolves when the client is closed.
conversationPath(project, location, app, conversation)
conversationPath
(
project
:
string
,
location
:
string
,
app
:
string
,
conversation
:
string
)
:
string
;
Return a fully-qualified conversation resource name string.
project
string
location
string
app
string
conversation
string
string
{string} Resource name string.
deploymentPath(project, location, app, deployment)
deploymentPath
(
project
:
string
,
location
:
string
,
app
:
string
,
deployment
:
string
)
:
string
;
Return a fully-qualified deployment resource name string.
project
string
location
string
app
string
deployment
string
string
{string} Resource name string.
examplePath(project, location, app, example)
examplePath
(
project
:
string
,
location
:
string
,
app
:
string
,
example
:
string
)
:
string
;
Return a fully-qualified example resource name string.
project
string
location
string
app
string
example
string
string
{string} Resource name string.
getLocation(request, options, callback)
getLocation
(
request
:
LocationProtos
.
google
.
cloud
.
location
.
IGetLocationRequest
,
options
?:
gax
.
CallOptions
|
Callback<LocationProtos
.
google
.
cloud
.
location
.
ILocation
,
LocationProtos
.
google
.
cloud
.
location
.
IGetLocationRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> ,
callback
?:
Callback<LocationProtos
.
google
.
cloud
.
location
.
ILocation
,
LocationProtos
.
google
.
cloud
.
location
.
IGetLocationRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
Promise<LocationProtos
.
google
.
cloud
.
location
.
ILocation
> ;
Gets information about a location.
request
LocationProtos.google.cloud.location.IGetLocationRequest
The request object that will be sent.
options
CallOptions
| Callback
< google.cloud.location.ILocation
, google.cloud.location.IGetLocationRequest
| null | undefined, {} | null | undefined>
Call options. See CallOptions for more details.
callback
Callback
< google.cloud.location.ILocation
, google.cloud.location.IGetLocationRequest
| null | undefined, {} | null | undefined>
Promise
< google.cloud.location.ILocation
>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples.
const
[
response
]
=
await
client
.
getLocation
(
request
);
getProjectId()
getProjectId
()
:
Promise<string>
;
Promise
<string>
getProjectId(callback)
getProjectId
(
callback
:
Callback<string
,
undefined
,
undefined
> )
:
void
;
callback
Callback
<string, undefined, undefined>
void
guardrailPath(project, location, app, guardrail)
guardrailPath
(
project
:
string
,
location
:
string
,
app
:
string
,
guardrail
:
string
)
:
string
;
Return a fully-qualified guardrail resource name string.
project
string
location
string
app
string
guardrail
string
string
{string} Resource name string.
initialize()
initialize
()
:
Promise
< {
[
name
:
string
]
:
Function
;
}>;
Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.
You can await on this method if you want to make sure the client is initialized.
Promise
<{
[name: string]: Function
;
}>
{Promise} A promise that resolves to an authenticated service stub.
listLocationsAsync(request, options)
listLocationsAsync
(
request
:
LocationProtos
.
google
.
cloud
.
location
.
IListLocationsRequest
,
options
?:
CallOptions
)
:
AsyncIterable<LocationProtos
.
google
.
cloud
.
location
.
ILocation
> ;
Lists information about the supported locations for this service. Returns an iterable object.
for
- await
- of
syntax is used with the iterable to get response elements on-demand.
request
LocationProtos.google.cloud.location.IListLocationsRequest
The request object that will be sent.
options
AsyncIterable
< google.cloud.location.ILocation
>
{Object} An iterable Object that allows async iteration . When you iterate the returned iterable, each element will be an object representing . The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples.
const
iterable
=
client
.
listLocationsAsync
(
request
);
for
await
(
const
response
of
iterable
)
{
// process response
}
matchAgentFromAgentName(agentName)
matchAgentFromAgentName
(
agentName
:
string
)
:
string
|
number
;
Parse the agent from Agent resource.
agentName
string
A fully-qualified path representing Agent resource.
string | number
{string} A string representing the agent.
matchAppFromAgentName(agentName)
matchAppFromAgentName
(
agentName
:
string
)
:
string
|
number
;
Parse the app from Agent resource.
agentName
string
A fully-qualified path representing Agent resource.
string | number
{string} A string representing the app.
matchAppFromAppName(appName)
matchAppFromAppName
(
appName
:
string
)
:
string
|
number
;
Parse the app from App resource.
appName
string
A fully-qualified path representing App resource.
string | number
{string} A string representing the app.
matchAppFromAppVersionName(appVersionName)
matchAppFromAppVersionName
(
appVersionName
:
string
)
:
string
|
number
;
Parse the app from AppVersion resource.
appVersionName
string
A fully-qualified path representing AppVersion resource.
string | number
{string} A string representing the app.
matchAppFromChangelogName(changelogName)
matchAppFromChangelogName
(
changelogName
:
string
)
:
string
|
number
;
Parse the app from Changelog resource.
changelogName
string
A fully-qualified path representing Changelog resource.
string | number
{string} A string representing the app.
matchAppFromConversationName(conversationName)
matchAppFromConversationName
(
conversationName
:
string
)
:
string
|
number
;
Parse the app from Conversation resource.
conversationName
string
A fully-qualified path representing Conversation resource.
string | number
{string} A string representing the app.
matchAppFromDeploymentName(deploymentName)
matchAppFromDeploymentName
(
deploymentName
:
string
)
:
string
|
number
;
Parse the app from Deployment resource.
deploymentName
string
A fully-qualified path representing Deployment resource.
string | number
{string} A string representing the app.
matchAppFromExampleName(exampleName)
matchAppFromExampleName
(
exampleName
:
string
)
:
string
|
number
;
Parse the app from Example resource.
exampleName
string
A fully-qualified path representing Example resource.
string | number
{string} A string representing the app.
matchAppFromGuardrailName(guardrailName)
matchAppFromGuardrailName
(
guardrailName
:
string
)
:
string
|
number
;
Parse the app from Guardrail resource.
guardrailName
string
A fully-qualified path representing Guardrail resource.
string | number
{string} A string representing the app.
matchAppFromSessionName(sessionName)
matchAppFromSessionName
(
sessionName
:
string
)
:
string
|
number
;
Parse the app from Session resource.
sessionName
string
A fully-qualified path representing Session resource.
string | number
{string} A string representing the app.
matchAppFromToolName(toolName)
matchAppFromToolName
(
toolName
:
string
)
:
string
|
number
;
Parse the app from Tool resource.
toolName
string
A fully-qualified path representing Tool resource.
string | number
{string} A string representing the app.
matchAppFromToolsetName(toolsetName)
matchAppFromToolsetName
(
toolsetName
:
string
)
:
string
|
number
;
Parse the app from Toolset resource.
toolsetName
string
A fully-qualified path representing Toolset resource.
string | number
{string} A string representing the app.
matchChangelogFromChangelogName(changelogName)
matchChangelogFromChangelogName
(
changelogName
:
string
)
:
string
|
number
;
Parse the changelog from Changelog resource.
changelogName
string
A fully-qualified path representing Changelog resource.
string | number
{string} A string representing the changelog.
matchConversationFromConversationName(conversationName)
matchConversationFromConversationName
(
conversationName
:
string
)
:
string
|
number
;
Parse the conversation from Conversation resource.
conversationName
string
A fully-qualified path representing Conversation resource.
string | number
{string} A string representing the conversation.
matchDeploymentFromDeploymentName(deploymentName)
matchDeploymentFromDeploymentName
(
deploymentName
:
string
)
:
string
|
number
;
Parse the deployment from Deployment resource.
deploymentName
string
A fully-qualified path representing Deployment resource.
string | number
{string} A string representing the deployment.
matchExampleFromExampleName(exampleName)
matchExampleFromExampleName
(
exampleName
:
string
)
:
string
|
number
;
Parse the example from Example resource.
exampleName
string
A fully-qualified path representing Example resource.
string | number
{string} A string representing the example.
matchGuardrailFromGuardrailName(guardrailName)
matchGuardrailFromGuardrailName
(
guardrailName
:
string
)
:
string
|
number
;
Parse the guardrail from Guardrail resource.
guardrailName
string
A fully-qualified path representing Guardrail resource.
string | number
{string} A string representing the guardrail.
matchLocationFromAgentName(agentName)
matchLocationFromAgentName
(
agentName
:
string
)
:
string
|
number
;
Parse the location from Agent resource.
agentName
string
A fully-qualified path representing Agent resource.
string | number
{string} A string representing the location.
matchLocationFromAppName(appName)
matchLocationFromAppName
(
appName
:
string
)
:
string
|
number
;
Parse the location from App resource.
appName
string
A fully-qualified path representing App resource.
string | number
{string} A string representing the location.
matchLocationFromAppVersionName(appVersionName)
matchLocationFromAppVersionName
(
appVersionName
:
string
)
:
string
|
number
;
Parse the location from AppVersion resource.
appVersionName
string
A fully-qualified path representing AppVersion resource.
string | number
{string} A string representing the location.
matchLocationFromChangelogName(changelogName)
matchLocationFromChangelogName
(
changelogName
:
string
)
:
string
|
number
;
Parse the location from Changelog resource.
changelogName
string
A fully-qualified path representing Changelog resource.
string | number
{string} A string representing the location.
matchLocationFromConversationName(conversationName)
matchLocationFromConversationName
(
conversationName
:
string
)
:
string
|
number
;
Parse the location from Conversation resource.
conversationName
string
A fully-qualified path representing Conversation resource.
string | number
{string} A string representing the location.
matchLocationFromDeploymentName(deploymentName)
matchLocationFromDeploymentName
(
deploymentName
:
string
)
:
string
|
number
;
Parse the location from Deployment resource.
deploymentName
string
A fully-qualified path representing Deployment resource.
string | number
{string} A string representing the location.
matchLocationFromExampleName(exampleName)
matchLocationFromExampleName
(
exampleName
:
string
)
:
string
|
number
;
Parse the location from Example resource.
exampleName
string
A fully-qualified path representing Example resource.
string | number
{string} A string representing the location.
matchLocationFromGuardrailName(guardrailName)
matchLocationFromGuardrailName
(
guardrailName
:
string
)
:
string
|
number
;
Parse the location from Guardrail resource.
guardrailName
string
A fully-qualified path representing Guardrail resource.
string | number
{string} A string representing the location.
matchLocationFromOmnichannelName(omnichannelName)
matchLocationFromOmnichannelName
(
omnichannelName
:
string
)
:
string
|
number
;
Parse the location from Omnichannel resource.
omnichannelName
string
A fully-qualified path representing Omnichannel resource.
string | number
{string} A string representing the location.
matchLocationFromSecuritySettingsName(securitySettingsName)
matchLocationFromSecuritySettingsName
(
securitySettingsName
:
string
)
:
string
|
number
;
Parse the location from SecuritySettings resource.
securitySettingsName
string
A fully-qualified path representing SecuritySettings resource.
string | number
{string} A string representing the location.
matchLocationFromSessionName(sessionName)
matchLocationFromSessionName
(
sessionName
:
string
)
:
string
|
number
;
Parse the location from Session resource.
sessionName
string
A fully-qualified path representing Session resource.
string | number
{string} A string representing the location.
matchLocationFromToolName(toolName)
matchLocationFromToolName
(
toolName
:
string
)
:
string
|
number
;
Parse the location from Tool resource.
toolName
string
A fully-qualified path representing Tool resource.
string | number
{string} A string representing the location.
matchLocationFromToolsetName(toolsetName)
matchLocationFromToolsetName
(
toolsetName
:
string
)
:
string
|
number
;
Parse the location from Toolset resource.
toolsetName
string
A fully-qualified path representing Toolset resource.
string | number
{string} A string representing the location.
matchOmnichannelFromOmnichannelName(omnichannelName)
matchOmnichannelFromOmnichannelName
(
omnichannelName
:
string
)
:
string
|
number
;
Parse the omnichannel from Omnichannel resource.
omnichannelName
string
A fully-qualified path representing Omnichannel resource.
string | number
{string} A string representing the omnichannel.
matchProjectFromAgentName(agentName)
matchProjectFromAgentName
(
agentName
:
string
)
:
string
|
number
;
Parse the project from Agent resource.
agentName
string
A fully-qualified path representing Agent resource.
string | number
{string} A string representing the project.
matchProjectFromAppName(appName)
matchProjectFromAppName
(
appName
:
string
)
:
string
|
number
;
Parse the project from App resource.
appName
string
A fully-qualified path representing App resource.
string | number
{string} A string representing the project.
matchProjectFromAppVersionName(appVersionName)
matchProjectFromAppVersionName
(
appVersionName
:
string
)
:
string
|
number
;
Parse the project from AppVersion resource.
appVersionName
string
A fully-qualified path representing AppVersion resource.
string | number
{string} A string representing the project.
matchProjectFromChangelogName(changelogName)
matchProjectFromChangelogName
(
changelogName
:
string
)
:
string
|
number
;
Parse the project from Changelog resource.
changelogName
string
A fully-qualified path representing Changelog resource.
string | number
{string} A string representing the project.
matchProjectFromConversationName(conversationName)
matchProjectFromConversationName
(
conversationName
:
string
)
:
string
|
number
;
Parse the project from Conversation resource.
conversationName
string
A fully-qualified path representing Conversation resource.
string | number
{string} A string representing the project.
matchProjectFromDeploymentName(deploymentName)
matchProjectFromDeploymentName
(
deploymentName
:
string
)
:
string
|
number
;
Parse the project from Deployment resource.
deploymentName
string
A fully-qualified path representing Deployment resource.
string | number
{string} A string representing the project.
matchProjectFromExampleName(exampleName)
matchProjectFromExampleName
(
exampleName
:
string
)
:
string
|
number
;
Parse the project from Example resource.
exampleName
string
A fully-qualified path representing Example resource.
string | number
{string} A string representing the project.
matchProjectFromGuardrailName(guardrailName)
matchProjectFromGuardrailName
(
guardrailName
:
string
)
:
string
|
number
;
Parse the project from Guardrail resource.
guardrailName
string
A fully-qualified path representing Guardrail resource.
string | number
{string} A string representing the project.
matchProjectFromOmnichannelName(omnichannelName)
matchProjectFromOmnichannelName
(
omnichannelName
:
string
)
:
string
|
number
;
Parse the project from Omnichannel resource.
omnichannelName
string
A fully-qualified path representing Omnichannel resource.
string | number
{string} A string representing the project.
matchProjectFromSecuritySettingsName(securitySettingsName)
matchProjectFromSecuritySettingsName
(
securitySettingsName
:
string
)
:
string
|
number
;
Parse the project from SecuritySettings resource.
securitySettingsName
string
A fully-qualified path representing SecuritySettings resource.
string | number
{string} A string representing the project.
matchProjectFromSessionName(sessionName)
matchProjectFromSessionName
(
sessionName
:
string
)
:
string
|
number
;
Parse the project from Session resource.
sessionName
string
A fully-qualified path representing Session resource.
string | number
{string} A string representing the project.
matchProjectFromToolName(toolName)
matchProjectFromToolName
(
toolName
:
string
)
:
string
|
number
;
Parse the project from Tool resource.
toolName
string
A fully-qualified path representing Tool resource.
string | number
{string} A string representing the project.
matchProjectFromToolsetName(toolsetName)
matchProjectFromToolsetName
(
toolsetName
:
string
)
:
string
|
number
;
Parse the project from Toolset resource.
toolsetName
string
A fully-qualified path representing Toolset resource.
string | number
{string} A string representing the project.
matchSessionFromSessionName(sessionName)
matchSessionFromSessionName
(
sessionName
:
string
)
:
string
|
number
;
Parse the session from Session resource.
sessionName
string
A fully-qualified path representing Session resource.
string | number
{string} A string representing the session.
matchToolFromToolName(toolName)
matchToolFromToolName
(
toolName
:
string
)
:
string
|
number
;
Parse the tool from Tool resource.
toolName
string
A fully-qualified path representing Tool resource.
string | number
{string} A string representing the tool.
matchToolsetFromToolsetName(toolsetName)
matchToolsetFromToolsetName
(
toolsetName
:
string
)
:
string
|
number
;
Parse the toolset from Toolset resource.
toolsetName
string
A fully-qualified path representing Toolset resource.
string | number
{string} A string representing the toolset.
matchVersionFromAppVersionName(appVersionName)
matchVersionFromAppVersionName
(
appVersionName
:
string
)
:
string
|
number
;
Parse the version from AppVersion resource.
appVersionName
string
A fully-qualified path representing AppVersion resource.
string | number
{string} A string representing the version.
omnichannelPath(project, location, omnichannel)
omnichannelPath
(
project
:
string
,
location
:
string
,
omnichannel
:
string
)
:
string
;
Return a fully-qualified omnichannel resource name string.
project
string
location
string
omnichannel
string
string
{string} Resource name string.
runSession(request, options)
runSession
(
request
?:
protos
.
google
.
cloud
.
ces
.
v1
.
IRunSessionRequest
,
options
?:
CallOptions
)
:
Promise
< [
protos
.
google
.
cloud
.
ces
.
v1
.
IRunSessionResponse
,
protos
.
google
.
cloud
.
ces
.
v1
.
IRunSessionRequest
|
undefined
,
{}
|
undefined
]>;
Initiates a single-turn interaction with the CES agent within a session.
request
options
Promise
<[ protos.google.cloud.ces.v1.IRunSessionResponse
, protos.google.cloud.ces.v1.IRunSessionRequest
| undefined,
{} | undefined
]>
{Promise} - The promise which resolves to an array. The first element of the array is an object representing RunSessionResponse . Please see the documentation for more details and examples.
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The configuration for the session.
*/
// const config = {}
/**
* Required. Inputs for the session.
*/
// const inputs = [1,2,3,4]
// Imports the Ces library
const
{
SessionServiceClient
}
=
require
(
' @google-cloud/ces
'
).
v1
;
// Instantiates a client
const
cesClient
=
new
SessionServiceClient
();
async
function
callRunSession
()
{
// Construct request
const
request
=
{
config
,
inputs
,
};
// Run request
const
response
=
await
cesClient
.
runSession
(
request
);
console
.
log
(
response
);
}
callRunSession
();
runSession(request, options, callback)
runSession
(
request
:
protos
.
google
.
cloud
.
ces
.
v1
.
IRunSessionRequest
,
options
:
CallOptions
,
callback
:
Callback<protos
.
google
.
cloud
.
ces
.
v1
.
IRunSessionResponse
,
protos
.
google
.
cloud
.
ces
.
v1
.
IRunSessionRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
options
CallOptions
callback
Callback
< protos.google.cloud.ces.v1.IRunSessionResponse
, protos.google.cloud.ces.v1.IRunSessionRequest
| null | undefined, {} | null | undefined>
void
runSession(request, callback)
runSession
(
request
:
protos
.
google
.
cloud
.
ces
.
v1
.
IRunSessionRequest
,
callback
:
Callback<protos
.
google
.
cloud
.
ces
.
v1
.
IRunSessionResponse
,
protos
.
google
.
cloud
.
ces
.
v1
.
IRunSessionRequest
|
null
|
undefined
,
{}
|
null
|
undefined
> )
:
void
;
request
callback
Callback
< protos.google.cloud.ces.v1.IRunSessionResponse
, protos.google.cloud.ces.v1.IRunSessionRequest
| null | undefined, {} | null | undefined>
void
securitySettingsPath(project, location)
securitySettingsPath
(
project
:
string
,
location
:
string
)
:
string
;
Return a fully-qualified securitySettings resource name string.
project
string
location
string
string
{string} Resource name string.
sessionPath(project, location, app, session)
sessionPath
(
project
:
string
,
location
:
string
,
app
:
string
,
session
:
string
)
:
string
;
Return a fully-qualified session resource name string.
project
string
location
string
app
string
session
string
string
{string} Resource name string.
streamRunSession(request, options)
streamRunSession
(
request
?:
protos
.
google
.
cloud
.
ces
.
v1
.
IRunSessionRequest
,
options
?:
CallOptions
)
:
gax
.
CancellableStream
;
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 to true.
request
options
gax.CancellableStream
{Stream} An object stream which emits RunSessionResponse on 'data' event. Please see the documentation for more details and examples.
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The configuration for the session.
*/
// const config = {}
/**
* Required. Inputs for the session.
*/
// const inputs = [1,2,3,4]
// Imports the Ces library
const
{
SessionServiceClient
}
=
require
(
' @google-cloud/ces
'
).
v1
;
// Instantiates a client
const
cesClient
=
new
SessionServiceClient
();
async
function
callStreamRunSession
()
{
// Construct request
const
request
=
{
config
,
inputs
,
};
// Run request
const
stream
=
await
cesClient
.
streamRunSession
(
request
);
stream
.
on
(
'data'
,
(
response
)
=
>
{
console
.
log
(
response
)
});
stream
.
on
(
'error'
,
(
err
)
=
>
{
throw
(
err
)
});
stream
.
on
(
'end'
,
()
=
>
{
/* API call completed */
});
}
callStreamRunSession
();
toolPath(project, location, app, tool)
toolPath
(
project
:
string
,
location
:
string
,
app
:
string
,
tool
:
string
)
:
string
;
Return a fully-qualified tool resource name string.
project
string
location
string
app
string
tool
string
string
{string} Resource name string.
toolsetPath(project, location, app, toolset)
toolsetPath
(
project
:
string
,
location
:
string
,
app
:
string
,
toolset
:
string
)
:
string
;
Return a fully-qualified toolset resource name string.
project
string
location
string
app
string
toolset
string
string
{string} Resource name string.

