Query your Custom Model

Querying Trained Custom Models


Custom models are private

Only you and members of your organization will be able to send requests to your custom models. Other AI21 Studio users don’t have access to them.

Once trained, you'll be able to query your custom model in the playground by selecting it from the model dropdown. You can also query the model via the API by posting a complete request with the model name in the URL corresponding to your custom model:

When querying the trained model with new examples, you should use exactly the same structure you used in the training data. A stop sequence is not needed.

For example, to query a model trained on ad generation, as in this example, your prompt text should be:

import requests

prompt = "Model name: Kuki\nFuel consumption: 30 MPG\nHorsepower: 80 HP\nPrice: $5,000\n##\n"

    headers={"Authorization": "Bearer YOUR_API_KEY"},
        "prompt": prompt,
        "numResults": 1,
        "maxTokens": 64,
        "temperature": 0.7,
        "topKReturn": 0