The AI Assistant is an LLM-powered chatbot that can create virtual assetsĀ for you. See AI Assistant for more information about accessing the AI Assistant. Be aware that LLMs can provide inaccurate information, which can affect this feature. Due diligence is recommended.

Creating a Virtual Asset with the AI Assistant

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 for help creating a virtual asset and provide it with a URL or absolute file path to the service definition. 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:

Create a virtual asset from definition:
https://petstore.swagger.io/v2/swagger.json

Include operations for adding, updating, and retrieving pet information.

The AI Assistant will show you the virtual asset it proposes based on your request, including a responder suite with related operations populated payload data when applicable, and ask you if you want to save it. You can choose to accept the virtual asset or ask for changes. For example, you might decide you want to add an operation to delete pet information. When it asks you if you want to proceed, you could say:

Add an operation to delete pet information.

The AI Assistant would recreate the virtual asset with the new operation. In this way, you can modify the virtual asset until you have exactly what you want.

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:

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:

Create a virtual service to manage hotel room bookings. It should include CRUD operations for endpoints /bookings and /rooms.

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:

Create a virtual service to manage hotel room bookings.

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.