- build new LLM judges
- form the basis for new datasets
- help identify ideas for improving your application
Pulling Spans
trace_annotations in place of
annotations. Spans are returned when the trace they belong to carries a
matching annotation.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Span annotations can be an extremely valuable basis for improving your application. The Phoenix client provides useful ways to pull down spans and their associated annotations.
from phoenix.client import Client
client = Client()
spans = client.spans.get_spans_dataframe(
project_identifier="default", # you can also pass a project id
)
from phoenix.client import Client
from phoenix.client.types.spans import SpanQuery
client = Client()
query = SpanQuery().where("annotations['correctness']")
spans = client.spans.get_spans_dataframe(
query=query,
project_identifier="default", # you can also pass a project id
)
from phoenix.client import Client
from phoenix.client.types.spans import SpanQuery
client = Client()
query = SpanQuery().where("annotations['correctness'].score == 1")
# query = SpanQuery().where("annotations['correctness'].label == 'correct'")
spans = client.spans.get_spans_dataframe(
query=query,
project_identifier="default", # you can also pass a project id
)
trace_annotations in place of
annotations. Spans are returned when the trace they belong to carries a
matching annotation.
from phoenix.client import Client
from phoenix.client.types.spans import SpanQuery
client = Client()
query = SpanQuery().where("trace_annotations['quality'].score >= 0.5")
# query = SpanQuery().where("trace_annotations['quality'].label == 'good'")
spans = client.spans.get_spans_dataframe(
query=query,
project_identifier="default", # you can also pass a project id
)
annotations = client.spans.get_span_annotations_dataframe(
spans_dataframe=spans,
project_identifier="default",
)
annotations = client.spans.get_span_annotations_dataframe(
span_ids=list(spans.index),
project_identifier="default",
)
annotations.join(spans, how="left")
Was this page helpful?
