arize-phoenix 3.16.1__py3-none-any.whl → 3.16.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of arize-phoenix might be problematic. Click here for more details.

@@ -1,3 +1,4 @@
1
+ from datetime import datetime
1
2
  from typing import List, Optional, Protocol, Union, cast
2
3
 
3
4
  import pandas as pd
@@ -24,11 +25,20 @@ IS_RETRIEVER = "span_kind == 'RETRIEVER'"
24
25
  class CanQuerySpans(Protocol):
25
26
  # Implemented by phoenix.session.client.Client
26
27
  def query_spans(
27
- self, *query: SpanQuery, project_name: Optional[str] = None
28
+ self,
29
+ *query: SpanQuery,
30
+ start_time: Optional[datetime] = None,
31
+ stop_time: Optional[datetime] = None,
32
+ project_name: Optional[str] = None,
28
33
  ) -> Optional[Union[pd.DataFrame, List[pd.DataFrame]]]: ...
29
34
 
30
35
 
31
- def get_retrieved_documents(obj: CanQuerySpans, project_name: Optional[str] = None) -> pd.DataFrame:
36
+ def get_retrieved_documents(
37
+ obj: CanQuerySpans,
38
+ start_time: Optional[datetime] = None,
39
+ stop_time: Optional[datetime] = None,
40
+ project_name: Optional[str] = None,
41
+ ) -> pd.DataFrame:
32
42
  project_name = project_name or get_env_project_name()
33
43
  return cast(
34
44
  pd.DataFrame,
@@ -41,12 +51,19 @@ def get_retrieved_documents(obj: CanQuerySpans, project_name: Optional[str] = No
41
51
  reference=DOCUMENT_CONTENT,
42
52
  document_score=DOCUMENT_SCORE,
43
53
  ),
54
+ start_time=start_time,
55
+ stop_time=stop_time,
44
56
  project_name=project_name,
45
57
  ),
46
58
  )
47
59
 
48
60
 
49
- def get_qa_with_reference(obj: CanQuerySpans, project_name: Optional[str] = None) -> pd.DataFrame:
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:
50
67
  project_name = project_name or get_env_project_name()
51
68
  return pd.concat(
52
69
  cast(
@@ -60,6 +77,8 @@ def get_qa_with_reference(obj: CanQuerySpans, project_name: Optional[str] = None
60
77
  RETRIEVAL_DOCUMENTS,
61
78
  reference=DOCUMENT_CONTENT,
62
79
  ),
80
+ start_time=start_time,
81
+ stop_time=stop_time,
63
82
  project_name=project_name,
64
83
  ),
65
84
  ),
@@ -14,6 +14,7 @@ from typing import (
14
14
  Mapping,
15
15
  Optional,
16
16
  Sequence,
17
+ Sized,
17
18
  Tuple,
18
19
  cast,
19
20
  )
@@ -125,7 +126,7 @@ class Explosion(Projection):
125
126
  return replace(self, primary_index_key=primary_index_key)
126
127
 
127
128
  def __call__(self, span: Span) -> Iterator[Dict[str, Any]]:
128
- if not isinstance(seq := self.value(span), Sequence):
129
+ if not isinstance(seq := self.value(span), Iterable):
129
130
  return
130
131
  has_mapping = False
131
132
  for item in seq:
@@ -193,7 +194,7 @@ class Concatenation(Projection):
193
194
  return replace(self, separator=separator)
194
195
 
195
196
  def __call__(self, span: Span) -> Iterator[Tuple[str, str]]:
196
- if not isinstance(seq := self.value(span), Sequence):
197
+ if not isinstance(seq := self.value(span), Iterable):
197
198
  return
198
199
  if not self.kwargs:
199
200
  yield self.key, self.separator.join(map(str, seq))
@@ -282,12 +283,12 @@ class SpanQuery:
282
283
  spans = filter(self._filter, spans)
283
284
  if self._explode:
284
285
  spans = filter(
285
- lambda span: (isinstance(seq := self._explode.value(span), Sequence) and len(seq)),
286
+ lambda span: (isinstance(seq := self._explode.value(span), Sized) and len(seq)),
286
287
  spans,
287
288
  )
288
289
  if self._concat:
289
290
  spans = filter(
290
- lambda span: (isinstance(seq := self._concat.value(span), Sequence) and len(seq)),
291
+ lambda span: (isinstance(seq := self._concat.value(span), Sized) and len(seq)),
291
292
  spans,
292
293
  )
293
294
  if not (self._select or self._explode or self._concat):
phoenix/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "3.16.1"
1
+ __version__ = "3.16.3"