Skip to main content

Create Dependent Variable

POST 

/api/v1/experiments/dependent-variable

Generate a dependent variable string (survey prompt) based on the input question.

This endpoint creates a dependent variable that synthetic respondents will respond to in an experiment. It allows users to review the generated survey prompt before running the experiment.

Parameters:

  • req: DependentVariable object containing:
    • prompt_type: Enum representing the type or focus of the experiment
    • why_prompt: String containing the user's input question

Returns:

  • DependentVariableResponse object with the following structure:
    • dependent_variable: String representing the generated survey prompt

Example Request:

{
"prompt_type": "generic",
"why_prompt": "How does social media usage affect sleep patterns?"
}

Example Response:

{
"dependent_variable": "Please read the descriptions of the two social media usage scenarios carefully. Then, please indicate which of the two scenarios you believe has a more significant impact on sleep patterns."
}

Notes:

  • The dependent variable is generated using the GPT-4 language model
  • The generated dependent variable can be added to the experiment object

Raises:

  • HTTPException 500: If an error occurs during the generation of the dependent variable

Request

Responses

Successful Response