Skip to main content

Test Prompts

Endpoint: POST /api/prompts/test

Tests a raw prompt string against a specified LLM integration and returns the model response. The prompt does not need to be saved in Conductor. This endpoint can be used to test ad-hoc prompt text before creating or updating a prompt.

Request Body

ParameterDescriptionTypeRequired/ Optional
llmProviderThe name of the LLM provider integration in Conductor to test the prompt with.stringRequired
modelThe model name within the LLM provider to test the prompt with.stringRequired.
promptThe prompt text to test.stringRequired.
promptVariablesKey-value pairs to substitute into the prompt template.Array of stringsOptional.
temperatureThe temperature for the prompt.integerOptional.
topPTop-p nucleus sampling parameter.integerOptional.
maxTokensMaximum tokens to generate. 0 means, it uses the provider default.integerOptional.
stopWordsThe stop sequences for generation.Array of stringsOptional.
response_formatThe output format of the prompt. Whether text or json.stringOptional.

Response

  • Returns 200 OK with the raw model output as a plain-text string on success.
  • Returns 401 if authentication is required.
  • Returns 403 if the caller does not have READ access to the specified llmProvider:model.

Examples

Test a prompt

Request

curl -X 'POST' \
'https://<YOUR-SERVER-URL>/api/prompts/test' \
-H 'accept: application/json' \
-H 'X-Authorization: <TOKEN>' \
-d '{
"llmProvider": "openAI",
"model": "gpt-4o",
"prompt": "What is the current population of `${country}`? What was the population in `${year}`?",
"promptVariables": {
"country": "Japan",
"year": "1994"
},
"temperature": 0.1,
"topP": 0.9,
"stopWords": [],
"response_format": "text"
}'

Response

Returns 200 OK with the raw model output as a plain-text string on success.

As of the latest data available up to October 2023, Japan's population is estimated to be around 124 million people. In 1994, the population of Japan was approximately 125 million. Please note that these figures are estimates and can vary based on the source and the methodology used for population counting.