Guidelines for Effective GraphQL Query Generator AI Prompts

Important:The built-in query generator, GraphQL Query Generator, is currently preview release functionality. Customers are encouraged to take advantage of the Customer Feedback button to identify ways we can improve the query generator, its components, and the documentation.

The GraphQL Query Generator uses natural language prompts to generate precise GraphQL queries—fetching devices and software information stored in the Unified Object Model (UOM). To ensure accurate and efficient query generation, follow these best practices and the example set by the sample query statements.

Best Practices For Query AI Prompts 
Examples of Effective Prompts 

Best Practices For Query AI Prompts

The guidance below presents the core guidelines for prompting the GraphQL Query Generator’s Query AI. Following these guidelines will allow the natural language processor to most effectively generate the query you need:

1. Specify clear intent. Always clearly indicate your objective in the prompt:
Good: List devices along with DeviceName, ID, SerialNumber, and Domain.
Poor: Show me device stuff.
2. Include specific attribute names. Utilize exact attribute names defined in the UOM:
Good: Get DeviceName, ID, SerialNumber, and Domain for devices.
Poor: Get details for devices.
3. Clearly state constraints separately. Always mention filtering conditions distinctly:
Good: List software details such as ID and Name. Show only software marked as obsolete.
Poor: Give obsolete software details.
4. Break complex queries into simpler sentences. For clarity and accuracy, divide complex requirements:
Good: List Acme servers. These servers should have Microsoft software installed. Include device details, software details, and their obsolescence dates.
Poor: Get Acme servers with Microsoft software and details including obsolescence dates.
5. Limit results explicitly. If necessary, explicitly state result limits:
Good: For each device get me the HardwareEvidences information such as deviceID and DataSourceID. Include lifecycle information such as General Availability. Limit results to 20 devices only.
Poor: Give me some hardware information.
6. Focus on supported datasets (Device and Software). Currently, only device and software datasets are supported. Queries must focus on information from those two datasets:
Good: Get devices and their attached BusinessServices.
Poor: Fetch business service details only.

 

Examples of Effective Prompts

Follow the approach illustrated in the examples below for best results from the Query AI prompts you write:

Get me a list of devices with their DeviceName, SerialNumber, and Domain. 
List software that is licensable. Provide installer evidence and file evidence information for this software. 
Fetch device details along with attached BusinessServices. 
List all Acme servers having Microsoft software installed. Include device and software details, as well as obsolescence dates. 
Retrieve HardwareEvidences details including deviceID and DataSourceID, with General Availability information available, limited to 20 devices. 

By following these guidelines, your prompts will yield accurate and efficient GraphQL queries tailored to your needs, enhancing your overall experience with the AI GraphQL Query Generator.