Guidelines for Using the AI Blocks

Guidelines for Using the AI Blocks

This articles outlines suggestions and examples of using the AI block so that you can make the most out of the AI Blocks and ensure that the test data generated is appropriate for your automation needs.

This article is divided into sections and below table can help you navigate through:

Writing effective prompts

Writing effective prompts is key to getting the most out of any AI system. Whether you're working with an AI to generate data, answer questions, or automate processes, your prompt should be clear, focused, and well-structured. Following these best practices will help you achieve accurate and relevant results:

Overview of the AI Blocks

[AI Blocks](/content/product/documentation/building-blocks/a-i "https://www.leapwork.com/product/documentation/building-blocks/a-i"/index.html) in Leapwork integrate advanced AI capabilities into testing workflows, automating tasks, improving efficiency, and enabling quick adaptation to changing needs.

The available blocks, AI Extract, Generate, Transform, and Validate, support diverse use cases, from creating test data to validating and transforming it. To activate these blocks, follow the steps in the [Customer Portal](/content/product/documentation/customer-portal "https://www.leapwork.com/product/documentation/customer-portal"/index.html).

Key Features: Potential Use Cases:
- Generates Structured Test Data: Quickly creates names, emails, addresses, and other sample data for automation testing. - Automated Testing: Create realistic data like user profiles or addresses to test web applications and APIs.
- Input Validation: The block ensures all requests fit automation test data standards, blocking irrelevant or inappropriate requests. - Form and Validation Testing: Generate data to verify form fields, input validation, and error handling.
- Error Handling: Provides clear error messages for invalid prompts or misuse. - E-Commerce: Test product listings, pricing, and other shopping-related data.
- Single Record Generation: Currently supports generating one test data record at a time, with workarounds available for larger datasets. - Data Workflow Verification: Validate business workflows such as age or address checks.

Guidelines for Using the AI Generate Block

Please do note, while adding fields in the block, their label must match the values we are requesting in the prompt, otherwise the execution might not be successful or as desired.

What You Can Do

  1. Generate simple test data such as names, emails, or addresses.
  1. Use automation-friendly requests like phone numbers or product data.
  1. Create data for testing e-commerce, forms, or validation workflows.
  1. Create data for filling online form with 10 Indian male names.

What You Should Avoid

  1. Don’t request creative content, like stories or narratives.
  1. Avoid asking for sensitive information, such as passwords or credit card numbers.
  1. Don’t expect real-time data, like the current time or date.

Guidelines for Using the AI Validate Block

What You Can Do

  1. Validate the purpose and type of information.
  1. Validate type of information or structured data.
  1. Check equivalence of two strings with similar purposes.

What You Should Avoid

  1. Don’t validate empty fields or spaces.
  1. Avoid ambiguous or overly generalized benchmarks.
  1. Don’t rely on subjective or unclear conclusions.

Guidelines for Using the AI Extract Block

What You Can Do

  1. Extract key details from structured text.
  1. Retrieve variables or specific values from code.
  1. Extract ID or build number from the given text.

What You Should Avoid

  1. Don’t use vague or non-descriptive field names.
  1. Avoid providing contradictory instructions.
  1. Avoid inconsistencies in date formats.

Guidelines for Using the AI Transform Block

What You Can Do

  1. Convert data between formats.
  1. Perform unit or number conversions .
  1. Translate text between languages.

What You Should Avoid

  1. Don’t attempt unsupported transformations.
  1. Avoid using outdated conversion rates for currencies.
  1. Avoid attempting text-to-image or file format conversions.

Conclusion

Always keep in mind the limitations, such as avoiding unsupported transformations or ambiguous requests, and focus on structured, valid data to optimize your automation processes.