Skip to content

Commit

Permalink
fix: handle None values in the reference column in the `get_qa_wi…
Browse files Browse the repository at this point in the history
…th_reference` helper (#4309)
  • Loading branch information
bhardwaj-vipul authored Aug 21, 2024
1 parent 74dd3c7 commit 58685b7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/phoenix/trace/dsl/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ def get_qa_with_reference(
# Consolidate duplicate rows via concatenation. This can happen if there are multiple
# retriever spans in the same trace. We simply concatenate all of them (in no particular
# order) into a single row.
ref = df_docs.groupby("context.trace_id")["reference"].apply(lambda x: separator.join(x))
ref = df_docs.groupby("context.trace_id")["reference"].apply(
lambda x: separator.join(x.dropna())
)
df_ref = pd.DataFrame({"reference": ref})
df_qa_ref = pd.concat([df_qa, df_ref], axis=1, join="inner").set_index("context.span_id")
return df_qa_ref

0 comments on commit 58685b7

Please sign in to comment.