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.

Files changed (80) hide show
  1. {arize_phoenix-7.12.3.dist-info → arize_phoenix-8.0.1.dist-info}/METADATA +31 -28
  2. {arize_phoenix-7.12.3.dist-info → arize_phoenix-8.0.1.dist-info}/RECORD +70 -47
  3. phoenix/db/migrations/versions/bc8fea3c2bc8_add_prompt_tables.py +197 -0
  4. phoenix/db/models.py +307 -0
  5. phoenix/db/types/__init__.py +0 -0
  6. phoenix/db/types/identifier.py +7 -0
  7. phoenix/db/types/model_provider.py +8 -0
  8. phoenix/server/api/context.py +2 -0
  9. phoenix/server/api/dataloaders/__init__.py +2 -0
  10. phoenix/server/api/dataloaders/prompt_version_sequence_number.py +35 -0
  11. phoenix/server/api/helpers/jsonschema.py +135 -0
  12. phoenix/server/api/helpers/playground_clients.py +15 -15
  13. phoenix/server/api/helpers/playground_spans.py +9 -0
  14. phoenix/server/api/helpers/prompts/__init__.py +0 -0
  15. phoenix/server/api/helpers/prompts/conversions/__init__.py +0 -0
  16. phoenix/server/api/helpers/prompts/conversions/anthropic.py +87 -0
  17. phoenix/server/api/helpers/prompts/conversions/openai.py +78 -0
  18. phoenix/server/api/helpers/prompts/models.py +575 -0
  19. phoenix/server/api/input_types/ChatCompletionInput.py +9 -4
  20. phoenix/server/api/input_types/PromptTemplateOptions.py +10 -0
  21. phoenix/server/api/input_types/PromptVersionInput.py +133 -0
  22. phoenix/server/api/mutations/__init__.py +6 -0
  23. phoenix/server/api/mutations/chat_mutations.py +18 -16
  24. phoenix/server/api/mutations/prompt_label_mutations.py +191 -0
  25. phoenix/server/api/mutations/prompt_mutations.py +312 -0
  26. phoenix/server/api/mutations/prompt_version_tag_mutations.py +148 -0
  27. phoenix/server/api/mutations/user_mutations.py +7 -6
  28. phoenix/server/api/openapi/schema.py +1 -0
  29. phoenix/server/api/queries.py +84 -31
  30. phoenix/server/api/routers/oauth2.py +3 -2
  31. phoenix/server/api/routers/v1/__init__.py +2 -0
  32. phoenix/server/api/routers/v1/datasets.py +1 -1
  33. phoenix/server/api/routers/v1/experiment_evaluations.py +1 -1
  34. phoenix/server/api/routers/v1/experiment_runs.py +1 -1
  35. phoenix/server/api/routers/v1/experiments.py +1 -1
  36. phoenix/server/api/routers/v1/models.py +45 -0
  37. phoenix/server/api/routers/v1/prompts.py +415 -0
  38. phoenix/server/api/routers/v1/spans.py +1 -1
  39. phoenix/server/api/routers/v1/traces.py +1 -1
  40. phoenix/server/api/routers/v1/utils.py +1 -1
  41. phoenix/server/api/subscriptions.py +21 -24
  42. phoenix/server/api/types/GenerativeProvider.py +4 -4
  43. phoenix/server/api/types/Identifier.py +15 -0
  44. phoenix/server/api/types/Project.py +5 -7
  45. phoenix/server/api/types/Prompt.py +134 -0
  46. phoenix/server/api/types/PromptLabel.py +41 -0
  47. phoenix/server/api/types/PromptVersion.py +148 -0
  48. phoenix/server/api/types/PromptVersionTag.py +27 -0
  49. phoenix/server/api/types/PromptVersionTemplate.py +148 -0
  50. phoenix/server/api/types/ResponseFormat.py +9 -0
  51. phoenix/server/api/types/ToolDefinition.py +9 -0
  52. phoenix/server/app.py +3 -0
  53. phoenix/server/static/.vite/manifest.json +45 -45
  54. phoenix/server/static/assets/components-B-qgPyHv.js +2699 -0
  55. phoenix/server/static/assets/index-D4KO1IcF.js +1125 -0
  56. phoenix/server/static/assets/pages-DdcuL3Rh.js +5634 -0
  57. phoenix/server/static/assets/vendor-DQp7CrDA.js +894 -0
  58. phoenix/server/static/assets/vendor-arizeai-C1nEIEQq.js +657 -0
  59. phoenix/server/static/assets/vendor-codemirror-BZXYUIkP.js +24 -0
  60. phoenix/server/static/assets/vendor-recharts-BUFpwCVD.js +59 -0
  61. phoenix/server/static/assets/{vendor-shiki-Cl9QBraO.js → vendor-shiki-C8L-c9jT.js} +2 -2
  62. phoenix/server/static/assets/{vendor-three-DwGkEfCM.js → vendor-three-C-AGeJYv.js} +1 -1
  63. phoenix/session/client.py +25 -21
  64. phoenix/utilities/client.py +6 -0
  65. phoenix/version.py +1 -1
  66. phoenix/server/api/input_types/TemplateOptions.py +0 -10
  67. phoenix/server/api/routers/v1/pydantic_compat.py +0 -78
  68. phoenix/server/api/types/TemplateLanguage.py +0 -10
  69. phoenix/server/static/assets/components-DckIzNmE.js +0 -2125
  70. phoenix/server/static/assets/index-Bf25Ogon.js +0 -113
  71. phoenix/server/static/assets/pages-DL7J9q9w.js +0 -4463
  72. phoenix/server/static/assets/vendor-DvC8cT4X.js +0 -894
  73. phoenix/server/static/assets/vendor-arizeai-Do1793cv.js +0 -662
  74. phoenix/server/static/assets/vendor-codemirror-BzwZPyJM.js +0 -24
  75. phoenix/server/static/assets/vendor-recharts-_Jb7JjhG.js +0 -59
  76. {arize_phoenix-7.12.3.dist-info → arize_phoenix-8.0.1.dist-info}/WHEEL +0 -0
  77. {arize_phoenix-7.12.3.dist-info → arize_phoenix-8.0.1.dist-info}/entry_points.txt +0 -0
  78. {arize_phoenix-7.12.3.dist-info → arize_phoenix-8.0.1.dist-info}/licenses/IP_NOTICE +0 -0
  79. {arize_phoenix-7.12.3.dist-info → arize_phoenix-8.0.1.dist-info}/licenses/LICENSE +0 -0
  80. /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"])