@CompileStatic class LlmKeywords extends Object
Built-in keywords for calling the AI service configured for this execution from a test case.
| Constructor and description |
|---|
LlmKeywords
() |
| Type Params | Return Type | Name and description |
|---|---|---|
|
static String |
ask(String prompt)Send a text prompt to the AI service and return its response text. |
|
static String |
ask(String prompt, List<String> attachmentPaths)Send a text prompt with optional file/image attachments to the AI service and return its response text. |
|
static String |
ask(String prompt, String[] attachmentPaths)Send a text prompt with optional file/image attachments to the AI service and return its response text. |
|
static String |
ask(FailureHandling flowControl, String prompt, String[] attachmentPaths)Send a text prompt with optional file/image attachments to the AI service and return its response text. |
|
static String |
ask(FailureHandling flowControl, String prompt, List<String> attachmentPaths)Send a text prompt with optional file/image attachments to the AI service and return its response text. |
|
static String |
ask(UserInput[] inputs)Send a prompt built from UserInput parts to the AI service and return its response text. |
|
static String |
ask(FailureHandling flowControl, UserInput[] inputs)Send a prompt built from UserInput parts to the AI service and return its response text. |
|
static void |
assertFile(String filePath, String expectation)Ask the AI service whether a file's content (image or text-like) meets an expectation, and fail the step if it does not. |
|
static void |
assertFile(String[] filePaths, String expectation)Ask the AI service whether the content of one or more files (images or text-like files, detected by extension) meets an expectation, and fail the step if it does not. |
|
static void |
assertFile(String[] filePaths, String expectation, FailureHandling flowControl)Ask the AI service whether the content of one or more files (images or text-like files, detected by extension) meets an expectation, and fail the step if it does not. |
|
static void |
assertFile(String filePath, String expectation, FailureHandling flowControl)Ask the AI service whether a file's content (image or text-like) meets an expectation, and fail the step if it does not. |
|
static void |
assertFile(List<String> filePaths, String expectation)Ask the AI service whether the content of one or more files meets an expectation, and fail the step if it does not. |
|
static void |
assertFile(List<String> filePaths, String expectation, FailureHandling flowControl)Ask the AI service whether the content of one or more files meets an expectation, and fail the step if it does not. |
|
static void |
assertText(String value, String expectation)Ask the AI service whether a text value meets an expectation, and fail the step if it does not. |
|
static void |
assertText(String value, String expectation, FailureHandling flowControl)Ask the AI service whether a text value meets an expectation, and fail the step if it does not. |
Send a text prompt to the AI service and return its response text. To attach files or images, use ask(String, String...) — each attachment is detected by extension: image extensions (png, jpg, jpeg, webp, gif, heic, heif) are sent as images, other supported extensions (txt, csv, json, log, pdf) as files.
prompt
- the question or instruction to sendSend a text prompt with optional file/image attachments to the AI service and return its response text. See ask(String, String...).
prompt
- the question or instruction to sendattachmentPaths
- paths of files to attach — absolute, or relative to the project folderSend a text prompt with optional file/image attachments to the AI service and return its response text. See ask(String, List).
prompt
- the question or instruction to sendattachmentPaths
- paths of files to attach — absolute, or relative to the project folderSend a text prompt with optional file/image attachments to the AI service and return its response text. See ask(String, List).
flowControl
- the failure-handling behavior applied when the keyword failsprompt
- the question or instruction to sendattachmentPaths
- paths of files to attach — absolute, or relative to the project folderSend a text prompt with optional file/image attachments to the AI service and return its response text. See ask(String, String...).
flowControl
- the failure-handling behavior applied when the keyword failsprompt
- the question or instruction to sendattachmentPaths
- paths of files to attach — absolute, or relative to the project folderSend a prompt built from UserInput parts to the AI service and return its response text. Script alternative to ask(String, String...) when the order of text and attachment parts matters.
inputs
- the prompt parts to send, in orderSend a prompt built from UserInput parts to the AI service and return its response text. See ask(UserInput...).
flowControl
- the failure-handling behavior applied when the keyword failsinputs
- the prompt parts to send, in orderAsk the AI service whether a file's content (image or text-like) meets an expectation, and fail the step if it does not.
filePath
- path of the file to judge — absolute, or relative to the project folderexpectation
- what the file is expected to satisfy, in plain languageAsk the AI service whether the content of one or more files (images or text-like files, detected by extension) meets an expectation, and fail the step if it does not.
filePaths
- paths of the files to judge — absolute, or relative to the project folderexpectation
- what the files are expected to satisfy, in plain languageAsk the AI service whether the content of one or more files (images or text-like files, detected by extension) meets an expectation, and fail the step if it does not.
filePaths
- paths of the files to judge — absolute, or relative to the project folderexpectation
- what the files are expected to satisfy, in plain languageflowControl
- the failure-handling behavior applied when the keyword failsAsk the AI service whether a file's content (image or text-like) meets an expectation, and fail the step if it does not.
filePath
- path of the file to judge — absolute, or relative to the project folderexpectation
- what the file is expected to satisfy, in plain languageflowControl
- the failure-handling behavior applied when the keyword failsAsk the AI service whether the content of one or more files meets an expectation, and fail the step if it does not. See assertFile(String[], String).
filePaths
- paths of the files to judge — absolute, or relative to the project folderexpectation
- what the files are expected to satisfy, in plain languageAsk the AI service whether the content of one or more files meets an expectation, and fail the step if it does not. See assertFile(String[], String).
filePaths
- paths of the files to judge — absolute, or relative to the project folderexpectation
- what the files are expected to satisfy, in plain languageflowControl
- the failure-handling behavior applied when the keyword failsAsk the AI service whether a text value meets an expectation, and fail the step if it does not.
value
- the text value to judgeexpectation
- what the value is expected to satisfy, in plain languageAsk the AI service whether a text value meets an expectation, and fail the step if it does not.
value
- the text value to judgeexpectation
- what the value is expected to satisfy, in plain languageflowControl
- the failure-handling behavior applied when the keyword fails