| |
Object ask(String message, String configName, Double temperature, Double topP, Integer topK, Double frequencyPenalty, Double presencePenalty, Integer maxOutputTokens, List<String> stopSequences, Integer timeoutMs) throws TestException |
|
| Parameters |
message |
The message to send to the LLM.
|
configurationName |
The name of a LLM configuration as set in LLM Configurations in the QF-Test options
|
temperature |
Controls the randomness of the generated text.
|
topK |
Controls how many of the most likely tokens should be considered.
|
topP |
Controls which tokens should be considered.
|
presencePenalty |
Prevents the llm from reusing words.
|
frequencyPenalty |
Prevents the llm from repeating words.
|
maxOutputTokens |
Maximum number of tokens that can be generated in the response.
|
stopSequences |
Prevent LLM from generating more text after that string appears.
|
timeoutMs |
How long to wait for a response from the LLM, in milliseconds.
|
| Returns |
The answer from the LLM. The return type depends on the response content:
a String for text-only responses, an ImageRep when the LLM
returns a single image without text, and a List of String
and/or ImageRep elements when the response contains multiple content parts.
|
| |
Object askWithTools(String message, String configName, ...) throws TestException |
|
| Parameters |
message |
The message to send to the LLM.
|
configurationName |
The name of a LLM configuration as set in LLM Configurations in the QF-Test options
|
| Returns |
The answer from the LLM. The return type depends on the response content:
a String for text-only responses, an ImageRep when the LLM
returns a single image without text, and a List of String
and/or ImageRep elements when the response contains multiple content parts.
|
| |
void addCustomModel(final String name, final Object responseFunction) |
|
| Parameters |
name |
The AI configuration name under which the custom model can be referenced
|
responseFunction |
A function which receives the query with three arguments:
- msg
- The chat message to process.
- parameters
- (optional) The request parameters.
- toolBridge
- (optional) If tool access is allowed, this bridge object allows
to get a list of available tools (
toolBridge.listTools()) and to call the tools
(via toolBridge.callTool(toolName, toolParameterMap)).
Otherwise, the argument is null.
|
|
| |
void removeCustomModel(final String name) |
|
| Parameters |
name |
The name under which the custom model was registered
|
|
| |
List<String> getConfigNames() |
|
| Returns |
A List of all available AI configuration names
|
| |
void setDefaultConfig(String provider, String baseUrl, String apiKey, String modelName, String displayName="Default") |
|
| Parameters |
provider |
Currently available provider types: OpenAIGeneric, Anthropic, Gemini and Ollama.
|
baseUrl |
The base API URL endpoint to the provider. Usually ends with /v1 oder similar.
|
apiKey |
The API key to submit to the provider.
|
modelName |
The name of the model to use, like gpt-4o or gemini-2.0-flash
|
displayName |
How QF-Test will identify the configuration in logs and error messages, defaults to Default
|
|
| |
void resetDefaultConfig() |
|
|
| |
String getPrompt(String promptName, Map<String, Object> promptArguments) |
|
| Parameters |
promptName |
The name of the prompt.
|
promptArguments |
The arguments of the prompt
|
| Returns |
The joined text messages of the prompt.
|
| |
List<List<Object>> listPrompts() |
|
| Returns |
A List of all available MCP prompts.
|
| |