Debugging InvalidIndexError in Arize Phoenix with LlamaIndex
I'm using Arize Phoenix with the latest version of LlamaIndex and tracing is working fine. Now that I'm trying to setup evals I'm getting the following error when running queries_df = get_qa_with_reference(px.active_session()) I'm not really sure where to start debugging this.
{
"name": "InvalidIndexError",
"message": "Reindexing only valid with uniquely valued Index objects",
"stack": "---------------------------------------------------------------------------
InvalidIndexError Traceback (most recent call last)
Cell In[56], line 4
1 from phoenix.session.evaluation import get_qa_with_reference, get_retrieved_documents
3 retrieved_documents_df = get_retrieved_documents(px.active_session())
----> 4 queries_df = get_qa_with_reference(px.active_session())
File ~/Development/agent/.venv/lib/python3.12/site-packages/phoenix/trace/dsl/helpers.py:68, in get_qa_with_reference(obj, start_time, stop_time, project_name)
61 def get_qa_with_reference(
62 obj: CanQuerySpans,
63 start_time: Optional[datetime] = None,
64 stop_time: Optional[datetime] = None,
65 project_name: Optional[str] = None,
66 ) -> pd.DataFrame:
67 project_name = project_name or get_env_project_name()
---> 68 return pd.concat(
69 cast(
70 List[pd.DataFrame],
71 obj.query_spans(
72 SpanQuery().select(**IO).where(IS_ROOT),
73 SpanQuery()
74 .where(\"span_kind == 'RETRIEVER'\")
75 .select(span_id=\"parent_id\")
76 .concat(
77 RETRIEVAL_DOCUMENTS,
78 reference=DOCUMENT_CONTENT,
79 ),
80 start_time=start_time,
81 stop_time=stop_time,
82 project_name=project_name,
83 ),
84 ),
85 axis=1,
86 join=\"inner\",
87 )
File ~/Development/agent/.venv/lib/python3.12/site-packages/pandas/core/reshape/concat.py:395, in concat(objs, axis, join, ignore_index, keys, levels, names, verify_integrity, sort, copy)
380 copy = False
382 op = _Concatenator(
383 objs,
384 axis=axis,
(...)
392 sort=sort,
393 )
--> 395 return op.get_result()
File ~/Development/agent/.venv/lib/python3.12/site-packages/pandas/core/reshape/concat.py:680, in _Concatenator.get_result(self)
678 obj_labels = obj.axes[1 - ax]
679 if not new_labels.equals(obj_labels):
--> 680 indexers[ax] = obj_labels.get_indexer(new_labels)
682 mgrs_indexers.append((obj._mgr, indexers))
684 new_data = concatenate_managers(
685 mgrs_indexers, self.new_axes, concat_axis=self.bm_axis, copy=self.copy
686 )
File ~/Development/agent/.venv/lib/python3.12/site-packages/pandas/core/indexes/base.py:3885, in Index.get_indexer(self, target, method, limit, tolerance)
3882 self._check_indexing_method(method, limit, tolerance)
3884 if not self._index_as_unique:
-> 3885 raise InvalidIndexError(self._requires_unique_msg)
3887 if len(target) == 0:
3888 return np.array([], dtype=np.intp)
InvalidIndexError: Reindexing only valid with uniquely valued Index objects"
}