Skip to content

Commit

Permalink
Add project name to client helper functions
Browse files Browse the repository at this point in the history
  • Loading branch information
anticorrelator committed Mar 14, 2024
1 parent ced4e75 commit b2b8817
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/phoenix/trace/dsl/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@


class CanQuerySpans(Protocol):
# Implemented by phoenix.session.client.Client
def query_spans(
self, *query: SpanQuery
self, *query: SpanQuery, project_name: Optional[str] = None
) -> Optional[Union[pd.DataFrame, List[pd.DataFrame]]]: ...


def get_retrieved_documents(obj: CanQuerySpans) -> pd.DataFrame:
def get_retrieved_documents(obj: CanQuerySpans, project_name: Optional[str] = None) -> pd.DataFrame:
return cast(
pd.DataFrame,
obj.query_spans(
Expand All @@ -37,12 +38,13 @@ def get_retrieved_documents(obj: CanQuerySpans) -> pd.DataFrame:
RETRIEVAL_DOCUMENTS,
reference=DOCUMENT_CONTENT,
document_score=DOCUMENT_SCORE,
)
),
project_name=project_name,
),
)


def get_qa_with_reference(obj: CanQuerySpans) -> pd.DataFrame:
def get_qa_with_reference(obj: CanQuerySpans, project_name: Optional[str] = None) -> pd.DataFrame:
return pd.concat(
cast(
List[pd.DataFrame],
Expand All @@ -55,6 +57,7 @@ def get_qa_with_reference(obj: CanQuerySpans) -> pd.DataFrame:
RETRIEVAL_DOCUMENTS,
reference=DOCUMENT_CONTENT,
),
project_name=project_name,
),
),
axis=1,
Expand Down

0 comments on commit b2b8817

Please sign in to comment.