Skip to 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

Parameter Description Type Required/ Optional
llmProvider The name of the LLM provider integration in Conductor to test the prompt with. string Required
model The model name within the LLM provider to test the prompt with. string Required.
prompt The prompt text to test. string Required.
promptVariables Key-value pairs to substitute into the prompt template. Array of strings Optional.
temperature The temperature for the prompt. integer Optional.
topP Top-p nucleus sampling parameter. integer Optional.
maxTokens Maximum tokens to generate. 0 means, it uses the provider default. integer Optional.
stopWords The stop sequences for generation. Array of strings Optional.
response_format The output format of the prompt. Whether text or json. string Optional.

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.