> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nebuly.com/llms.txt
> Use this file to discover all available pages before exploring further.

# AB Testing: Get Variants

This endpoint provides the necessary information for A/B testing. Given a user and a list of experiments or feature flags, the endpoint returns the variants assigned to the user. Since multiple feature flags can target the same user population, a user may belong to multiple variants.

A variant is an object that includes all the fields required to identify and use the specific version of the LLM assigned to the user. It contains a flag ID, which allows you to map the variant back to its corresponding feature flag.

<ParamField body="user" type="string" required>
  The user you want to know to which variant belongs.
</ParamField>

<ParamField body="feature_flags" type="string[]" required>
  The feature flags related to the experiment you are currently running. Note that you can run multiple experiments at the same time and you can run multiple feature flags on the same model.
</ParamField>

# Response

<ResponseField name="variants" type="object[]">
  All the variants the user belongs to.

  <Expandable title="properties">
    <ResponseField name="feature_flag_name" type="string">
      The name of the feature flag. If the variant refers to an experiment, this string contains the experiment name.
    </ResponseField>

    <ResponseField name="variant" type="object">
      The variant data.

      <Expandable title="properties">
        <ResponseField name="kind" type="string">
          The kind of the variant. It could be one of the following values:

          * `prompt`: if the variant was about adding a system prompt
          * `model`: if the variant was about switching the underlying LLM model
          * `rag`: if the variant was about adding an extra or new RAG source
        </ResponseField>

        <ResponseField name="prompt" type="string">
          Optional parameter, returend only when the kind is `prompt`. It contains the system prompt to be appended to the LLM input.
        </ResponseField>

        <ResponseField name="model_id" type="string">
          Optional parameter, returend only when the kind is `model`. It contains the model ID to be used for processing the user input.
        </ResponseField>

        <ResponseField name="config_params" type="object[]">
          Configuration parameters needed for the chosen variants. These parameters are created in the feature flag / experiments section of the Nebuly platform.

          <Expandable title="properties">
            <ResponseField name="name" type="string">
              The property name, e.g. "temperature"
            </ResponseField>

            <ResponseField name="value" type="string">
              The property value, e.g. "1"
            </ResponseField>

            <ResponseField name="type" type="string">
              The property type, e.g. "string"
            </ResponseField>
          </Expandable>
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>
