Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space FUNCTDEV and version SVC2025.2

...

You can use the AI Assistant to help you create a virtual asset in Virtualize. There are two methods available to you: using an OpenAI/Swagger service definition and working without one.

With a Service Definition

If you have an OpenAI/Swagger service definition that you want to create a virtual asset for, you can just ask the AI Assistant Just ask it for help creating a virtual asset and provide it with a URL or absolute file path to a OpenAPI/Swagger the service definition that you want to create a virtual asset for. It will analyze the service definition and make suggestions. You can choose one of its suggestions or describe the virtual asset you want. For example, you might ask the AI Assistant:

...

Virtual asset responders will be parameterized based on incoming requests when applicable. Values that are not parameterized will be populated with AI-generated values.

Without a Service Definition

If you don't have an OpenAI/Swagger service definition to use, you can still get the AI Assistant's help creating a virtual asset: simply provide it with a description of how the service works, which can include endpoints, payloads, and so on, and the AI Assistant will analyze your description then propose the virtual asset it thinks would be most appropriate. Depending on the complexity of what you need and the completeness of your description, this method can result in some gaps in the virtual asset that you might need to fill in, but it's a good way to get a jump on the process.

Depending on the detail of your description, the AI Assistant might propose:

  • endpoints
  • responder correlations
  • response payloads
  • status codes
  • parameterizations

The AI Assistant will propose a virtual asset and ask for changes before creating it. You can continue the conversation with it, refining the virtual asset until it is satisfactory. If it is struggling to understand aspects of your request, try giving it examples.

For example, you might ask the AI Assistant:

No Format
Create a virtual service based on the following description: a system to manage hotel room bookings with endpoints /bookings, /rooms, and /guests.

The AI Assistant can use this relatively simple prompt to create a virtual asset, but it might not be exactly what you want. A more detailed prompt, like the following, is more likely to get you exactly what you want:

No Format
Create a virtual service to manage hotel room bookings based on the following description:

Basepath:
/hotel/api/v1

Endpoints:
/bookings
/bookings/{id}
/rooms
/rooms?guestName={name}&date={date}
/rooms/{id}
/rooms/{id}/availability
/rooms/{id}/hold 
/guests
/guests/{id}

Details:
200 for success, 404 for not found, and 409 for conflicts (for example, double booking).
Error responses for all endpoints should include a clear error message.

Example request for POST - /bookings:
{
    "roomId": 201,
    "roomNumber": "101A",
    "roomType": "Deluxe",
    "guestId": 301,
    "guestName": "John Doe",
    "checkIn": "2024-07-01",
    "checkOut": "2024-07-05",
    "price": 520,
    "specialRequests": "Late check-in"
}
Response returns "id" field and the same as request payload.