annotate.extract_json_response
annotate.extract_json_response(
response,
annotation_type,
min_value=None,
max_value=None,
options=None,
label_options=None,
text=None,
)Extract and validate JSON response based on annotation type
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| response | Raw model response text that should contain a JSON object. | required | |
| annotation_type | Annotation type string such as "dropdown" or "likert". |
required | |
| min_value | Optional integer lower bound for Likert annotations. | None |
|
| max_value | Optional integer upper bound for Likert annotations. | None |
|
| options | Optional dropdown option list used to normalize categorical labels. | None |
|
| label_options | Allowed labels for span annotations. | None |
|
| text | Source text for span annotations (used to validate offsets). | None |
Returns
| Name | Type | Description |
|---|---|---|
| Parsed response value coerced into the expected annotation format. For | ||
annotation_type == "span" this is a list of span dicts. |