Skip to content
Get started

Retrieve Prompt

client.models.scores.retrievePrompt(stringmodelID, ScoreRetrievePromptParams { projectId, prompt } query?, RequestOptionsoptions?): ScoreRetrievePromptResponse { details, modelId, score, 2 more }
GET/models/{modelId}/scores/prompt

Get the prompt scores for the given modelId

ParametersExpand Collapse
modelID: string
query: ScoreRetrievePromptParams { projectId, prompt }
projectId?: string

The projectId used for ownership resource management. Either to assert ownership or to set the owner of the resource(s)

prompt?: string

The prompt to score against the model. Required — the call returns 400 without it.

ReturnsExpand Collapse
ScoreRetrievePromptResponse { details, modelId, score, 2 more }
details: Details { captionsSimilarity, embeddingSimilarity, promptsSimilarity }

Different components used to compute the final score

captionsSimilarity: CaptionsSimilarity { mean, median, min }

The Dice-Sørensen similarity between the prompt and each captions from the model’s training images

The values are between 0 and 1. The higher the value, the more similar the prompt is to the training images’ captions

mean: number
median: number
min: number
embeddingSimilarity: number

The cosine similarity between the prompt and the model’s caption embedding

The value is a number between -1 and 1. The higher the value, the more similar the prompt is to the model’s caption embedding

promptsSimilarity?: PromptsSimilarity { mean, median, min }

The Dice-Sørensen similarity between the prompt and each prompts from the model’s examples

The values are between 0 and 1. The higher the value, the more similar the prompt is to the prompts’ examples

mean: number
median: number
min: number
modelId: string

The model ID (example: “model_eyVcnFJcR92BxBkz7N6g5w”)

score: number

The prompt’s score for the input modelId

The score is a number between 0 and 1. The higher the score, the better the prompt is for the model

maximum1
minimum0
status: "complete" | "incomplete" | "unknown"

The status of the prompt’s score

Details if all the necessary data is present to compute the score

One of the following:
"complete"
"incomplete"
"unknown"
syntaxError?: "Prompt weight should be between 0 and 2" | "Prompt weight symbol should be - or + with a maximum length of 5. Ex: --, ++, ---, +++++" | "Unsupported prompt syntax: '[to:when], [from::when]'" | 4 more

Present only if the prompt has one or more syntax errors

The API checks several syntax errors in the prompt

One of the following:
"Prompt weight should be between 0 and 2"
"Prompt weight symbol should be - or + with a maximum length of 5. Ex: --, ++, ---, +++++"
"Unsupported prompt syntax: '[to:when], [from::when]'"
"Unsupported prompt syntax: 'word:<weight>' or '(word):<weight>'. Please use 'word<weight>' or '(word)<weight>' instead"
"Unsupported prompt syntax: --(s|c)ref"
"Unsupported prompt syntax: <name:weight> or <lora:name:weight>"
"Unsupported url in prompt"

Retrieve Prompt

import Scenario from '@scenario-labs/sdk';

const client = new Scenario({
  apiKey: process.env['SCENARIO_SDK_API_KEY'], // This is the default and can be omitted
  apiSecret: process.env['SCENARIO_SDK_API_SECRET'], // This is the default and can be omitted
});

const response = await client.models.scores.retrievePrompt('modelId');

console.log(response.details);
{
  "details": {
    "captionsSimilarity": {
      "mean": 0,
      "median": 0,
      "min": 0
    },
    "embeddingSimilarity": 0,
    "promptsSimilarity": {
      "mean": 0,
      "median": 0,
      "min": 0
    }
  },
  "modelId": "modelId",
  "score": 0,
  "status": "complete",
  "syntaxError": "Prompt weight should be between 0 and 2"
}
Returns Examples
{
  "details": {
    "captionsSimilarity": {
      "mean": 0,
      "median": 0,
      "min": 0
    },
    "embeddingSimilarity": 0,
    "promptsSimilarity": {
      "mean": 0,
      "median": 0,
      "min": 0
    }
  },
  "modelId": "modelId",
  "score": 0,
  "status": "complete",
  "syntaxError": "Prompt weight should be between 0 and 2"
}