arize-phoenix 2.7.0__py3-none-any.whl → 2.8.0__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.
- {arize_phoenix-2.7.0.dist-info → arize_phoenix-2.8.0.dist-info}/METADATA +5 -2
- {arize_phoenix-2.7.0.dist-info → arize_phoenix-2.8.0.dist-info}/RECORD +26 -26
- {arize_phoenix-2.7.0.dist-info → arize_phoenix-2.8.0.dist-info}/WHEEL +1 -1
- phoenix/exceptions.py +4 -0
- phoenix/experimental/evals/functions/classify.py +1 -1
- phoenix/experimental/evals/models/anthropic.py +27 -22
- phoenix/experimental/evals/models/base.py +1 -56
- phoenix/experimental/evals/models/bedrock.py +23 -13
- phoenix/experimental/evals/models/litellm.py +10 -17
- phoenix/experimental/evals/models/openai.py +46 -53
- phoenix/experimental/evals/models/vertex.py +19 -29
- phoenix/experimental/evals/models/vertexai.py +1 -20
- phoenix/server/api/schema.py +2 -3
- phoenix/server/static/index.js +557 -517
- phoenix/session/session.py +2 -1
- phoenix/trace/exporter.py +15 -11
- phoenix/trace/fixtures.py +10 -0
- phoenix/trace/llama_index/callback.py +5 -5
- phoenix/trace/llama_index/streaming.py +3 -4
- phoenix/trace/otel.py +49 -21
- phoenix/trace/schemas.py +2 -2
- phoenix/trace/span_json_decoder.py +5 -4
- phoenix/trace/tracer.py +6 -5
- phoenix/version.py +1 -1
- {arize_phoenix-2.7.0.dist-info → arize_phoenix-2.8.0.dist-info}/licenses/IP_NOTICE +0 -0
- {arize_phoenix-2.7.0.dist-info → arize_phoenix-2.8.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -46,12 +46,6 @@ class GeminiModel(BaseEvalModel):
|
|
|
46
46
|
def __post_init__(self) -> None:
|
|
47
47
|
self._init_client()
|
|
48
48
|
self._init_rate_limiter()
|
|
49
|
-
self.retry = self._retry(
|
|
50
|
-
error_types=[], # default to catching all errors
|
|
51
|
-
min_seconds=self.retry_min_seconds,
|
|
52
|
-
max_seconds=self.retry_max_seconds,
|
|
53
|
-
max_retries=self.max_retries,
|
|
54
|
-
)
|
|
55
49
|
|
|
56
50
|
def reload_client(self) -> None:
|
|
57
51
|
self._init_client()
|
|
@@ -115,30 +109,17 @@ class GeminiModel(BaseEvalModel):
|
|
|
115
109
|
# instruction is an invalid input to Gemini models, it is passed in by
|
|
116
110
|
# BaseEvalModel.__call__ and needs to be removed
|
|
117
111
|
kwargs.pop("instruction", None)
|
|
118
|
-
response = self._generate_with_retry(
|
|
119
|
-
prompt=prompt,
|
|
120
|
-
generation_config=self.generation_config,
|
|
121
|
-
**kwargs,
|
|
122
|
-
)
|
|
123
112
|
|
|
124
|
-
return str(response)
|
|
125
|
-
|
|
126
|
-
def _generate_with_retry(
|
|
127
|
-
self, prompt: str, generation_config: Dict[str, Any], **kwargs: Any
|
|
128
|
-
) -> Any:
|
|
129
|
-
@self.retry
|
|
130
113
|
@self._rate_limiter.limit
|
|
131
|
-
def
|
|
114
|
+
def _rate_limited_completion(
|
|
115
|
+
prompt: str, generation_config: Dict[str, Any], **kwargs: Any
|
|
116
|
+
) -> Any:
|
|
132
117
|
response = self._model.generate_content(
|
|
133
118
|
contents=prompt, generation_config=generation_config, **kwargs
|
|
134
119
|
)
|
|
135
120
|
return self._parse_response_candidates(response)
|
|
136
121
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
async def _async_generate(self, prompt: str, **kwargs: Dict[str, Any]) -> str:
|
|
140
|
-
kwargs.pop("instruction", None)
|
|
141
|
-
response = await self._async_generate_with_retry(
|
|
122
|
+
response = _rate_limited_completion(
|
|
142
123
|
prompt=prompt,
|
|
143
124
|
generation_config=self.generation_config,
|
|
144
125
|
**kwargs,
|
|
@@ -146,18 +127,27 @@ class GeminiModel(BaseEvalModel):
|
|
|
146
127
|
|
|
147
128
|
return str(response)
|
|
148
129
|
|
|
149
|
-
async def
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
130
|
+
async def _async_generate(self, prompt: str, **kwargs: Dict[str, Any]) -> str:
|
|
131
|
+
# instruction is an invalid input to Gemini models, it is passed in by
|
|
132
|
+
# BaseEvalModel.__call__ and needs to be removed
|
|
133
|
+
kwargs.pop("instruction", None)
|
|
134
|
+
|
|
153
135
|
@self._rate_limiter.alimit
|
|
154
|
-
async def
|
|
136
|
+
async def _rate_limited_completion(
|
|
137
|
+
prompt: str, generation_config: Dict[str, Any], **kwargs: Any
|
|
138
|
+
) -> Any:
|
|
155
139
|
response = await self._model.generate_content_async(
|
|
156
140
|
contents=prompt, generation_config=generation_config, **kwargs
|
|
157
141
|
)
|
|
158
142
|
return self._parse_response_candidates(response)
|
|
159
143
|
|
|
160
|
-
|
|
144
|
+
response = await _rate_limited_completion(
|
|
145
|
+
prompt=prompt,
|
|
146
|
+
generation_config=self.generation_config,
|
|
147
|
+
**kwargs,
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
return str(response)
|
|
161
151
|
|
|
162
152
|
def _parse_response_candidates(self, response: Any) -> Any:
|
|
163
153
|
if hasattr(response, "candidates"):
|
|
@@ -52,18 +52,6 @@ class VertexAIModel(BaseEvalModel):
|
|
|
52
52
|
|
|
53
53
|
self._vertexai = vertexai
|
|
54
54
|
self._google_exceptions = google_exceptions
|
|
55
|
-
self._google_api_retry_errors = [
|
|
56
|
-
self._google_exceptions.ResourceExhausted,
|
|
57
|
-
self._google_exceptions.ServiceUnavailable,
|
|
58
|
-
self._google_exceptions.Aborted,
|
|
59
|
-
self._google_exceptions.DeadlineExceeded,
|
|
60
|
-
]
|
|
61
|
-
self.retry = self._retry(
|
|
62
|
-
error_types=self._google_api_retry_errors,
|
|
63
|
-
min_seconds=self.retry_min_seconds,
|
|
64
|
-
max_seconds=self.retry_max_seconds,
|
|
65
|
-
max_retries=self.max_retries,
|
|
66
|
-
)
|
|
67
55
|
except ImportError:
|
|
68
56
|
self._raise_import_error(
|
|
69
57
|
package_display_name="VertexAI",
|
|
@@ -97,19 +85,12 @@ class VertexAIModel(BaseEvalModel):
|
|
|
97
85
|
|
|
98
86
|
def _generate(self, prompt: str, **kwargs: Dict[str, Any]) -> str:
|
|
99
87
|
invoke_params = self.invocation_params
|
|
100
|
-
response = self.
|
|
88
|
+
response = self._model.predict(
|
|
101
89
|
prompt=prompt,
|
|
102
90
|
**invoke_params,
|
|
103
91
|
)
|
|
104
92
|
return str(response.text)
|
|
105
93
|
|
|
106
|
-
def _generate_with_retry(self, **kwargs: Any) -> Any:
|
|
107
|
-
@self.retry
|
|
108
|
-
def _completion_with_retry(**kwargs: Any) -> Any:
|
|
109
|
-
return self._model.predict(**kwargs)
|
|
110
|
-
|
|
111
|
-
return _completion_with_retry(**kwargs)
|
|
112
|
-
|
|
113
94
|
@property
|
|
114
95
|
def is_codey_model(self) -> bool:
|
|
115
96
|
return is_codey_model(self.tuned_model_name or self.model_name)
|
phoenix/server/api/schema.py
CHANGED
|
@@ -2,7 +2,6 @@ from collections import defaultdict
|
|
|
2
2
|
from datetime import datetime
|
|
3
3
|
from itertools import chain
|
|
4
4
|
from typing import Dict, List, Optional, Set, Tuple, Union, cast
|
|
5
|
-
from uuid import UUID
|
|
6
5
|
|
|
7
6
|
import numpy as np
|
|
8
7
|
import numpy.typing as npt
|
|
@@ -22,7 +21,7 @@ from phoenix.server.api.input_types.Coordinates import (
|
|
|
22
21
|
from phoenix.server.api.input_types.SpanSort import SpanSort
|
|
23
22
|
from phoenix.server.api.types.Cluster import Cluster, to_gql_clusters
|
|
24
23
|
from phoenix.trace.dsl import SpanFilter
|
|
25
|
-
from phoenix.trace.schemas import SpanID
|
|
24
|
+
from phoenix.trace.schemas import SpanID, TraceID
|
|
26
25
|
|
|
27
26
|
from .context import Context
|
|
28
27
|
from .input_types.TimeRange import TimeRange
|
|
@@ -264,7 +263,7 @@ class Query:
|
|
|
264
263
|
root_spans_only=root_spans_only,
|
|
265
264
|
)
|
|
266
265
|
else:
|
|
267
|
-
spans = chain.from_iterable(map(traces.get_trace, map(
|
|
266
|
+
spans = chain.from_iterable(map(traces.get_trace, map(TraceID, trace_ids)))
|
|
268
267
|
if predicate:
|
|
269
268
|
spans = filter(predicate, spans)
|
|
270
269
|
if sort:
|