You can test various return scenarios with GenerativeAgent by using Test Users in the Previewer.

Additionally, by using Test Users you ensure that GenerativeAgent handles tasks and functions correctly when calling your APIs.

Test Users allow you to define a scenario and how your API would respond to an API Connection for that scenario. This allows you to try out different Tasks and iterate on tasks definitions or on Functions.

Test Users allow you to define replies for different API calling scenarios (e.g. the return for an API Call named getAddress but having different user IDs).

Use Test Users to test:

  • Key happy-flows
  • Edge cases
  • Common problems or issues

Test User Configuration

Default User Options

Whenever you choose a Test User, you are given the following options:

  1. Add API: Add the Mock Response for the API Call.
    • Once you add an API, add the return scenarios by specifying different request parameter / response pairs.
  2. Advance settings: Add timestamps to the mock call so GenerativeAgent can make better use of connections.
    • This works only if your mocked data includes dates. If this is the case, set this field so the date the bot believes it is aligns with the data returned in the mock responses

If your mock data does not involve or include dates, leave it blank.

Default User

After choosing “Add API”, fill out the following information:

  1. API to mock: Be explicit about the API you can to use.

Remember to use the correct syntax.

For example, add entity. in the jinja syntax to an accountinfo API Call.

  1. Request Params: Enter the Params that should be mocked
  2. Response params: Enter the Request Params you want to mock in a response. You can specify multiple Request and Response pairs for a single API.

Create a Test User

To create a Test User:

  1. Navigate to the Test User page in GenerativeAgent and click “Create User”.
  2. This takes you to the Test User detail page which shows each endpoint currently being used by an API Connection.
  3. Provide the following information:
    • Name of the test user (editable)
    • Description of the scenario this mock user represents (eg. Basic returns for the API Call and Functions)

    For each endpoint, provide the API response your server would respond to enable the scenario you want to simulate.

  4. Click “Create” and create the Test User.
  5. Deploy the changes to Sandbox or Draft environments

Delete a Test User

To delete a test user, simply click on the ellipsis and then on Delete. You are given a confirmation pop-up to delete the user

Use Test Users in the Previewer

Once you create the Test User and reference an API call to the Test User, you are ready to test a function using Mock API Functions.

To use the Test User:

  1. Check that the Tasks and Functions correctly reference the Test User and the API Call to Mock
  2. Initiate a conversation with GenerativeAgent
  3. Ask GenerativeAgent for information related to the Mock Call
  4. Review the response given by GenerativeAgent. It should return the same mock response that you set up in the Test User

Was this page helpful?