SPB Git

Repository Public

retrieve.md 11.3 KB 466 lines markdown

1> For the complete documentation index, see [llms.txt](/llms.txt). Markdown versions of documentation pages are available by appending `.md` to the page URL.23## Get an eval45**get** `/evals/{eval_id}`67Get an evaluation by ID.89### Path Parameters1011- `eval_id: string`1213### Returns1415- `id: string`1617  Unique identifier for the evaluation.1819- `created_at: number`2021  The Unix timestamp (in seconds) for when the eval was created.2223- `data_source_config: EvalCustomDataSourceConfig or object { schema, type, metadata }  or EvalStoredCompletionsDataSourceConfig`2425  Configuration of data sources used in runs of the evaluation.2627  - `EvalCustomDataSourceConfig object { schema, type }`2829    A CustomDataSourceConfig which specifies the schema of your `item` and optionally `sample` namespaces.30    The response schema defines the shape of the data that will be:3132    - Used to define your testing criteria and33    - What data is required when creating a run3435    - `schema: map[unknown]`3637      The json schema for the run data source items.38      Learn how to build JSON schemas [here](https://json-schema.org/).3940    - `type: "custom"`4142      The type of data source. Always `custom`.4344      - `"custom"`4546  - `LogsDataSourceConfig object { schema, type, metadata }`4748    A LogsDataSourceConfig which specifies the metadata property of your logs query.49    This is usually metadata like `usecase=chatbot` or `prompt-version=v2`, etc.50    The schema returned by this data source config is used to defined what variables are available in your evals.51    `item` and `sample` are both defined when using this data source config.5253    - `schema: map[unknown]`5455      The json schema for the run data source items.56      Learn how to build JSON schemas [here](https://json-schema.org/).5758    - `type: "logs"`5960      The type of data source. Always `logs`.6162      - `"logs"`6364    - `metadata: optional Metadata or null`6566      Set of 16 key-value pairs that can be attached to an object. This can be67      useful for storing additional information about the object in a structured68      format, and querying for objects via API or the dashboard.6970      Keys are strings with a maximum length of 64 characters. Values are strings71      with a maximum length of 512 characters.7273  - `EvalStoredCompletionsDataSourceConfig object { schema, type, metadata }`7475    Deprecated in favor of LogsDataSourceConfig.7677    - `schema: map[unknown]`7879      The json schema for the run data source items.80      Learn how to build JSON schemas [here](https://json-schema.org/).8182    - `type: "stored_completions"`8384      The type of data source. Always `stored_completions`.8586      - `"stored_completions"`8788    - `metadata: optional Metadata or null`8990      Set of 16 key-value pairs that can be attached to an object. This can be91      useful for storing additional information about the object in a structured92      format, and querying for objects via API or the dashboard.9394      Keys are strings with a maximum length of 64 characters. Values are strings95      with a maximum length of 512 characters.9697- `metadata: Metadata or null`9899  Set of 16 key-value pairs that can be attached to an object. This can be100  useful for storing additional information about the object in a structured101  format, and querying for objects via API or the dashboard.102103  Keys are strings with a maximum length of 64 characters. Values are strings104  with a maximum length of 512 characters.105106- `name: string`107108  The name of the evaluation.109110- `object: "eval"`111112  The object type.113114  - `"eval"`115116- `testing_criteria: array of LabelModelGrader or StringCheckGrader or TextSimilarityGrader or 2 more`117118  A list of testing criteria.119120  - `LabelModelGrader object { input, labels, model, 3 more }`121122    A LabelModelGrader object which uses a model to assign labels to each item123    in the evaluation.124125    - `input: array of object { content, role, type }`126127      - `content: string or ResponseInputText or object { text, type }  or 3 more`128129        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.130131        - `TextInput = string`132133          A text input to the model.134135        - `ResponseInputText object { text, type, prompt_cache_breakpoint }`136137          A text input to the model.138139          - `text: string`140141            The text input to the model.142143          - `type: "input_text"`144145            The type of the input item. Always `input_text`.146147            - `"input_text"`148149          - `prompt_cache_breakpoint: optional object { mode }`150151            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.152153            - `mode: "explicit"`154155              The breakpoint mode. Always `explicit`.156157              - `"explicit"`158159        - `OutputText object { text, type }`160161          A text output from the model.162163          - `text: string`164165            The text output from the model.166167          - `type: "output_text"`168169            The type of the output text. Always `output_text`.170171            - `"output_text"`172173        - `InputImage object { image_url, type, detail }`174175          An image input block used within EvalItem content arrays.176177          - `image_url: string`178179            The URL of the image input.180181          - `type: "input_image"`182183            The type of the image input. Always `input_image`.184185            - `"input_image"`186187          - `detail: optional string`188189            The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.190191        - `ResponseInputAudio object { input_audio, type }`192193          An audio input to the model.194195          - `input_audio: object { data, format }`196197            - `data: string`198199              Base64-encoded audio data.200201            - `format: "mp3" or "wav"`202203              The format of the audio data. Currently supported formats are `mp3` and204              `wav`.205206              - `"mp3"`207208              - `"wav"`209210          - `type: "input_audio"`211212            The type of the input item. Always `input_audio`.213214            - `"input_audio"`215216        - `GraderInputs = array of string or ResponseInputText or object { text, type }  or 2 more`217218          A list of inputs, each of which may be either an input text, output text, input219          image, or input audio object.220221          - `TextInput = string`222223            A text input to the model.224225          - `ResponseInputText object { text, type, prompt_cache_breakpoint }`226227            A text input to the model.228229          - `OutputText object { text, type }`230231            A text output from the model.232233            - `text: string`234235              The text output from the model.236237            - `type: "output_text"`238239              The type of the output text. Always `output_text`.240241              - `"output_text"`242243          - `InputImage object { image_url, type, detail }`244245            An image input block used within EvalItem content arrays.246247            - `image_url: string`248249              The URL of the image input.250251            - `type: "input_image"`252253              The type of the image input. Always `input_image`.254255              - `"input_image"`256257            - `detail: optional string`258259              The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.260261          - `ResponseInputAudio object { input_audio, type }`262263            An audio input to the model.264265      - `role: "user" or "assistant" or "system" or "developer"`266267        The role of the message input. One of `user`, `assistant`, `system`, or268        `developer`.269270        - `"user"`271272        - `"assistant"`273274        - `"system"`275276        - `"developer"`277278      - `type: optional "message"`279280        The type of the message input. Always `message`.281282        - `"message"`283284    - `labels: array of string`285286      The labels to assign to each item in the evaluation.287288    - `model: string`289290      The model to use for the evaluation. Must support structured outputs.291292    - `name: string`293294      The name of the grader.295296    - `passing_labels: array of string`297298      The labels that indicate a passing result. Must be a subset of labels.299300    - `type: "label_model"`301302      The object type, which is always `label_model`.303304      - `"label_model"`305306  - `StringCheckGrader object { input, name, operation, 2 more }`307308    A StringCheckGrader object that performs a string comparison between input and reference using a specified operation.309310    - `input: string`311312      The input text. This may include template strings.313314    - `name: string`315316      The name of the grader.317318    - `operation: "eq" or "ne" or "like" or "ilike"`319320      The string check operation to perform. One of `eq`, `ne`, `like`, or `ilike`.321322      - `"eq"`323324      - `"ne"`325326      - `"like"`327328      - `"ilike"`329330    - `reference: string`331332      The reference text. This may include template strings.333334    - `type: "string_check"`335336      The object type, which is always `string_check`.337338      - `"string_check"`339340  - `TextSimilarityGrader = TextSimilarityGrader`341342    A TextSimilarityGrader object which grades text based on similarity metrics.343344    - `pass_threshold: number`345346      The threshold for the score.347348  - `PythonGrader = PythonGrader`349350    A PythonGrader object that runs a python script on the input.351352    - `pass_threshold: optional number`353354      The threshold for the score.355356  - `ScoreModelGrader = ScoreModelGrader`357358    A ScoreModelGrader object that uses a model to assign a score to the input.359360    - `pass_threshold: optional number`361362      The threshold for the score.363364### Example365366```http367curl https://api.openai.com/v1/evals/$EVAL_ID \368    -H "Authorization: Bearer $OPENAI_API_KEY"369```370371#### Response372373```json374{375  "id": "id",376  "created_at": 0,377  "data_source_config": {378    "schema": {379      "foo": "bar"380    },381    "type": "custom"382  },383  "metadata": {384    "foo": "string"385  },386  "name": "Chatbot effectiveness Evaluation",387  "object": "eval",388  "testing_criteria": [389    {390      "input": [391        {392          "content": "string",393          "role": "user",394          "type": "message"395        }396      ],397      "labels": [398        "string"399      ],400      "model": "model",401      "name": "name",402      "passing_labels": [403        "string"404      ],405      "type": "label_model"406    }407  ]408}409```410411### Example412413```http414curl https://api.openai.com/v1/evals/eval_67abd54d9b0081909a86353f6fb9317a \415  -H "Authorization: Bearer $OPENAI_API_KEY" \416  -H "Content-Type: application/json"417```418419#### Response420421```json422{423  "object": "eval",424  "id": "eval_67abd54d9b0081909a86353f6fb9317a",425  "data_source_config": {426    "type": "custom",427    "schema": {428      "type": "object",429      "properties": {430        "item": {431          "type": "object",432          "properties": {433            "input": {434              "type": "string"435            },436            "ground_truth": {437              "type": "string"438            }439          },440          "required": [441            "input",442            "ground_truth"443          ]444        }445      },446      "required": [447        "item"448      ]449    }450  },451  "testing_criteria": [452    {453      "name": "String check",454      "id": "String check-2eaf2d8d-d649-4335-8148-9535a7ca73c2",455      "type": "string_check",456      "input": "{{item.input}}",457      "reference": "{{item.ground_truth}}",458      "operation": "eq"459    }460  ],461  "name": "External Data Eval",462  "created_at": 1739314509,463  "metadata": {},464}465```466
Files main
Menu

Theme