To get annotations for a specific span_id via code, use the Phoenix client’s get_span_annotations_dataframe method in Python, or the getSpanAnnotations function in TypeScript. Both allow you to retrieve all annotations for given span IDs within a project. Example for Python:
```
from phoenix.client import Client
client = Client()
annotations = client.spans.get_span_annotations_dataframe(
span_ids=[span_id], # replace with your span_id
project_identifier="your_project"
)
```
For TypeScript, use:
```
import { getSpanAnnotations } from '@arizeai/phoenix-client';
const result = await getSpanAnnotations({
client,
project: { projectName: "your_project" },
spanIds: [spanId],
limit: 100
});
```
According to <https://arize.com/docs/phoenix/sdk-api-reference/python/arize-phoenix-client#«Raa6jtt9lffffffb»|Phoenix Python SDK docs> and <https://arize-ai.github.io/phoenix/functions/_arizeai_phoenix-client.spans_getSpanAnnotations.getSpanAnnotations.html|TypeScript API docs>, this will return all annotations for the specified span.
Would you like more detail?
Sources:
- <https://arize.com/docs/phoenix/sdk-api-reference/python/arize-phoenix-client#«Raa6jtt9lffffffb»|https://arize.com/docs/phoenix/sdk-api-reference/python/arize-phoenix-client#«Raa6jtt9lffffffb»>
- <https://arize-ai.github.io/phoenix/functions/_arizeai_phoenix-client.spans_getSpanAnnotations.getSpanAnnotations.html|https://arize-ai.github.io/phoenix/functions/_arizeai_phoenix-client.spans_getSpanAnnotations.getSpanAnnotations.html>