SPB Git

Repository Public

graders.md 25.8 KB 1,087 lines markdown

1# Graders23> For the complete documentation index, see [llms.txt](/llms.txt). Markdown versions of documentation pages are available by appending `.md` to the page URL.45# Grader Models67## Domain Types89### Grader Inputs1011- `GraderInputs = array of string or ResponseInputText or object { text, type }  or 2 more`1213  A list of inputs, each of which may be either an input text, output text, input14  image, or input audio object.1516  - `TextInput = string`1718    A text input to the model.1920  - `ResponseInputText object { text, type, prompt_cache_breakpoint }`2122    A text input to the model.2324    - `text: string`2526      The text input to the model.2728    - `type: "input_text"`2930      The type of the input item. Always `input_text`.3132      - `"input_text"`3334    - `prompt_cache_breakpoint: optional object { mode }`3536      Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.3738      - `mode: "explicit"`3940        The breakpoint mode. Always `explicit`.4142        - `"explicit"`4344  - `OutputText object { text, type }`4546    A text output from the model.4748    - `text: string`4950      The text output from the model.5152    - `type: "output_text"`5354      The type of the output text. Always `output_text`.5556      - `"output_text"`5758  - `InputImage object { image_url, type, detail }`5960    An image input block used within EvalItem content arrays.6162    - `image_url: string`6364      The URL of the image input.6566    - `type: "input_image"`6768      The type of the image input. Always `input_image`.6970      - `"input_image"`7172    - `detail: optional string`7374      The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.7576  - `ResponseInputAudio object { input_audio, type }`7778    An audio input to the model.7980    - `input_audio: object { data, format }`8182      - `data: string`8384        Base64-encoded audio data.8586      - `format: "mp3" or "wav"`8788        The format of the audio data. Currently supported formats are `mp3` and89        `wav`.9091        - `"mp3"`9293        - `"wav"`9495    - `type: "input_audio"`9697      The type of the input item. Always `input_audio`.9899      - `"input_audio"`100101### Label Model Grader102103- `LabelModelGrader object { input, labels, model, 3 more }`104105  A LabelModelGrader object which uses a model to assign labels to each item106  in the evaluation.107108  - `input: array of object { content, role, type }`109110    - `content: string or ResponseInputText or object { text, type }  or 3 more`111112      Inputs to the model - can contain template strings. Supports text, output text, input images, and input audio, either as a single item or an array of items.113114      - `TextInput = string`115116        A text input to the model.117118      - `ResponseInputText object { text, type, prompt_cache_breakpoint }`119120        A text input to the model.121122        - `text: string`123124          The text input to the model.125126        - `type: "input_text"`127128          The type of the input item. Always `input_text`.129130          - `"input_text"`131132        - `prompt_cache_breakpoint: optional object { mode }`133134          Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.135136          - `mode: "explicit"`137138            The breakpoint mode. Always `explicit`.139140            - `"explicit"`141142      - `OutputText object { text, type }`143144        A text output from the model.145146        - `text: string`147148          The text output from the model.149150        - `type: "output_text"`151152          The type of the output text. Always `output_text`.153154          - `"output_text"`155156      - `InputImage object { image_url, type, detail }`157158        An image input block used within EvalItem content arrays.159160        - `image_url: string`161162          The URL of the image input.163164        - `type: "input_image"`165166          The type of the image input. Always `input_image`.167168          - `"input_image"`169170        - `detail: optional string`171172          The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.173174      - `ResponseInputAudio object { input_audio, type }`175176        An audio input to the model.177178        - `input_audio: object { data, format }`179180          - `data: string`181182            Base64-encoded audio data.183184          - `format: "mp3" or "wav"`185186            The format of the audio data. Currently supported formats are `mp3` and187            `wav`.188189            - `"mp3"`190191            - `"wav"`192193        - `type: "input_audio"`194195          The type of the input item. Always `input_audio`.196197          - `"input_audio"`198199      - `GraderInputs = array of string or ResponseInputText or object { text, type }  or 2 more`200201        A list of inputs, each of which may be either an input text, output text, input202        image, or input audio object.203204        - `TextInput = string`205206          A text input to the model.207208        - `ResponseInputText object { text, type, prompt_cache_breakpoint }`209210          A text input to the model.211212        - `OutputText object { text, type }`213214          A text output from the model.215216          - `text: string`217218            The text output from the model.219220          - `type: "output_text"`221222            The type of the output text. Always `output_text`.223224            - `"output_text"`225226        - `InputImage object { image_url, type, detail }`227228          An image input block used within EvalItem content arrays.229230          - `image_url: string`231232            The URL of the image input.233234          - `type: "input_image"`235236            The type of the image input. Always `input_image`.237238            - `"input_image"`239240          - `detail: optional string`241242            The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.243244        - `ResponseInputAudio object { input_audio, type }`245246          An audio input to the model.247248    - `role: "user" or "assistant" or "system" or "developer"`249250      The role of the message input. One of `user`, `assistant`, `system`, or251      `developer`.252253      - `"user"`254255      - `"assistant"`256257      - `"system"`258259      - `"developer"`260261    - `type: optional "message"`262263      The type of the message input. Always `message`.264265      - `"message"`266267  - `labels: array of string`268269    The labels to assign to each item in the evaluation.270271  - `model: string`272273    The model to use for the evaluation. Must support structured outputs.274275  - `name: string`276277    The name of the grader.278279  - `passing_labels: array of string`280281    The labels that indicate a passing result. Must be a subset of labels.282283  - `type: "label_model"`284285    The object type, which is always `label_model`.286287    - `"label_model"`288289### Multi Grader290291- `MultiGrader object { calculate_output, graders, name, type }`292293  A MultiGrader object combines the output of multiple graders to produce a single score.294295  - `calculate_output: string`296297    A formula to calculate the output based on grader results.298299  - `graders: StringCheckGrader or TextSimilarityGrader or PythonGrader or 2 more`300301    A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.302303    - `StringCheckGrader object { input, name, operation, 2 more }`304305      A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.306307      - `input: string`308309        The input text. This may include template strings.310311      - `name: string`312313        The name of the grader.314315      - `operation: "eq" or "ne" or "like" or "ilike"`316317        The string check operation to perform. One of `eq`, `ne`, `like`, or `ilike`.318319        - `"eq"`320321        - `"ne"`322323        - `"like"`324325        - `"ilike"`326327      - `reference: string`328329        The reference text. This may include template strings.330331      - `type: "string_check"`332333        The object type, which is always `string_check`.334335        - `"string_check"`336337    - `TextSimilarityGrader object { evaluation_metric, input, name, 2 more }`338339      A TextSimilarityGrader object which grades text based on similarity metrics.340341      - `evaluation_metric: "cosine" or "fuzzy_match" or "bleu" or 8 more`342343        The evaluation metric to use. One of `cosine`, `fuzzy_match`, `bleu`,344        `gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`,345        or `rouge_l`.346347        - `"cosine"`348349        - `"fuzzy_match"`350351        - `"bleu"`352353        - `"gleu"`354355        - `"meteor"`356357        - `"rouge_1"`358359        - `"rouge_2"`360361        - `"rouge_3"`362363        - `"rouge_4"`364365        - `"rouge_5"`366367        - `"rouge_l"`368369      - `input: string`370371        The text being graded.372373      - `name: string`374375        The name of the grader.376377      - `reference: string`378379        The text being graded against.380381      - `type: "text_similarity"`382383        The type of grader.384385        - `"text_similarity"`386387    - `PythonGrader object { name, source, type, image_tag }`388389      A PythonGrader object that runs a python script on the input.390391      - `name: string`392393        The name of the grader.394395      - `source: string`396397        The source code of the python script.398399      - `type: "python"`400401        The object type, which is always `python`.402403        - `"python"`404405      - `image_tag: optional string`406407        The image tag to use for the python script.408409    - `ScoreModelGrader object { input, model, name, 3 more }`410411      A ScoreModelGrader object that uses a model to assign a score to the input.412413      - `input: array of object { content, role, type }`414415        The input messages evaluated by the grader. Supports text, output text, input image, and input audio content blocks, and may include template strings.416417        - `content: string or ResponseInputText or object { text, type }  or 3 more`418419          Inputs to the model - can contain template strings. Supports text, output text, input images, and input audio, either as a single item or an array of items.420421          - `TextInput = string`422423            A text input to the model.424425          - `ResponseInputText object { text, type, prompt_cache_breakpoint }`426427            A text input to the model.428429            - `text: string`430431              The text input to the model.432433            - `type: "input_text"`434435              The type of the input item. Always `input_text`.436437              - `"input_text"`438439            - `prompt_cache_breakpoint: optional object { mode }`440441              Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.442443              - `mode: "explicit"`444445                The breakpoint mode. Always `explicit`.446447                - `"explicit"`448449          - `OutputText object { text, type }`450451            A text output from the model.452453            - `text: string`454455              The text output from the model.456457            - `type: "output_text"`458459              The type of the output text. Always `output_text`.460461              - `"output_text"`462463          - `InputImage object { image_url, type, detail }`464465            An image input block used within EvalItem content arrays.466467            - `image_url: string`468469              The URL of the image input.470471            - `type: "input_image"`472473              The type of the image input. Always `input_image`.474475              - `"input_image"`476477            - `detail: optional string`478479              The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.480481          - `ResponseInputAudio object { input_audio, type }`482483            An audio input to the model.484485            - `input_audio: object { data, format }`486487              - `data: string`488489                Base64-encoded audio data.490491              - `format: "mp3" or "wav"`492493                The format of the audio data. Currently supported formats are `mp3` and494                `wav`.495496                - `"mp3"`497498                - `"wav"`499500            - `type: "input_audio"`501502              The type of the input item. Always `input_audio`.503504              - `"input_audio"`505506          - `GraderInputs = array of string or ResponseInputText or object { text, type }  or 2 more`507508            A list of inputs, each of which may be either an input text, output text, input509            image, or input audio object.510511            - `TextInput = string`512513              A text input to the model.514515            - `ResponseInputText object { text, type, prompt_cache_breakpoint }`516517              A text input to the model.518519            - `OutputText object { text, type }`520521              A text output from the model.522523              - `text: string`524525                The text output from the model.526527              - `type: "output_text"`528529                The type of the output text. Always `output_text`.530531                - `"output_text"`532533            - `InputImage object { image_url, type, detail }`534535              An image input block used within EvalItem content arrays.536537              - `image_url: string`538539                The URL of the image input.540541              - `type: "input_image"`542543                The type of the image input. Always `input_image`.544545                - `"input_image"`546547              - `detail: optional string`548549                The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.550551            - `ResponseInputAudio object { input_audio, type }`552553              An audio input to the model.554555        - `role: "user" or "assistant" or "system" or "developer"`556557          The role of the message input. One of `user`, `assistant`, `system`, or558          `developer`.559560          - `"user"`561562          - `"assistant"`563564          - `"system"`565566          - `"developer"`567568        - `type: optional "message"`569570          The type of the message input. Always `message`.571572          - `"message"`573574      - `model: string`575576        The model to use for the evaluation.577578      - `name: string`579580        The name of the grader.581582      - `type: "score_model"`583584        The object type, which is always `score_model`.585586        - `"score_model"`587588      - `range: optional array of number`589590        The range of the score. Defaults to `[0, 1]`.591592      - `sampling_params: optional object { max_completions_tokens, reasoning_effort, seed, 2 more }`593594        The sampling parameters for the model.595596        - `max_completions_tokens: optional number or null`597598          The maximum number of tokens the grader model may generate in its response.599600        - `reasoning_effort: optional ReasoningEffort or null`601602          Constrains effort on reasoning for reasoning models. Currently supported603          values are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`.604          Reducing reasoning effort can result in faster responses and fewer tokens605          used on reasoning in a response. Not all reasoning models support every606          value. See the607          [reasoning guide](/api/docs/guides/reasoning)608          for model-specific support.609610          - `"none"`611612          - `"minimal"`613614          - `"low"`615616          - `"medium"`617618          - `"high"`619620          - `"xhigh"`621622          - `"max"`623624        - `seed: optional number or null`625626          A seed value to initialize the randomness, during sampling.627628        - `temperature: optional number or null`629630          A higher temperature increases randomness in the outputs.631632        - `top_p: optional number or null`633634          An alternative to temperature for nucleus sampling; 1.0 includes all tokens.635636    - `LabelModelGrader object { input, labels, model, 3 more }`637638      A LabelModelGrader object which uses a model to assign labels to each item639      in the evaluation.640641      - `input: array of object { content, role, type }`642643        - `content: string or ResponseInputText or object { text, type }  or 3 more`644645          Inputs to the model - can contain template strings. Supports text, output text, input images, and input audio, either as a single item or an array of items.646647          - `TextInput = string`648649            A text input to the model.650651          - `ResponseInputText object { text, type, prompt_cache_breakpoint }`652653            A text input to the model.654655          - `OutputText object { text, type }`656657            A text output from the model.658659            - `text: string`660661              The text output from the model.662663            - `type: "output_text"`664665              The type of the output text. Always `output_text`.666667              - `"output_text"`668669          - `InputImage object { image_url, type, detail }`670671            An image input block used within EvalItem content arrays.672673            - `image_url: string`674675              The URL of the image input.676677            - `type: "input_image"`678679              The type of the image input. Always `input_image`.680681              - `"input_image"`682683            - `detail: optional string`684685              The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.686687          - `ResponseInputAudio object { input_audio, type }`688689            An audio input to the model.690691          - `GraderInputs = array of string or ResponseInputText or object { text, type }  or 2 more`692693            A list of inputs, each of which may be either an input text, output text, input694            image, or input audio object.695696        - `role: "user" or "assistant" or "system" or "developer"`697698          The role of the message input. One of `user`, `assistant`, `system`, or699          `developer`.700701          - `"user"`702703          - `"assistant"`704705          - `"system"`706707          - `"developer"`708709        - `type: optional "message"`710711          The type of the message input. Always `message`.712713          - `"message"`714715      - `labels: array of string`716717        The labels to assign to each item in the evaluation.718719      - `model: string`720721        The model to use for the evaluation. Must support structured outputs.722723      - `name: string`724725        The name of the grader.726727      - `passing_labels: array of string`728729        The labels that indicate a passing result. Must be a subset of labels.730731      - `type: "label_model"`732733        The object type, which is always `label_model`.734735        - `"label_model"`736737  - `name: string`738739    The name of the grader.740741  - `type: "multi"`742743    The object type, which is always `multi`.744745    - `"multi"`746747### Python Grader748749- `PythonGrader object { name, source, type, image_tag }`750751  A PythonGrader object that runs a python script on the input.752753  - `name: string`754755    The name of the grader.756757  - `source: string`758759    The source code of the python script.760761  - `type: "python"`762763    The object type, which is always `python`.764765    - `"python"`766767  - `image_tag: optional string`768769    The image tag to use for the python script.770771### Score Model Grader772773- `ScoreModelGrader object { input, model, name, 3 more }`774775  A ScoreModelGrader object that uses a model to assign a score to the input.776777  - `input: array of object { content, role, type }`778779    The input messages evaluated by the grader. Supports text, output text, input image, and input audio content blocks, and may include template strings.780781    - `content: string or ResponseInputText or object { text, type }  or 3 more`782783      Inputs to the model - can contain template strings. Supports text, output text, input images, and input audio, either as a single item or an array of items.784785      - `TextInput = string`786787        A text input to the model.788789      - `ResponseInputText object { text, type, prompt_cache_breakpoint }`790791        A text input to the model.792793        - `text: string`794795          The text input to the model.796797        - `type: "input_text"`798799          The type of the input item. Always `input_text`.800801          - `"input_text"`802803        - `prompt_cache_breakpoint: optional object { mode }`804805          Marks the exact end of a reusable prompt prefix. The breakpoint inherits its TTL from the request's `prompt_cache_options.ttl`; the boundary is not rounded to a token block.806807          - `mode: "explicit"`808809            The breakpoint mode. Always `explicit`.810811            - `"explicit"`812813      - `OutputText object { text, type }`814815        A text output from the model.816817        - `text: string`818819          The text output from the model.820821        - `type: "output_text"`822823          The type of the output text. Always `output_text`.824825          - `"output_text"`826827      - `InputImage object { image_url, type, detail }`828829        An image input block used within EvalItem content arrays.830831        - `image_url: string`832833          The URL of the image input.834835        - `type: "input_image"`836837          The type of the image input. Always `input_image`.838839          - `"input_image"`840841        - `detail: optional string`842843          The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.844845      - `ResponseInputAudio object { input_audio, type }`846847        An audio input to the model.848849        - `input_audio: object { data, format }`850851          - `data: string`852853            Base64-encoded audio data.854855          - `format: "mp3" or "wav"`856857            The format of the audio data. Currently supported formats are `mp3` and858            `wav`.859860            - `"mp3"`861862            - `"wav"`863864        - `type: "input_audio"`865866          The type of the input item. Always `input_audio`.867868          - `"input_audio"`869870      - `GraderInputs = array of string or ResponseInputText or object { text, type }  or 2 more`871872        A list of inputs, each of which may be either an input text, output text, input873        image, or input audio object.874875        - `TextInput = string`876877          A text input to the model.878879        - `ResponseInputText object { text, type, prompt_cache_breakpoint }`880881          A text input to the model.882883        - `OutputText object { text, type }`884885          A text output from the model.886887          - `text: string`888889            The text output from the model.890891          - `type: "output_text"`892893            The type of the output text. Always `output_text`.894895            - `"output_text"`896897        - `InputImage object { image_url, type, detail }`898899          An image input block used within EvalItem content arrays.900901          - `image_url: string`902903            The URL of the image input.904905          - `type: "input_image"`906907            The type of the image input. Always `input_image`.908909            - `"input_image"`910911          - `detail: optional string`912913            The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.914915        - `ResponseInputAudio object { input_audio, type }`916917          An audio input to the model.918919    - `role: "user" or "assistant" or "system" or "developer"`920921      The role of the message input. One of `user`, `assistant`, `system`, or922      `developer`.923924      - `"user"`925926      - `"assistant"`927928      - `"system"`929930      - `"developer"`931932    - `type: optional "message"`933934      The type of the message input. Always `message`.935936      - `"message"`937938  - `model: string`939940    The model to use for the evaluation.941942  - `name: string`943944    The name of the grader.945946  - `type: "score_model"`947948    The object type, which is always `score_model`.949950    - `"score_model"`951952  - `range: optional array of number`953954    The range of the score. Defaults to `[0, 1]`.955956  - `sampling_params: optional object { max_completions_tokens, reasoning_effort, seed, 2 more }`957958    The sampling parameters for the model.959960    - `max_completions_tokens: optional number or null`961962      The maximum number of tokens the grader model may generate in its response.963964    - `reasoning_effort: optional ReasoningEffort or null`965966      Constrains effort on reasoning for reasoning models. Currently supported967      values are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`.968      Reducing reasoning effort can result in faster responses and fewer tokens969      used on reasoning in a response. Not all reasoning models support every970      value. See the971      [reasoning guide](/api/docs/guides/reasoning)972      for model-specific support.973974      - `"none"`975976      - `"minimal"`977978      - `"low"`979980      - `"medium"`981982      - `"high"`983984      - `"xhigh"`985986      - `"max"`987988    - `seed: optional number or null`989990      A seed value to initialize the randomness, during sampling.991992    - `temperature: optional number or null`993994      A higher temperature increases randomness in the outputs.995996    - `top_p: optional number or null`997998      An alternative to temperature for nucleus sampling; 1.0 includes all tokens.9991000### String Check Grader10011002- `StringCheckGrader object { input, name, operation, 2 more }`10031004  A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.10051006  - `input: string`10071008    The input text. This may include template strings.10091010  - `name: string`10111012    The name of the grader.10131014  - `operation: "eq" or "ne" or "like" or "ilike"`10151016    The string check operation to perform. One of `eq`, `ne`, `like`, or `ilike`.10171018    - `"eq"`10191020    - `"ne"`10211022    - `"like"`10231024    - `"ilike"`10251026  - `reference: string`10271028    The reference text. This may include template strings.10291030  - `type: "string_check"`10311032    The object type, which is always `string_check`.10331034    - `"string_check"`10351036### Text Similarity Grader10371038- `TextSimilarityGrader object { evaluation_metric, input, name, 2 more }`10391040  A TextSimilarityGrader object which grades text based on similarity metrics.10411042  - `evaluation_metric: "cosine" or "fuzzy_match" or "bleu" or 8 more`10431044    The evaluation metric to use. One of `cosine`, `fuzzy_match`, `bleu`,1045    `gleu`, `meteor`, `rouge_1`, `rouge_2`, `rouge_3`, `rouge_4`, `rouge_5`,1046    or `rouge_l`.10471048    - `"cosine"`10491050    - `"fuzzy_match"`10511052    - `"bleu"`10531054    - `"gleu"`10551056    - `"meteor"`10571058    - `"rouge_1"`10591060    - `"rouge_2"`10611062    - `"rouge_3"`10631064    - `"rouge_4"`10651066    - `"rouge_5"`10671068    - `"rouge_l"`10691070  - `input: string`10711072    The text being graded.10731074  - `name: string`10751076    The name of the grader.10771078  - `reference: string`10791080    The text being graded against.10811082  - `type: "text_similarity"`10831084    The type of grader.10851086    - `"text_similarity"`1087
Files main
Menu

Theme