@arizeai/phoenix-client 5.9.0 → 6.1.0
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.
- package/dist/esm/__generated__/api/v1.d.ts +190 -0
- package/dist/esm/__generated__/api/v1.d.ts.map +1 -1
- package/dist/esm/schemas/jsonLiteralSchema.d.ts +1 -1
- package/dist/esm/schemas/jsonLiteralSchema.d.ts.map +1 -1
- package/dist/esm/schemas/jsonLiteralSchema.js +1 -1
- package/dist/esm/schemas/jsonLiteralSchema.js.map +1 -1
- package/dist/esm/schemas/jsonSchema.d.ts +28 -126
- package/dist/esm/schemas/jsonSchema.d.ts.map +1 -1
- package/dist/esm/schemas/jsonSchema.js +5 -11
- package/dist/esm/schemas/jsonSchema.js.map +1 -1
- package/dist/esm/schemas/llm/anthropic/converters.d.ts +205 -1344
- package/dist/esm/schemas/llm/anthropic/converters.d.ts.map +1 -1
- package/dist/esm/schemas/llm/anthropic/messagePartSchemas.d.ts +45 -217
- package/dist/esm/schemas/llm/anthropic/messagePartSchemas.d.ts.map +1 -1
- package/dist/esm/schemas/llm/anthropic/messageSchemas.d.ts +87 -725
- package/dist/esm/schemas/llm/anthropic/messageSchemas.d.ts.map +1 -1
- package/dist/esm/schemas/llm/anthropic/messageSchemas.js +3 -13
- package/dist/esm/schemas/llm/anthropic/messageSchemas.js.map +1 -1
- package/dist/esm/schemas/llm/anthropic/toolCallSchemas.d.ts +4 -24
- package/dist/esm/schemas/llm/anthropic/toolCallSchemas.d.ts.map +1 -1
- package/dist/esm/schemas/llm/anthropic/toolChoiceSchemas.d.ts +4 -18
- package/dist/esm/schemas/llm/anthropic/toolChoiceSchemas.d.ts.map +1 -1
- package/dist/esm/schemas/llm/anthropic/toolSchemas.d.ts +29 -169
- package/dist/esm/schemas/llm/anthropic/toolSchemas.d.ts.map +1 -1
- package/dist/esm/schemas/llm/constants.d.ts +836 -8952
- package/dist/esm/schemas/llm/constants.d.ts.map +1 -1
- package/dist/esm/schemas/llm/converters.d.ts +3564 -36028
- package/dist/esm/schemas/llm/converters.d.ts.map +1 -1
- package/dist/esm/schemas/llm/converters.js +8 -0
- package/dist/esm/schemas/llm/converters.js.map +1 -1
- package/dist/esm/schemas/llm/openai/converters.d.ts +559 -5065
- package/dist/esm/schemas/llm/openai/converters.d.ts.map +1 -1
- package/dist/esm/schemas/llm/openai/messagePartSchemas.d.ts +7 -47
- package/dist/esm/schemas/llm/openai/messagePartSchemas.d.ts.map +1 -1
- package/dist/esm/schemas/llm/openai/messageSchemas.d.ts +51 -665
- package/dist/esm/schemas/llm/openai/messageSchemas.d.ts.map +1 -1
- package/dist/esm/schemas/llm/openai/messageSchemas.js +12 -24
- package/dist/esm/schemas/llm/openai/messageSchemas.js.map +1 -1
- package/dist/esm/schemas/llm/openai/responseFormatSchema.d.ts +30 -218
- package/dist/esm/schemas/llm/openai/responseFormatSchema.d.ts.map +1 -1
- package/dist/esm/schemas/llm/openai/toolCallSchemas.d.ts +6 -54
- package/dist/esm/schemas/llm/openai/toolCallSchemas.d.ts.map +1 -1
- package/dist/esm/schemas/llm/openai/toolCallSchemas.js +2 -3
- package/dist/esm/schemas/llm/openai/toolCallSchemas.js.map +1 -1
- package/dist/esm/schemas/llm/openai/toolChoiceSchemas.d.ts +3 -17
- package/dist/esm/schemas/llm/openai/toolChoiceSchemas.d.ts.map +1 -1
- package/dist/esm/schemas/llm/openai/toolSchemas.d.ts +33 -1254
- package/dist/esm/schemas/llm/openai/toolSchemas.d.ts.map +1 -1
- package/dist/esm/schemas/llm/openai/toolSchemas.js +3 -6
- package/dist/esm/schemas/llm/openai/toolSchemas.js.map +1 -1
- package/dist/esm/schemas/llm/phoenixPrompt/converters.d.ts +105 -696
- package/dist/esm/schemas/llm/phoenixPrompt/converters.d.ts.map +1 -1
- package/dist/esm/schemas/llm/phoenixPrompt/messagePartSchemas.d.ts +13 -89
- package/dist/esm/schemas/llm/phoenixPrompt/messagePartSchemas.d.ts.map +1 -1
- package/dist/esm/schemas/llm/phoenixPrompt/messagePartSchemas.js +1 -1
- package/dist/esm/schemas/llm/phoenixPrompt/messagePartSchemas.js.map +1 -1
- package/dist/esm/schemas/llm/phoenixPrompt/messageSchemas.d.ts +41 -165
- package/dist/esm/schemas/llm/phoenixPrompt/messageSchemas.d.ts.map +1 -1
- package/dist/esm/schemas/llm/phoenixPrompt/responseFormatSchema.d.ts +2 -28
- package/dist/esm/schemas/llm/phoenixPrompt/responseFormatSchema.d.ts.map +1 -1
- package/dist/esm/schemas/llm/phoenixPrompt/responseFormatSchema.js +1 -1
- package/dist/esm/schemas/llm/phoenixPrompt/responseFormatSchema.js.map +1 -1
- package/dist/esm/schemas/llm/phoenixPrompt/toolCallSchemas.d.ts +2 -26
- package/dist/esm/schemas/llm/phoenixPrompt/toolCallSchemas.d.ts.map +1 -1
- package/dist/esm/schemas/llm/phoenixPrompt/toolChoiceSchemas.d.ts +5 -23
- package/dist/esm/schemas/llm/phoenixPrompt/toolChoiceSchemas.d.ts.map +1 -1
- package/dist/esm/schemas/llm/phoenixPrompt/toolSchemas.d.ts +2 -28
- package/dist/esm/schemas/llm/phoenixPrompt/toolSchemas.d.ts.map +1 -1
- package/dist/esm/schemas/llm/phoenixPrompt/toolSchemas.js +1 -1
- package/dist/esm/schemas/llm/phoenixPrompt/toolSchemas.js.map +1 -1
- package/dist/esm/schemas/llm/schemas.d.ts +172 -2608
- package/dist/esm/schemas/llm/schemas.d.ts.map +1 -1
- package/dist/esm/schemas/llm/schemas.js +2 -2
- package/dist/esm/schemas/llm/schemas.js.map +1 -1
- package/dist/esm/schemas/llm/types.d.ts +8 -8
- package/dist/esm/schemas/llm/types.d.ts.map +1 -1
- package/dist/esm/schemas/llm/utils.d.ts +2 -2
- package/dist/esm/schemas/llm/utils.d.ts.map +1 -1
- package/dist/esm/schemas/llm/vercel/messagePartSchemas.d.ts +13 -105
- package/dist/esm/schemas/llm/vercel/messagePartSchemas.d.ts.map +1 -1
- package/dist/esm/schemas/llm/vercel/messageSchemas.d.ts +20 -137
- package/dist/esm/schemas/llm/vercel/messageSchemas.d.ts.map +1 -1
- package/dist/esm/schemas/llm/vercel/toolChoiceSchemas.d.ts +2 -8
- package/dist/esm/schemas/llm/vercel/toolChoiceSchemas.d.ts.map +1 -1
- package/dist/esm/schemas/llm/vercel/toolSchemas.d.ts +2 -26
- package/dist/esm/schemas/llm/vercel/toolSchemas.d.ts.map +1 -1
- package/dist/esm/sessions/getSession.d.ts +21 -0
- package/dist/esm/sessions/getSession.d.ts.map +1 -0
- package/dist/esm/sessions/getSession.js +29 -0
- package/dist/esm/sessions/getSession.js.map +1 -0
- package/dist/esm/sessions/index.d.ts +2 -0
- package/dist/esm/sessions/index.d.ts.map +1 -1
- package/dist/esm/sessions/index.js +2 -0
- package/dist/esm/sessions/index.js.map +1 -1
- package/dist/esm/sessions/listSessions.d.ts +22 -0
- package/dist/esm/sessions/listSessions.d.ts.map +1 -0
- package/dist/esm/sessions/listSessions.js +47 -0
- package/dist/esm/sessions/listSessions.js.map +1 -0
- package/dist/esm/sessions/sessionUtils.d.ts +9 -0
- package/dist/esm/sessions/sessionUtils.d.ts.map +1 -0
- package/dist/esm/sessions/sessionUtils.js +19 -0
- package/dist/esm/sessions/sessionUtils.js.map +1 -0
- package/dist/esm/spans/getSpanAnnotations.d.ts +2 -2
- package/dist/esm/spans/getSpanAnnotations.d.ts.map +1 -1
- package/dist/esm/spans/getSpanAnnotations.js +2 -1
- package/dist/esm/spans/getSpanAnnotations.js.map +1 -1
- package/dist/esm/spans/getSpans.d.ts +2 -2
- package/dist/esm/spans/getSpans.d.ts.map +1 -1
- package/dist/esm/spans/getSpans.js +2 -1
- package/dist/esm/spans/getSpans.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/types/projects.d.ts +12 -3
- package/dist/esm/types/projects.d.ts.map +1 -1
- package/dist/esm/types/projects.js +11 -1
- package/dist/esm/types/projects.js.map +1 -1
- package/dist/esm/types/sessions.d.ts +28 -0
- package/dist/esm/types/sessions.d.ts.map +1 -0
- package/dist/esm/types/sessions.js +2 -0
- package/dist/esm/types/sessions.js.map +1 -0
- package/dist/esm/utils/formatPromptMessages.d.ts.map +1 -1
- package/dist/esm/utils/getPromptBySelector.d.ts.map +1 -1
- package/dist/esm/utils/schemaMatches.d.ts +1 -1
- package/dist/esm/utils/schemaMatches.d.ts.map +1 -1
- package/dist/src/__generated__/api/v1.d.ts +190 -0
- package/dist/src/__generated__/api/v1.d.ts.map +1 -1
- package/dist/src/schemas/jsonLiteralSchema.d.ts +1 -1
- package/dist/src/schemas/jsonLiteralSchema.d.ts.map +1 -1
- package/dist/src/schemas/jsonLiteralSchema.js +1 -1
- package/dist/src/schemas/jsonLiteralSchema.js.map +1 -1
- package/dist/src/schemas/jsonSchema.d.ts +28 -126
- package/dist/src/schemas/jsonSchema.d.ts.map +1 -1
- package/dist/src/schemas/jsonSchema.js +5 -11
- package/dist/src/schemas/jsonSchema.js.map +1 -1
- package/dist/src/schemas/llm/anthropic/converters.d.ts +205 -1344
- package/dist/src/schemas/llm/anthropic/converters.d.ts.map +1 -1
- package/dist/src/schemas/llm/anthropic/messagePartSchemas.d.ts +45 -217
- package/dist/src/schemas/llm/anthropic/messagePartSchemas.d.ts.map +1 -1
- package/dist/src/schemas/llm/anthropic/messageSchemas.d.ts +87 -725
- package/dist/src/schemas/llm/anthropic/messageSchemas.d.ts.map +1 -1
- package/dist/src/schemas/llm/anthropic/messageSchemas.js +3 -13
- package/dist/src/schemas/llm/anthropic/messageSchemas.js.map +1 -1
- package/dist/src/schemas/llm/anthropic/toolCallSchemas.d.ts +4 -24
- package/dist/src/schemas/llm/anthropic/toolCallSchemas.d.ts.map +1 -1
- package/dist/src/schemas/llm/anthropic/toolChoiceSchemas.d.ts +4 -18
- package/dist/src/schemas/llm/anthropic/toolChoiceSchemas.d.ts.map +1 -1
- package/dist/src/schemas/llm/anthropic/toolSchemas.d.ts +29 -169
- package/dist/src/schemas/llm/anthropic/toolSchemas.d.ts.map +1 -1
- package/dist/src/schemas/llm/constants.d.ts +836 -8952
- package/dist/src/schemas/llm/constants.d.ts.map +1 -1
- package/dist/src/schemas/llm/converters.d.ts +3564 -36028
- package/dist/src/schemas/llm/converters.d.ts.map +1 -1
- package/dist/src/schemas/llm/converters.js +8 -0
- package/dist/src/schemas/llm/converters.js.map +1 -1
- package/dist/src/schemas/llm/openai/converters.d.ts +559 -5065
- package/dist/src/schemas/llm/openai/converters.d.ts.map +1 -1
- package/dist/src/schemas/llm/openai/messagePartSchemas.d.ts +7 -47
- package/dist/src/schemas/llm/openai/messagePartSchemas.d.ts.map +1 -1
- package/dist/src/schemas/llm/openai/messageSchemas.d.ts +51 -665
- package/dist/src/schemas/llm/openai/messageSchemas.d.ts.map +1 -1
- package/dist/src/schemas/llm/openai/messageSchemas.js +12 -24
- package/dist/src/schemas/llm/openai/messageSchemas.js.map +1 -1
- package/dist/src/schemas/llm/openai/responseFormatSchema.d.ts +30 -218
- package/dist/src/schemas/llm/openai/responseFormatSchema.d.ts.map +1 -1
- package/dist/src/schemas/llm/openai/toolCallSchemas.d.ts +6 -54
- package/dist/src/schemas/llm/openai/toolCallSchemas.d.ts.map +1 -1
- package/dist/src/schemas/llm/openai/toolCallSchemas.js +2 -3
- package/dist/src/schemas/llm/openai/toolCallSchemas.js.map +1 -1
- package/dist/src/schemas/llm/openai/toolChoiceSchemas.d.ts +3 -17
- package/dist/src/schemas/llm/openai/toolChoiceSchemas.d.ts.map +1 -1
- package/dist/src/schemas/llm/openai/toolSchemas.d.ts +33 -1254
- package/dist/src/schemas/llm/openai/toolSchemas.d.ts.map +1 -1
- package/dist/src/schemas/llm/openai/toolSchemas.js +3 -6
- package/dist/src/schemas/llm/openai/toolSchemas.js.map +1 -1
- package/dist/src/schemas/llm/phoenixPrompt/converters.d.ts +105 -696
- package/dist/src/schemas/llm/phoenixPrompt/converters.d.ts.map +1 -1
- package/dist/src/schemas/llm/phoenixPrompt/messagePartSchemas.d.ts +13 -89
- package/dist/src/schemas/llm/phoenixPrompt/messagePartSchemas.d.ts.map +1 -1
- package/dist/src/schemas/llm/phoenixPrompt/messagePartSchemas.js +1 -1
- package/dist/src/schemas/llm/phoenixPrompt/messagePartSchemas.js.map +1 -1
- package/dist/src/schemas/llm/phoenixPrompt/messageSchemas.d.ts +41 -165
- package/dist/src/schemas/llm/phoenixPrompt/messageSchemas.d.ts.map +1 -1
- package/dist/src/schemas/llm/phoenixPrompt/responseFormatSchema.d.ts +2 -28
- package/dist/src/schemas/llm/phoenixPrompt/responseFormatSchema.d.ts.map +1 -1
- package/dist/src/schemas/llm/phoenixPrompt/responseFormatSchema.js +1 -1
- package/dist/src/schemas/llm/phoenixPrompt/responseFormatSchema.js.map +1 -1
- package/dist/src/schemas/llm/phoenixPrompt/toolCallSchemas.d.ts +2 -26
- package/dist/src/schemas/llm/phoenixPrompt/toolCallSchemas.d.ts.map +1 -1
- package/dist/src/schemas/llm/phoenixPrompt/toolChoiceSchemas.d.ts +5 -23
- package/dist/src/schemas/llm/phoenixPrompt/toolChoiceSchemas.d.ts.map +1 -1
- package/dist/src/schemas/llm/phoenixPrompt/toolSchemas.d.ts +2 -28
- package/dist/src/schemas/llm/phoenixPrompt/toolSchemas.d.ts.map +1 -1
- package/dist/src/schemas/llm/phoenixPrompt/toolSchemas.js +1 -1
- package/dist/src/schemas/llm/phoenixPrompt/toolSchemas.js.map +1 -1
- package/dist/src/schemas/llm/schemas.d.ts +172 -2608
- package/dist/src/schemas/llm/schemas.d.ts.map +1 -1
- package/dist/src/schemas/llm/schemas.js +2 -2
- package/dist/src/schemas/llm/schemas.js.map +1 -1
- package/dist/src/schemas/llm/types.d.ts +8 -8
- package/dist/src/schemas/llm/types.d.ts.map +1 -1
- package/dist/src/schemas/llm/utils.d.ts +2 -2
- package/dist/src/schemas/llm/utils.d.ts.map +1 -1
- package/dist/src/schemas/llm/vercel/messagePartSchemas.d.ts +13 -105
- package/dist/src/schemas/llm/vercel/messagePartSchemas.d.ts.map +1 -1
- package/dist/src/schemas/llm/vercel/messageSchemas.d.ts +20 -137
- package/dist/src/schemas/llm/vercel/messageSchemas.d.ts.map +1 -1
- package/dist/src/schemas/llm/vercel/toolChoiceSchemas.d.ts +2 -8
- package/dist/src/schemas/llm/vercel/toolChoiceSchemas.d.ts.map +1 -1
- package/dist/src/schemas/llm/vercel/toolSchemas.d.ts +2 -26
- package/dist/src/schemas/llm/vercel/toolSchemas.d.ts.map +1 -1
- package/dist/src/sessions/getSession.d.ts +21 -0
- package/dist/src/sessions/getSession.d.ts.map +1 -0
- package/dist/src/sessions/getSession.js +35 -0
- package/dist/src/sessions/getSession.js.map +1 -0
- package/dist/src/sessions/index.d.ts +2 -0
- package/dist/src/sessions/index.d.ts.map +1 -1
- package/dist/src/sessions/index.js +2 -0
- package/dist/src/sessions/index.js.map +1 -1
- package/dist/src/sessions/listSessions.d.ts +22 -0
- package/dist/src/sessions/listSessions.d.ts.map +1 -0
- package/dist/src/sessions/listSessions.js +54 -0
- package/dist/src/sessions/listSessions.js.map +1 -0
- package/dist/src/sessions/sessionUtils.d.ts +9 -0
- package/dist/src/sessions/sessionUtils.d.ts.map +1 -0
- package/dist/src/sessions/sessionUtils.js +22 -0
- package/dist/src/sessions/sessionUtils.js.map +1 -0
- package/dist/src/spans/getSpanAnnotations.d.ts +2 -2
- package/dist/src/spans/getSpanAnnotations.d.ts.map +1 -1
- package/dist/src/spans/getSpanAnnotations.js +2 -1
- package/dist/src/spans/getSpanAnnotations.js.map +1 -1
- package/dist/src/spans/getSpans.d.ts +2 -2
- package/dist/src/spans/getSpans.d.ts.map +1 -1
- package/dist/src/spans/getSpans.js +2 -1
- package/dist/src/spans/getSpans.js.map +1 -1
- package/dist/src/types/projects.d.ts +12 -3
- package/dist/src/types/projects.d.ts.map +1 -1
- package/dist/src/types/projects.js +12 -0
- package/dist/src/types/projects.js.map +1 -1
- package/dist/src/types/sessions.d.ts +28 -0
- package/dist/src/types/sessions.d.ts.map +1 -0
- package/dist/src/types/sessions.js +3 -0
- package/dist/src/types/sessions.js.map +1 -0
- package/dist/src/utils/formatPromptMessages.d.ts.map +1 -1
- package/dist/src/utils/getPromptBySelector.d.ts.map +1 -1
- package/dist/src/utils/schemaMatches.d.ts +1 -1
- package/dist/src/utils/schemaMatches.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -5
- package/src/__generated__/api/v1.ts +190 -0
- package/src/schemas/jsonLiteralSchema.ts +1 -1
- package/src/schemas/jsonSchema.ts +18 -25
- package/src/schemas/llm/anthropic/messageSchemas.ts +6 -15
- package/src/schemas/llm/converters.ts +40 -16
- package/src/schemas/llm/openai/messageSchemas.ts +35 -47
- package/src/schemas/llm/openai/toolCallSchemas.ts +2 -3
- package/src/schemas/llm/openai/toolSchemas.ts +22 -25
- package/src/schemas/llm/phoenixPrompt/messagePartSchemas.ts +1 -1
- package/src/schemas/llm/phoenixPrompt/responseFormatSchema.ts +1 -1
- package/src/schemas/llm/phoenixPrompt/toolSchemas.ts +1 -1
- package/src/schemas/llm/schemas.ts +2 -2
- package/src/schemas/llm/types.ts +13 -13
- package/src/schemas/llm/utils.ts +7 -7
- package/src/sessions/getSession.ts +44 -0
- package/src/sessions/index.ts +2 -0
- package/src/sessions/listSessions.ts +64 -0
- package/src/sessions/sessionUtils.ts +23 -0
- package/src/spans/getSpanAnnotations.ts +4 -4
- package/src/spans/getSpans.ts +4 -4
- package/src/types/projects.ts +20 -3
- package/src/types/sessions.ts +29 -0
- package/src/utils/schemaMatches.ts +1 -1
|
@@ -13,7 +13,7 @@ export const phoenixResponseFormatSchema =
|
|
|
13
13
|
json_schema: z.object({
|
|
14
14
|
name: z.string(),
|
|
15
15
|
description: z.string().optional(),
|
|
16
|
-
schema: z.record(z.unknown()).optional(),
|
|
16
|
+
schema: z.record(z.string(), z.unknown()).optional(),
|
|
17
17
|
strict: z.boolean().optional(),
|
|
18
18
|
}),
|
|
19
19
|
})
|
|
@@ -12,7 +12,7 @@ export const phoenixToolDefinitionSchema = schemaMatches<PromptTool>()(
|
|
|
12
12
|
function: z.object({
|
|
13
13
|
name: z.string(),
|
|
14
14
|
description: z.string().optional(),
|
|
15
|
-
parameters: z.record(z.unknown()).optional(),
|
|
15
|
+
parameters: z.record(z.string(), z.unknown()).optional(),
|
|
16
16
|
strict: z.boolean().optional(),
|
|
17
17
|
}),
|
|
18
18
|
})
|
|
@@ -61,11 +61,11 @@ export type LlmProviderToolCalls = z.infer<typeof llmProviderToolCallsSchema>;
|
|
|
61
61
|
export const toolCallHeuristicSchema = z.object({
|
|
62
62
|
id: z.string().optional(),
|
|
63
63
|
name: z.string().optional(),
|
|
64
|
-
arguments: z.record(z.unknown()).optional(),
|
|
64
|
+
arguments: z.record(z.string(), z.unknown()).optional(),
|
|
65
65
|
function: z
|
|
66
66
|
.object({
|
|
67
67
|
name: z.string().optional(),
|
|
68
|
-
arguments: z.record(z.unknown()).optional(),
|
|
68
|
+
arguments: z.record(z.string(), z.unknown()).optional(),
|
|
69
69
|
})
|
|
70
70
|
.optional(),
|
|
71
71
|
});
|
package/src/schemas/llm/types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ZodType
|
|
1
|
+
import type { ZodType } from "zod";
|
|
2
2
|
|
|
3
3
|
import type { PromptProviderSDKs, PromptToolChoice } from "../../types/prompts";
|
|
4
4
|
import type { AnthropicMessagePart } from "./anthropic/messagePartSchemas";
|
|
@@ -33,35 +33,35 @@ export type LLMMessagePart =
|
|
|
33
33
|
| VercelAIChatPart;
|
|
34
34
|
|
|
35
35
|
export type SDKConverters<
|
|
36
|
-
MessageSchema extends
|
|
37
|
-
MessagePartSchema extends
|
|
38
|
-
ToolChoiceSchema extends
|
|
39
|
-
ToolCallSchema extends
|
|
40
|
-
ToolDefinitionSchema extends
|
|
41
|
-
ResponseFormatSchema extends
|
|
36
|
+
MessageSchema extends ZodType = never,
|
|
37
|
+
MessagePartSchema extends ZodType = never,
|
|
38
|
+
ToolChoiceSchema extends ZodType = never,
|
|
39
|
+
ToolCallSchema extends ZodType = never,
|
|
40
|
+
ToolDefinitionSchema extends ZodType = never,
|
|
41
|
+
ResponseFormatSchema extends ZodType = never,
|
|
42
42
|
> = {
|
|
43
43
|
messages: {
|
|
44
|
-
toOpenAI: ZodType<OpenAIMessage | null,
|
|
44
|
+
toOpenAI: ZodType<OpenAIMessage | null, unknown>;
|
|
45
45
|
fromOpenAI: MessageSchema;
|
|
46
46
|
};
|
|
47
47
|
messageParts: {
|
|
48
|
-
toOpenAI: ZodType<OpenAIChatPart | null,
|
|
48
|
+
toOpenAI: ZodType<OpenAIChatPart | null, unknown>;
|
|
49
49
|
fromOpenAI: MessagePartSchema;
|
|
50
50
|
};
|
|
51
51
|
toolChoices: {
|
|
52
|
-
toOpenAI: ZodType<OpenaiToolChoice | null,
|
|
52
|
+
toOpenAI: ZodType<OpenaiToolChoice | null, unknown>;
|
|
53
53
|
fromOpenAI: ToolChoiceSchema;
|
|
54
54
|
};
|
|
55
55
|
toolCalls: {
|
|
56
|
-
toOpenAI: ZodType<OpenAIToolCall | null,
|
|
56
|
+
toOpenAI: ZodType<OpenAIToolCall | null, unknown>;
|
|
57
57
|
fromOpenAI: ToolCallSchema;
|
|
58
58
|
};
|
|
59
59
|
toolDefinitions: {
|
|
60
|
-
toOpenAI: ZodType<OpenAIToolDefinition | null,
|
|
60
|
+
toOpenAI: ZodType<OpenAIToolDefinition | null, unknown>;
|
|
61
61
|
fromOpenAI: ToolDefinitionSchema;
|
|
62
62
|
};
|
|
63
63
|
responseFormat?: {
|
|
64
|
-
toOpenAI: ZodType<OpenAIResponseFormat | null,
|
|
64
|
+
toOpenAI: ZodType<OpenAIResponseFormat | null, unknown>;
|
|
65
65
|
fromOpenAI: ResponseFormatSchema;
|
|
66
66
|
};
|
|
67
67
|
};
|
package/src/schemas/llm/utils.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ZodType } from "zod";
|
|
2
2
|
|
|
3
3
|
import { isObject } from "../../utils/isObject";
|
|
4
4
|
import { anthropicMessagePartSchema } from "./anthropic/messagePartSchemas";
|
|
@@ -30,12 +30,12 @@ import { vercelAIMessageSchema } from "./vercel/messageSchemas";
|
|
|
30
30
|
import { vercelAIToolDefinitionSchema } from "./vercel/toolSchemas";
|
|
31
31
|
|
|
32
32
|
export const makeSDKConverters = <
|
|
33
|
-
MessageSchema extends
|
|
34
|
-
MessagePartSchema extends
|
|
35
|
-
ToolChoiceSchema extends
|
|
36
|
-
ToolCallSchema extends
|
|
37
|
-
ToolDefinitionSchema extends
|
|
38
|
-
ResponseFormatSchema extends
|
|
33
|
+
MessageSchema extends ZodType,
|
|
34
|
+
MessagePartSchema extends ZodType,
|
|
35
|
+
ToolChoiceSchema extends ZodType,
|
|
36
|
+
ToolCallSchema extends ZodType,
|
|
37
|
+
ToolDefinitionSchema extends ZodType,
|
|
38
|
+
ResponseFormatSchema extends ZodType,
|
|
39
39
|
>({
|
|
40
40
|
messages,
|
|
41
41
|
messageParts,
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import invariant from "tiny-invariant";
|
|
2
|
+
|
|
3
|
+
import { createClient } from "../client";
|
|
4
|
+
import type { ClientFn } from "../types/core";
|
|
5
|
+
import type { Session } from "../types/sessions";
|
|
6
|
+
import { toSession } from "./sessionUtils";
|
|
7
|
+
|
|
8
|
+
export type GetSessionParams = ClientFn & {
|
|
9
|
+
/**
|
|
10
|
+
* The session identifier: either a GlobalID or user-provided session_id string.
|
|
11
|
+
*/
|
|
12
|
+
sessionId: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Fetch a single session by its GlobalID or user-provided session_id string.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { getSession } from "@arizeai/phoenix-client/sessions";
|
|
21
|
+
*
|
|
22
|
+
* const session = await getSession({ sessionId: "my-session-id" });
|
|
23
|
+
* console.log(session.traces.length);
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export async function getSession({
|
|
27
|
+
client: _client,
|
|
28
|
+
sessionId,
|
|
29
|
+
}: GetSessionParams): Promise<Session> {
|
|
30
|
+
const client = _client || createClient();
|
|
31
|
+
const { data, error } = await client.GET(
|
|
32
|
+
"/v1/sessions/{session_identifier}",
|
|
33
|
+
{
|
|
34
|
+
params: {
|
|
35
|
+
path: {
|
|
36
|
+
session_identifier: sessionId,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
if (error) throw error;
|
|
42
|
+
invariant(data?.data, "Failed to get session");
|
|
43
|
+
return toSession(data.data);
|
|
44
|
+
}
|
package/src/sessions/index.ts
CHANGED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import invariant from "tiny-invariant";
|
|
2
|
+
|
|
3
|
+
import type { components } from "../__generated__/api/v1";
|
|
4
|
+
import { createClient } from "../client";
|
|
5
|
+
import type { ClientFn } from "../types/core";
|
|
6
|
+
import type { ProjectIdentifier } from "../types/projects";
|
|
7
|
+
import { resolveProjectIdentifier } from "../types/projects";
|
|
8
|
+
import type { Session } from "../types/sessions";
|
|
9
|
+
import { toSession } from "./sessionUtils";
|
|
10
|
+
|
|
11
|
+
export type ListSessionsParams = ClientFn & ProjectIdentifier;
|
|
12
|
+
|
|
13
|
+
type SessionsResponse = components["schemas"]["GetSessionsResponseBody"];
|
|
14
|
+
|
|
15
|
+
const DEFAULT_PAGE_SIZE = 100;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* List all sessions for a project with automatic pagination handling.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { listSessions } from "@arizeai/phoenix-client/sessions";
|
|
23
|
+
*
|
|
24
|
+
* const sessions = await listSessions({
|
|
25
|
+
* project: "my-project",
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* for (const session of sessions) {
|
|
29
|
+
* console.log(`Session: ${session.sessionId}, Traces: ${session.traces.length}`);
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export async function listSessions(
|
|
34
|
+
params: ListSessionsParams
|
|
35
|
+
): Promise<Session[]> {
|
|
36
|
+
const client = params.client || createClient();
|
|
37
|
+
const projectIdentifier = resolveProjectIdentifier(params);
|
|
38
|
+
|
|
39
|
+
const sessions: Session[] = [];
|
|
40
|
+
let cursor: string | null | undefined = null;
|
|
41
|
+
|
|
42
|
+
do {
|
|
43
|
+
const response: { data?: SessionsResponse; error?: unknown } =
|
|
44
|
+
await client.GET("/v1/projects/{project_identifier}/sessions", {
|
|
45
|
+
params: {
|
|
46
|
+
path: {
|
|
47
|
+
project_identifier: projectIdentifier,
|
|
48
|
+
},
|
|
49
|
+
query: {
|
|
50
|
+
cursor,
|
|
51
|
+
limit: DEFAULT_PAGE_SIZE,
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
if (response.error) throw response.error;
|
|
57
|
+
invariant(response.data?.data, "Failed to list sessions");
|
|
58
|
+
|
|
59
|
+
cursor = response.data.next_cursor ?? null;
|
|
60
|
+
sessions.push(...response.data.data.map(toSession));
|
|
61
|
+
} while (cursor != null);
|
|
62
|
+
|
|
63
|
+
return sessions;
|
|
64
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { components } from "../__generated__/api/v1";
|
|
2
|
+
import type { Session } from "../types/sessions";
|
|
3
|
+
|
|
4
|
+
type SessionData = components["schemas"]["SessionData"];
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Convert an API SessionData response to a user-facing Session object.
|
|
8
|
+
*/
|
|
9
|
+
export function toSession(data: SessionData): Session {
|
|
10
|
+
return {
|
|
11
|
+
id: data.id,
|
|
12
|
+
sessionId: data.session_id,
|
|
13
|
+
projectId: data.project_id,
|
|
14
|
+
startTime: data.start_time,
|
|
15
|
+
endTime: data.end_time,
|
|
16
|
+
traces: data.traces.map((trace) => ({
|
|
17
|
+
id: trace.id,
|
|
18
|
+
traceId: trace.trace_id,
|
|
19
|
+
startTime: trace.start_time,
|
|
20
|
+
endTime: trace.end_time,
|
|
21
|
+
})),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import type { operations } from "../__generated__/api/v1";
|
|
2
2
|
import { createClient } from "../client";
|
|
3
3
|
import type { ClientFn } from "../types/core";
|
|
4
|
-
import type {
|
|
4
|
+
import type { ProjectIdentifier } from "../types/projects";
|
|
5
|
+
import { resolveProjectIdentifier } from "../types/projects";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Parameters to get span annotations from a project using auto-generated types
|
|
8
9
|
*/
|
|
9
10
|
export interface GetSpanAnnotationsParams extends ClientFn {
|
|
10
11
|
/** The project to get span annotations from */
|
|
11
|
-
project:
|
|
12
|
+
project: ProjectIdentifier;
|
|
12
13
|
/** One or more span IDs to fetch annotations for */
|
|
13
14
|
spanIds: string[];
|
|
14
15
|
/** Optional list of annotation names to include. If provided, only annotations with these names will be returned. 'note' annotations are excluded by default unless explicitly included in this list. */
|
|
@@ -89,8 +90,7 @@ export async function getSpanAnnotations({
|
|
|
89
90
|
limit = 100,
|
|
90
91
|
}: GetSpanAnnotationsParams): Promise<GetSpanAnnotationsResult> {
|
|
91
92
|
const client = _client ?? createClient();
|
|
92
|
-
const projectIdentifier =
|
|
93
|
-
"projectId" in project ? project.projectId : project.projectName;
|
|
93
|
+
const projectIdentifier = resolveProjectIdentifier(project);
|
|
94
94
|
|
|
95
95
|
const params: NonNullable<
|
|
96
96
|
operations["listSpanAnnotationsBySpanIds"]["parameters"]["query"]
|
package/src/spans/getSpans.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import type { operations } from "../__generated__/api/v1";
|
|
2
2
|
import { createClient } from "../client";
|
|
3
3
|
import type { ClientFn } from "../types/core";
|
|
4
|
-
import type {
|
|
4
|
+
import type { ProjectIdentifier } from "../types/projects";
|
|
5
|
+
import { resolveProjectIdentifier } from "../types/projects";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Parameters to get spans from a project using auto-generated types
|
|
8
9
|
*/
|
|
9
10
|
export interface GetSpansParams extends ClientFn {
|
|
10
11
|
/** The project to get spans from */
|
|
11
|
-
project:
|
|
12
|
+
project: ProjectIdentifier;
|
|
12
13
|
/** Inclusive lower bound time. Must be a valid ISO 8601 string or Date object. */
|
|
13
14
|
startTime?: Date | string | null;
|
|
14
15
|
/** Exclusive upper bound time. Must be a valid ISO 8601 string or Date object. */
|
|
@@ -87,8 +88,7 @@ export async function getSpans({
|
|
|
87
88
|
endTime,
|
|
88
89
|
}: GetSpansParams): Promise<GetSpansResult> {
|
|
89
90
|
const client = _client ?? createClient();
|
|
90
|
-
const projectIdentifier =
|
|
91
|
-
"projectId" in project ? project.projectId : project.projectName;
|
|
91
|
+
const projectIdentifier = resolveProjectIdentifier(project);
|
|
92
92
|
|
|
93
93
|
const params: NonNullable<operations["getSpans"]["parameters"]["query"]> = {
|
|
94
94
|
limit,
|
package/src/types/projects.ts
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Identifies a project. Accepts any of:
|
|
3
|
+
* - `project` — a project ID or name (the server accepts either)
|
|
4
|
+
* - `projectId` — an explicit project ID
|
|
5
|
+
* - `projectName` — an explicit project name
|
|
4
6
|
*/
|
|
5
|
-
export type
|
|
7
|
+
export type ProjectIdentifier =
|
|
8
|
+
| { project: string }
|
|
9
|
+
| { projectId: string }
|
|
10
|
+
| { projectName: string };
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Resolves a {@link ProjectIdentifier} union to a plain string
|
|
14
|
+
* suitable for the REST `project_identifier` path parameter.
|
|
15
|
+
*/
|
|
16
|
+
export function resolveProjectIdentifier(
|
|
17
|
+
identifier: ProjectIdentifier
|
|
18
|
+
): string {
|
|
19
|
+
if ("project" in identifier) return identifier.project;
|
|
20
|
+
if ("projectId" in identifier) return identifier.projectId;
|
|
21
|
+
return identifier.projectName;
|
|
22
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Node } from "./core";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A trace that belongs to a session.
|
|
5
|
+
*/
|
|
6
|
+
export interface SessionTrace extends Node {
|
|
7
|
+
/** The unique trace identifier (e.g. OpenTelemetry trace ID) */
|
|
8
|
+
traceId: string;
|
|
9
|
+
/** ISO 8601 timestamp of when the trace started */
|
|
10
|
+
startTime: string;
|
|
11
|
+
/** ISO 8601 timestamp of when the trace ended */
|
|
12
|
+
endTime: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A session representing a group of related traces (e.g. a multi-turn conversation).
|
|
17
|
+
*/
|
|
18
|
+
export interface Session extends Node {
|
|
19
|
+
/** The user-provided session identifier */
|
|
20
|
+
sessionId: string;
|
|
21
|
+
/** The ID of the project this session belongs to */
|
|
22
|
+
projectId: string;
|
|
23
|
+
/** ISO 8601 timestamp of when the first trace in the session started */
|
|
24
|
+
startTime: string;
|
|
25
|
+
/** ISO 8601 timestamp of when the last trace in the session ended */
|
|
26
|
+
endTime: string;
|
|
27
|
+
/** The traces that belong to this session */
|
|
28
|
+
traces: SessionTrace[];
|
|
29
|
+
}
|