arize-phoenix 7.12.3__py3-none-any.whl → 8.0.1__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-7.12.3.dist-info → arize_phoenix-8.0.1.dist-info}/METADATA +31 -28
- {arize_phoenix-7.12.3.dist-info → arize_phoenix-8.0.1.dist-info}/RECORD +70 -47
- phoenix/db/migrations/versions/bc8fea3c2bc8_add_prompt_tables.py +197 -0
- phoenix/db/models.py +307 -0
- phoenix/db/types/__init__.py +0 -0
- phoenix/db/types/identifier.py +7 -0
- phoenix/db/types/model_provider.py +8 -0
- phoenix/server/api/context.py +2 -0
- phoenix/server/api/dataloaders/__init__.py +2 -0
- phoenix/server/api/dataloaders/prompt_version_sequence_number.py +35 -0
- phoenix/server/api/helpers/jsonschema.py +135 -0
- phoenix/server/api/helpers/playground_clients.py +15 -15
- phoenix/server/api/helpers/playground_spans.py +9 -0
- phoenix/server/api/helpers/prompts/__init__.py +0 -0
- phoenix/server/api/helpers/prompts/conversions/__init__.py +0 -0
- phoenix/server/api/helpers/prompts/conversions/anthropic.py +87 -0
- phoenix/server/api/helpers/prompts/conversions/openai.py +78 -0
- phoenix/server/api/helpers/prompts/models.py +575 -0
- phoenix/server/api/input_types/ChatCompletionInput.py +9 -4
- phoenix/server/api/input_types/PromptTemplateOptions.py +10 -0
- phoenix/server/api/input_types/PromptVersionInput.py +133 -0
- phoenix/server/api/mutations/__init__.py +6 -0
- phoenix/server/api/mutations/chat_mutations.py +18 -16
- phoenix/server/api/mutations/prompt_label_mutations.py +191 -0
- phoenix/server/api/mutations/prompt_mutations.py +312 -0
- phoenix/server/api/mutations/prompt_version_tag_mutations.py +148 -0
- phoenix/server/api/mutations/user_mutations.py +7 -6
- phoenix/server/api/openapi/schema.py +1 -0
- phoenix/server/api/queries.py +84 -31
- phoenix/server/api/routers/oauth2.py +3 -2
- phoenix/server/api/routers/v1/__init__.py +2 -0
- phoenix/server/api/routers/v1/datasets.py +1 -1
- phoenix/server/api/routers/v1/experiment_evaluations.py +1 -1
- phoenix/server/api/routers/v1/experiment_runs.py +1 -1
- phoenix/server/api/routers/v1/experiments.py +1 -1
- phoenix/server/api/routers/v1/models.py +45 -0
- phoenix/server/api/routers/v1/prompts.py +415 -0
- phoenix/server/api/routers/v1/spans.py +1 -1
- phoenix/server/api/routers/v1/traces.py +1 -1
- phoenix/server/api/routers/v1/utils.py +1 -1
- phoenix/server/api/subscriptions.py +21 -24
- phoenix/server/api/types/GenerativeProvider.py +4 -4
- phoenix/server/api/types/Identifier.py +15 -0
- phoenix/server/api/types/Project.py +5 -7
- phoenix/server/api/types/Prompt.py +134 -0
- phoenix/server/api/types/PromptLabel.py +41 -0
- phoenix/server/api/types/PromptVersion.py +148 -0
- phoenix/server/api/types/PromptVersionTag.py +27 -0
- phoenix/server/api/types/PromptVersionTemplate.py +148 -0
- phoenix/server/api/types/ResponseFormat.py +9 -0
- phoenix/server/api/types/ToolDefinition.py +9 -0
- phoenix/server/app.py +3 -0
- phoenix/server/static/.vite/manifest.json +45 -45
- phoenix/server/static/assets/components-B-qgPyHv.js +2699 -0
- phoenix/server/static/assets/index-D4KO1IcF.js +1125 -0
- phoenix/server/static/assets/pages-DdcuL3Rh.js +5634 -0
- phoenix/server/static/assets/vendor-DQp7CrDA.js +894 -0
- phoenix/server/static/assets/vendor-arizeai-C1nEIEQq.js +657 -0
- phoenix/server/static/assets/vendor-codemirror-BZXYUIkP.js +24 -0
- phoenix/server/static/assets/vendor-recharts-BUFpwCVD.js +59 -0
- phoenix/server/static/assets/{vendor-shiki-Cl9QBraO.js → vendor-shiki-C8L-c9jT.js} +2 -2
- phoenix/server/static/assets/{vendor-three-DwGkEfCM.js → vendor-three-C-AGeJYv.js} +1 -1
- phoenix/session/client.py +25 -21
- phoenix/utilities/client.py +6 -0
- phoenix/version.py +1 -1
- phoenix/server/api/input_types/TemplateOptions.py +0 -10
- phoenix/server/api/routers/v1/pydantic_compat.py +0 -78
- phoenix/server/api/types/TemplateLanguage.py +0 -10
- phoenix/server/static/assets/components-DckIzNmE.js +0 -2125
- phoenix/server/static/assets/index-Bf25Ogon.js +0 -113
- phoenix/server/static/assets/pages-DL7J9q9w.js +0 -4463
- phoenix/server/static/assets/vendor-DvC8cT4X.js +0 -894
- phoenix/server/static/assets/vendor-arizeai-Do1793cv.js +0 -662
- phoenix/server/static/assets/vendor-codemirror-BzwZPyJM.js +0 -24
- phoenix/server/static/assets/vendor-recharts-_Jb7JjhG.js +0 -59
- {arize_phoenix-7.12.3.dist-info → arize_phoenix-8.0.1.dist-info}/WHEEL +0 -0
- {arize_phoenix-7.12.3.dist-info → arize_phoenix-8.0.1.dist-info}/entry_points.txt +0 -0
- {arize_phoenix-7.12.3.dist-info → arize_phoenix-8.0.1.dist-info}/licenses/IP_NOTICE +0 -0
- {arize_phoenix-7.12.3.dist-info → arize_phoenix-8.0.1.dist-info}/licenses/LICENSE +0 -0
- /phoenix/server/static/assets/{vendor-DxkFTwjz.css → vendor-Cg6lcjUC.css} +0 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import TYPE_CHECKING, Optional, Union
|
|
4
|
+
|
|
5
|
+
from typing_extensions import assert_never
|
|
6
|
+
|
|
7
|
+
if TYPE_CHECKING:
|
|
8
|
+
from anthropic.types import (
|
|
9
|
+
ToolChoiceAnyParam,
|
|
10
|
+
ToolChoiceAutoParam,
|
|
11
|
+
ToolChoiceParam,
|
|
12
|
+
ToolChoiceToolParam,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
from phoenix.server.api.helpers.prompts.models import (
|
|
16
|
+
PromptToolChoiceOneOrMore,
|
|
17
|
+
PromptToolChoiceSpecificFunctionTool,
|
|
18
|
+
PromptToolChoiceZeroOrMore,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class AnthropicToolChoiceConversion:
|
|
23
|
+
@staticmethod
|
|
24
|
+
def to_anthropic(
|
|
25
|
+
obj: Union[
|
|
26
|
+
PromptToolChoiceZeroOrMore,
|
|
27
|
+
PromptToolChoiceOneOrMore,
|
|
28
|
+
PromptToolChoiceSpecificFunctionTool,
|
|
29
|
+
],
|
|
30
|
+
disable_parallel_tool_use: Optional[bool] = None,
|
|
31
|
+
) -> ToolChoiceParam:
|
|
32
|
+
if obj.type == "zero_or_more":
|
|
33
|
+
choice_auto: ToolChoiceAutoParam = {"type": "auto"}
|
|
34
|
+
if disable_parallel_tool_use is not None:
|
|
35
|
+
choice_auto["disable_parallel_tool_use"] = disable_parallel_tool_use
|
|
36
|
+
return choice_auto
|
|
37
|
+
if obj.type == "one_or_more":
|
|
38
|
+
choice_any: ToolChoiceAnyParam = {"type": "any"}
|
|
39
|
+
if disable_parallel_tool_use is not None:
|
|
40
|
+
choice_any["disable_parallel_tool_use"] = disable_parallel_tool_use
|
|
41
|
+
return choice_any
|
|
42
|
+
if obj.type == "specific_function":
|
|
43
|
+
choice_tool: ToolChoiceToolParam = {"type": "tool", "name": obj.function_name}
|
|
44
|
+
if disable_parallel_tool_use is not None:
|
|
45
|
+
choice_tool["disable_parallel_tool_use"] = disable_parallel_tool_use
|
|
46
|
+
return choice_tool
|
|
47
|
+
assert_never(obj.type)
|
|
48
|
+
|
|
49
|
+
@staticmethod
|
|
50
|
+
def from_anthropic(
|
|
51
|
+
obj: ToolChoiceParam,
|
|
52
|
+
) -> tuple[
|
|
53
|
+
Union[
|
|
54
|
+
PromptToolChoiceZeroOrMore,
|
|
55
|
+
PromptToolChoiceOneOrMore,
|
|
56
|
+
PromptToolChoiceSpecificFunctionTool,
|
|
57
|
+
],
|
|
58
|
+
Optional[bool],
|
|
59
|
+
]:
|
|
60
|
+
from phoenix.server.api.helpers.prompts.models import (
|
|
61
|
+
PromptToolChoiceOneOrMore,
|
|
62
|
+
PromptToolChoiceSpecificFunctionTool,
|
|
63
|
+
PromptToolChoiceZeroOrMore,
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
if obj["type"] == "auto":
|
|
67
|
+
disable_parallel_tool_use = (
|
|
68
|
+
obj["disable_parallel_tool_use"] if "disable_parallel_tool_use" in obj else None
|
|
69
|
+
)
|
|
70
|
+
choice_zero_or_more = PromptToolChoiceZeroOrMore(type="zero_or_more")
|
|
71
|
+
return choice_zero_or_more, disable_parallel_tool_use
|
|
72
|
+
if obj["type"] == "any":
|
|
73
|
+
disable_parallel_tool_use = (
|
|
74
|
+
obj["disable_parallel_tool_use"] if "disable_parallel_tool_use" in obj else None
|
|
75
|
+
)
|
|
76
|
+
choice_one_or_more = PromptToolChoiceOneOrMore(type="one_or_more")
|
|
77
|
+
return choice_one_or_more, disable_parallel_tool_use
|
|
78
|
+
if obj["type"] == "tool":
|
|
79
|
+
disable_parallel_tool_use = (
|
|
80
|
+
obj["disable_parallel_tool_use"] if "disable_parallel_tool_use" in obj else None
|
|
81
|
+
)
|
|
82
|
+
choice_function_tool = PromptToolChoiceSpecificFunctionTool(
|
|
83
|
+
type="specific_function",
|
|
84
|
+
function_name=obj["name"],
|
|
85
|
+
)
|
|
86
|
+
return choice_function_tool, disable_parallel_tool_use
|
|
87
|
+
assert_never(obj)
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import TYPE_CHECKING, Union
|
|
4
|
+
|
|
5
|
+
from typing_extensions import assert_never
|
|
6
|
+
|
|
7
|
+
if TYPE_CHECKING:
|
|
8
|
+
from openai.types.chat import (
|
|
9
|
+
ChatCompletionNamedToolChoiceParam,
|
|
10
|
+
ChatCompletionToolChoiceOptionParam,
|
|
11
|
+
)
|
|
12
|
+
from openai.types.chat.chat_completion_named_tool_choice_param import Function
|
|
13
|
+
|
|
14
|
+
from phoenix.server.api.helpers.prompts.models import (
|
|
15
|
+
PromptToolChoiceNone,
|
|
16
|
+
PromptToolChoiceOneOrMore,
|
|
17
|
+
PromptToolChoiceSpecificFunctionTool,
|
|
18
|
+
PromptToolChoiceZeroOrMore,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class OpenAIToolChoiceConversion:
|
|
23
|
+
@staticmethod
|
|
24
|
+
def to_openai(
|
|
25
|
+
obj: Union[
|
|
26
|
+
PromptToolChoiceNone,
|
|
27
|
+
PromptToolChoiceZeroOrMore,
|
|
28
|
+
PromptToolChoiceOneOrMore,
|
|
29
|
+
PromptToolChoiceSpecificFunctionTool,
|
|
30
|
+
],
|
|
31
|
+
) -> ChatCompletionToolChoiceOptionParam:
|
|
32
|
+
if obj.type == "none":
|
|
33
|
+
return "none"
|
|
34
|
+
if obj.type == "zero_or_more":
|
|
35
|
+
return "auto"
|
|
36
|
+
if obj.type == "one_or_more":
|
|
37
|
+
return "required"
|
|
38
|
+
if obj.type == "specific_function":
|
|
39
|
+
choice_tool: ChatCompletionNamedToolChoiceParam = {
|
|
40
|
+
"type": "function",
|
|
41
|
+
"function": {"name": obj.function_name},
|
|
42
|
+
}
|
|
43
|
+
return choice_tool
|
|
44
|
+
assert_never(obj)
|
|
45
|
+
|
|
46
|
+
@staticmethod
|
|
47
|
+
def from_openai(
|
|
48
|
+
obj: ChatCompletionToolChoiceOptionParam,
|
|
49
|
+
) -> Union[
|
|
50
|
+
PromptToolChoiceNone,
|
|
51
|
+
PromptToolChoiceZeroOrMore,
|
|
52
|
+
PromptToolChoiceOneOrMore,
|
|
53
|
+
PromptToolChoiceSpecificFunctionTool,
|
|
54
|
+
]:
|
|
55
|
+
from phoenix.server.api.helpers.prompts.models import (
|
|
56
|
+
PromptToolChoiceNone,
|
|
57
|
+
PromptToolChoiceOneOrMore,
|
|
58
|
+
PromptToolChoiceSpecificFunctionTool,
|
|
59
|
+
PromptToolChoiceZeroOrMore,
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
if obj == "none":
|
|
63
|
+
choice_none = PromptToolChoiceNone(type="none")
|
|
64
|
+
return choice_none
|
|
65
|
+
if obj == "auto":
|
|
66
|
+
choice_zero_or_more = PromptToolChoiceZeroOrMore(type="zero_or_more")
|
|
67
|
+
return choice_zero_or_more
|
|
68
|
+
if obj == "required":
|
|
69
|
+
choice_one_or_more = PromptToolChoiceOneOrMore(type="one_or_more")
|
|
70
|
+
return choice_one_or_more
|
|
71
|
+
if obj["type"] == "function":
|
|
72
|
+
function: Function = obj["function"]
|
|
73
|
+
choice_function_tool = PromptToolChoiceSpecificFunctionTool(
|
|
74
|
+
type="specific_function",
|
|
75
|
+
function_name=function["name"],
|
|
76
|
+
)
|
|
77
|
+
return choice_function_tool
|
|
78
|
+
assert_never(obj["type"])
|