Jev
Jev provides a VoxEngine client for the TypeSafe System One API. A scenario sends text, and optional images, and receives typed answers for routing, triage, or scoring.
This client does not take call audio. Use Jev.createSystemOneClient(...) to keep one connection open, then call systemOne for each decision.
Build questions with noul, choice, score, and box. Use the jev-preview model when a request includes box.
Related guides
Contents
- Usage: required module import.
- Factory and question helpers: create the client and build System One questions.
- Methods: send a System One request and manage the connection.
- SystemOneEvents: result, error, and connector information events.
- Parameter types: client and request parameters.
Usage
Add the module before using the namespace:
Create the client, wait for ConnectorInformation, then send systemOne requests on the same connection. A failed request does not close the client.
Factory and question helpers
box
Creates a question that locates what its instructions describe in the request image.
Use the jev-preview model for this question.
The arguments and the returned question are described in the TypeSafe System One documentation.
Parameters
Returns
choice
Creates a question that selects between named alternatives. The arguments and the returned question are described in the TypeSafe System One documentation.
Parameters
Returns
createSystemOneClient
Creates a Jev.SystemOneClient that keeps one connection open for many System One requests.
Parameters
Returns
noul
Creates a yes/no question.
When instructions is omitted or null, criteria must describe the yes outcome or the no outcome.
The arguments and the returned question are described in the TypeSafe System One documentation.
Parameters
Returns
score
Creates a question that assigns a score using an ordered rubric. A list of fewer than two entries is rejected when the request is sent. The arguments and the returned question are described in the TypeSafe System One documentation.
Parameters
Returns
SystemOneClient
Methods
addEventListener
Adds a handler for the specified Jev.SystemOneEvents or Jev.Events event. Use only functions as handlers; anything except a function leads to the error and scenario termination when a handler is called.
Parameters
Returns
close
Closes the connection or the connection attempt.
Parameters
This method does not accept parameters.
Returns
id
Returns the client id.
Parameters
This method does not accept parameters.
Returns
removeEventListener
Removes a handler for the specified Jev.SystemOneEvents or Jev.Events event.
Parameters
Returns
systemOne
Sends one System One request on the open connection.
The promise resolves with the TypeSafe result. The matching Jev.SystemOneEvents.Result or Jev.SystemOneEvents.Error is also dispatched. A failed request does not close the client.
parameters.body and the resolved value are described in the TypeSafe System One documentation.
Parameters
Returns
webSocketId
Returns the WebSocket id.
Parameters
This method does not accept parameters.
Returns
SystemOneEvents
These events report each System One result or failure, plus connector session information. The data field contains the provider payload.
Unknown
The unknown event.
Event constant: SystemOneEvents.Unknown
Payload
Result
The System One response. data.payload is { requestId?, body }. body is described in the TypeSafe System One documentation. Jev.SystemOneClient.systemOne resolves with that same body.
Event constant: SystemOneEvents.Result
Payload
Error
A System One request failed. The client stays open. data.payload is { requestId?, statusCode?, text }. Jev.SystemOneClient.systemOne rejects with this failure.
Event constant: SystemOneEvents.Error
Payload
ConnectorInformation
Contains Voice AI integration session information.
Event constant: SystemOneEvents.ConnectorInformation
Payload
Parameter types
SystemOneClientParameters
Jev.SystemOneClient parameters. Can be passed as arguments to the Jev.createSystemOneClient method.
SystemOneRequest
One System One evaluation sent on the open Jev.SystemOneClient connection.