Sessions are like containers that hold information about a specific interaction. A session contains the AI’s behavior profile, the AI’s face model, any additional context and other metadata that might be needed for an interaction.

An Interaction doesn’t start immediately after you create a session, it starts when the open event is triggered. This is when the AI is ready to start interacting with the user.

import {connect} from 'diarupt';
...
    await connect(
        session_id,
        {
            stream,
            player: ai_feed, // video element
        }, (event, data) => {
            // handle events
            switch (event) {
                case 'open':
                    console.log('Interaction is Started')
                    break;
            }
        }
    );
...

See Geting Started Guide for more information on starting an interaction.

Providing contextual information to an interaction

You can add relevant contextual information for more robust interactions, this can be done by adding the contextual information to the context field when creating your session. Your request payload should look something like this

session.js
  ...
    const options = {
        ...
        profile: 'interviewer',
        context: 'Company Name is XYZ Consult\nJob title is Customer Support Agent\nYour Name is Marvin\nCandidate Name is John Doe',
    }
  ...

The context field can be as long as 2500 words.

Connecting external data sources to an interaction

You can connect external data sources to your interaction, such as knowledge bases, URLs databases, other APIs and other third party application data. This allows for more advnace workflows.

Coming Soon

During an Interaction

During an interaction, the diarupt client sdk streams the user’s audio to Diarupt’s conversation engine, processes it and sends back the AI’s response as a video and/or audio stream. We use webrtc under the hood to stream audio and video to and from the client.

If you’re using the JS SDK, you need to ensure you’re using a browser that supports webrtc. See Browser Support for more information.

Disconnecting vs Terminating

When an interaction is over, you can either disconnect via the disconnect SDK function or terminate the session via the Terminate API.

Disconnecting will stop the AI from responding to the user. Successful disconnection leaves the session ACTIVE but in a PAUSED state. This means that you can reconnect to the session using the same Session ID and continue the interaction. This is useful if you want to pause the interaction and resume it later.

Terminating a session will end the interaction and the session will be marked as TERMINATED. This means that you can no longer reconnect to the interaction.

Pricing

Interactions are measured in seconds spent per session, this is the total duration spent by the user interacting with an AI.

Pricing is pay as you go, you only pay for what you use cumulatively within a given period. We give trial credit so you can try out the platform when you sign up.