@arizeai/phoenix-client 6.2.0 → 6.3.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 +193 -3
- package/dist/esm/__generated__/api/v1.d.ts.map +1 -1
- package/dist/esm/prompts/constants.d.ts.map +1 -1
- package/dist/esm/prompts/constants.js +5 -0
- package/dist/esm/prompts/constants.js.map +1 -1
- package/dist/esm/sessions/deleteSession.d.ts +41 -0
- package/dist/esm/sessions/deleteSession.d.ts.map +1 -0
- package/dist/esm/sessions/deleteSession.js +52 -0
- package/dist/esm/sessions/deleteSession.js.map +1 -0
- package/dist/esm/sessions/deleteSessions.d.ts +44 -0
- package/dist/esm/sessions/deleteSessions.d.ts.map +1 -0
- package/dist/esm/sessions/deleteSessions.js +44 -0
- package/dist/esm/sessions/deleteSessions.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/spans/getSpans.d.ts +3 -1
- package/dist/esm/spans/getSpans.d.ts.map +1 -1
- package/dist/esm/spans/getSpans.js +4 -1
- package/dist/esm/spans/getSpans.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/esm/types/prompts.d.ts +1 -1
- package/dist/esm/types/prompts.d.ts.map +1 -1
- package/dist/esm/utils/formatPromptMessages.d.ts.map +1 -1
- package/dist/esm/utils/getPromptBySelector.d.ts +1 -1
- package/dist/esm/utils/getPromptBySelector.d.ts.map +1 -1
- package/dist/src/__generated__/api/v1.d.ts +193 -3
- package/dist/src/__generated__/api/v1.d.ts.map +1 -1
- package/dist/src/prompts/constants.d.ts.map +1 -1
- package/dist/src/prompts/constants.js +5 -0
- package/dist/src/prompts/constants.js.map +1 -1
- package/dist/src/sessions/deleteSession.d.ts +41 -0
- package/dist/src/sessions/deleteSession.d.ts.map +1 -0
- package/dist/src/sessions/deleteSession.js +55 -0
- package/dist/src/sessions/deleteSession.js.map +1 -0
- package/dist/src/sessions/deleteSessions.d.ts +44 -0
- package/dist/src/sessions/deleteSessions.d.ts.map +1 -0
- package/dist/src/sessions/deleteSessions.js +47 -0
- package/dist/src/sessions/deleteSessions.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/spans/getSpans.d.ts +3 -1
- package/dist/src/spans/getSpans.d.ts.map +1 -1
- package/dist/src/spans/getSpans.js +4 -1
- package/dist/src/spans/getSpans.js.map +1 -1
- package/dist/src/types/prompts.d.ts +1 -1
- package/dist/src/types/prompts.d.ts.map +1 -1
- package/dist/src/utils/formatPromptMessages.d.ts.map +1 -1
- package/dist/src/utils/getPromptBySelector.d.ts +1 -1
- package/dist/src/utils/getPromptBySelector.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/__generated__/api/v1.ts +193 -3
- package/src/prompts/constants.ts +5 -0
- package/src/sessions/deleteSession.ts +73 -0
- package/src/sessions/deleteSessions.ts +65 -0
- package/src/sessions/index.ts +2 -0
- package/src/spans/getSpans.ts +7 -0
- package/src/types/prompts.ts +6 -1
package/package.json
CHANGED
|
@@ -787,6 +787,34 @@ export interface paths {
|
|
|
787
787
|
get: operations["getSession"];
|
|
788
788
|
put?: never;
|
|
789
789
|
post?: never;
|
|
790
|
+
/**
|
|
791
|
+
* Delete a session by identifier
|
|
792
|
+
* @description Delete a session by its identifier. The identifier can be either:
|
|
793
|
+
* 1. A global ID (base64-encoded)
|
|
794
|
+
* 2. A user-provided session_id string
|
|
795
|
+
*
|
|
796
|
+
* This will permanently remove the session and all associated traces, spans, and annotations via cascade delete.
|
|
797
|
+
*/
|
|
798
|
+
delete: operations["deleteSession"];
|
|
799
|
+
options?: never;
|
|
800
|
+
head?: never;
|
|
801
|
+
patch?: never;
|
|
802
|
+
trace?: never;
|
|
803
|
+
};
|
|
804
|
+
"/v1/sessions/delete": {
|
|
805
|
+
parameters: {
|
|
806
|
+
query?: never;
|
|
807
|
+
header?: never;
|
|
808
|
+
path?: never;
|
|
809
|
+
cookie?: never;
|
|
810
|
+
};
|
|
811
|
+
get?: never;
|
|
812
|
+
put?: never;
|
|
813
|
+
/**
|
|
814
|
+
* Bulk delete sessions
|
|
815
|
+
* @description Delete multiple sessions by their identifiers (GlobalIDs or session_id strings). All identifiers in a single request must be the same type. Non-existent IDs are silently skipped. All associated traces, spans, and annotations are cascade deleted.
|
|
816
|
+
*/
|
|
817
|
+
post: operations["deleteSessions"];
|
|
790
818
|
delete?: never;
|
|
791
819
|
options?: never;
|
|
792
820
|
head?: never;
|
|
@@ -1284,6 +1312,14 @@ export interface components {
|
|
|
1284
1312
|
/** Data */
|
|
1285
1313
|
data: components["schemas"]["CategoricalAnnotationConfig"] | components["schemas"]["ContinuousAnnotationConfig"] | components["schemas"]["FreeformAnnotationConfig"];
|
|
1286
1314
|
};
|
|
1315
|
+
/** DeleteSessionsRequestBody */
|
|
1316
|
+
DeleteSessionsRequestBody: {
|
|
1317
|
+
/**
|
|
1318
|
+
* Session Identifiers
|
|
1319
|
+
* @description List of session identifiers to delete. All identifiers must be the same type: either all GlobalIDs or all user-provided session_id strings.
|
|
1320
|
+
*/
|
|
1321
|
+
session_identifiers: string[];
|
|
1322
|
+
};
|
|
1287
1323
|
/** Experiment */
|
|
1288
1324
|
Experiment: {
|
|
1289
1325
|
/**
|
|
@@ -1745,7 +1781,7 @@ export interface components {
|
|
|
1745
1781
|
* ModelProvider
|
|
1746
1782
|
* @enum {string}
|
|
1747
1783
|
*/
|
|
1748
|
-
ModelProvider: "OPENAI" | "AZURE_OPENAI" | "ANTHROPIC" | "GOOGLE" | "DEEPSEEK" | "XAI" | "OLLAMA" | "AWS" | "CEREBRAS" | "FIREWORKS" | "GROQ" | "MOONSHOT";
|
|
1784
|
+
ModelProvider: "OPENAI" | "AZURE_OPENAI" | "ANTHROPIC" | "GOOGLE" | "DEEPSEEK" | "XAI" | "OLLAMA" | "AWS" | "CEREBRAS" | "FIREWORKS" | "GROQ" | "MOONSHOT" | "PERPLEXITY" | "TOGETHER";
|
|
1749
1785
|
/** OAuth2User */
|
|
1750
1786
|
OAuth2User: {
|
|
1751
1787
|
/** Id */
|
|
@@ -2397,6 +2433,37 @@ export interface components {
|
|
|
2397
2433
|
*/
|
|
2398
2434
|
reasoning_effort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh";
|
|
2399
2435
|
};
|
|
2436
|
+
/** PromptPerplexityInvocationParameters */
|
|
2437
|
+
PromptPerplexityInvocationParameters: {
|
|
2438
|
+
/**
|
|
2439
|
+
* @description discriminator enum property added by openapi-typescript
|
|
2440
|
+
* @enum {string}
|
|
2441
|
+
*/
|
|
2442
|
+
type: "perplexity";
|
|
2443
|
+
perplexity: components["schemas"]["PromptPerplexityInvocationParametersContent"];
|
|
2444
|
+
};
|
|
2445
|
+
/** PromptPerplexityInvocationParametersContent */
|
|
2446
|
+
PromptPerplexityInvocationParametersContent: {
|
|
2447
|
+
/** Temperature */
|
|
2448
|
+
temperature?: number;
|
|
2449
|
+
/** Max Tokens */
|
|
2450
|
+
max_tokens?: number;
|
|
2451
|
+
/** Max Completion Tokens */
|
|
2452
|
+
max_completion_tokens?: number;
|
|
2453
|
+
/** Frequency Penalty */
|
|
2454
|
+
frequency_penalty?: number;
|
|
2455
|
+
/** Presence Penalty */
|
|
2456
|
+
presence_penalty?: number;
|
|
2457
|
+
/** Top P */
|
|
2458
|
+
top_p?: number;
|
|
2459
|
+
/** Seed */
|
|
2460
|
+
seed?: number;
|
|
2461
|
+
/**
|
|
2462
|
+
* Reasoning Effort
|
|
2463
|
+
* @enum {string}
|
|
2464
|
+
*/
|
|
2465
|
+
reasoning_effort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh";
|
|
2466
|
+
};
|
|
2400
2467
|
/** PromptResponseFormatJSONSchema */
|
|
2401
2468
|
PromptResponseFormatJSONSchema: {
|
|
2402
2469
|
/**
|
|
@@ -2439,6 +2506,37 @@ export interface components {
|
|
|
2439
2506
|
* @enum {string}
|
|
2440
2507
|
*/
|
|
2441
2508
|
PromptTemplateType: "STR" | "CHAT";
|
|
2509
|
+
/** PromptTogetherInvocationParameters */
|
|
2510
|
+
PromptTogetherInvocationParameters: {
|
|
2511
|
+
/**
|
|
2512
|
+
* @description discriminator enum property added by openapi-typescript
|
|
2513
|
+
* @enum {string}
|
|
2514
|
+
*/
|
|
2515
|
+
type: "together";
|
|
2516
|
+
together: components["schemas"]["PromptTogetherInvocationParametersContent"];
|
|
2517
|
+
};
|
|
2518
|
+
/** PromptTogetherInvocationParametersContent */
|
|
2519
|
+
PromptTogetherInvocationParametersContent: {
|
|
2520
|
+
/** Temperature */
|
|
2521
|
+
temperature?: number;
|
|
2522
|
+
/** Max Tokens */
|
|
2523
|
+
max_tokens?: number;
|
|
2524
|
+
/** Max Completion Tokens */
|
|
2525
|
+
max_completion_tokens?: number;
|
|
2526
|
+
/** Frequency Penalty */
|
|
2527
|
+
frequency_penalty?: number;
|
|
2528
|
+
/** Presence Penalty */
|
|
2529
|
+
presence_penalty?: number;
|
|
2530
|
+
/** Top P */
|
|
2531
|
+
top_p?: number;
|
|
2532
|
+
/** Seed */
|
|
2533
|
+
seed?: number;
|
|
2534
|
+
/**
|
|
2535
|
+
* Reasoning Effort
|
|
2536
|
+
* @enum {string}
|
|
2537
|
+
*/
|
|
2538
|
+
reasoning_effort?: "none" | "minimal" | "low" | "medium" | "high" | "xhigh";
|
|
2539
|
+
};
|
|
2442
2540
|
/** PromptToolChoiceNone */
|
|
2443
2541
|
PromptToolChoiceNone: {
|
|
2444
2542
|
/**
|
|
@@ -2521,7 +2619,7 @@ export interface components {
|
|
|
2521
2619
|
template_type: components["schemas"]["PromptTemplateType"];
|
|
2522
2620
|
template_format: components["schemas"]["PromptTemplateFormat"];
|
|
2523
2621
|
/** Invocation Parameters */
|
|
2524
|
-
invocation_parameters: components["schemas"]["PromptOpenAIInvocationParameters"] | components["schemas"]["PromptAzureOpenAIInvocationParameters"] | components["schemas"]["PromptAnthropicInvocationParameters"] | components["schemas"]["PromptGoogleInvocationParameters"] | components["schemas"]["PromptDeepSeekInvocationParameters"] | components["schemas"]["PromptXAIInvocationParameters"] | components["schemas"]["PromptOllamaInvocationParameters"] | components["schemas"]["PromptAwsInvocationParameters"] | components["schemas"]["PromptCerebrasInvocationParameters"] | components["schemas"]["PromptFireworksInvocationParameters"] | components["schemas"]["PromptGroqInvocationParameters"] | components["schemas"]["PromptMoonshotInvocationParameters"];
|
|
2622
|
+
invocation_parameters: components["schemas"]["PromptOpenAIInvocationParameters"] | components["schemas"]["PromptAzureOpenAIInvocationParameters"] | components["schemas"]["PromptAnthropicInvocationParameters"] | components["schemas"]["PromptGoogleInvocationParameters"] | components["schemas"]["PromptDeepSeekInvocationParameters"] | components["schemas"]["PromptXAIInvocationParameters"] | components["schemas"]["PromptOllamaInvocationParameters"] | components["schemas"]["PromptAwsInvocationParameters"] | components["schemas"]["PromptCerebrasInvocationParameters"] | components["schemas"]["PromptFireworksInvocationParameters"] | components["schemas"]["PromptGroqInvocationParameters"] | components["schemas"]["PromptMoonshotInvocationParameters"] | components["schemas"]["PromptPerplexityInvocationParameters"] | components["schemas"]["PromptTogetherInvocationParameters"];
|
|
2525
2623
|
tools?: components["schemas"]["PromptTools"] | null;
|
|
2526
2624
|
/** Response Format */
|
|
2527
2625
|
response_format?: components["schemas"]["PromptResponseFormatJSONSchema"] | null;
|
|
@@ -2540,7 +2638,7 @@ export interface components {
|
|
|
2540
2638
|
template_type: components["schemas"]["PromptTemplateType"];
|
|
2541
2639
|
template_format: components["schemas"]["PromptTemplateFormat"];
|
|
2542
2640
|
/** Invocation Parameters */
|
|
2543
|
-
invocation_parameters: components["schemas"]["PromptOpenAIInvocationParameters"] | components["schemas"]["PromptAzureOpenAIInvocationParameters"] | components["schemas"]["PromptAnthropicInvocationParameters"] | components["schemas"]["PromptGoogleInvocationParameters"] | components["schemas"]["PromptDeepSeekInvocationParameters"] | components["schemas"]["PromptXAIInvocationParameters"] | components["schemas"]["PromptOllamaInvocationParameters"] | components["schemas"]["PromptAwsInvocationParameters"] | components["schemas"]["PromptCerebrasInvocationParameters"] | components["schemas"]["PromptFireworksInvocationParameters"] | components["schemas"]["PromptGroqInvocationParameters"] | components["schemas"]["PromptMoonshotInvocationParameters"];
|
|
2641
|
+
invocation_parameters: components["schemas"]["PromptOpenAIInvocationParameters"] | components["schemas"]["PromptAzureOpenAIInvocationParameters"] | components["schemas"]["PromptAnthropicInvocationParameters"] | components["schemas"]["PromptGoogleInvocationParameters"] | components["schemas"]["PromptDeepSeekInvocationParameters"] | components["schemas"]["PromptXAIInvocationParameters"] | components["schemas"]["PromptOllamaInvocationParameters"] | components["schemas"]["PromptAwsInvocationParameters"] | components["schemas"]["PromptCerebrasInvocationParameters"] | components["schemas"]["PromptFireworksInvocationParameters"] | components["schemas"]["PromptGroqInvocationParameters"] | components["schemas"]["PromptMoonshotInvocationParameters"] | components["schemas"]["PromptPerplexityInvocationParameters"] | components["schemas"]["PromptTogetherInvocationParameters"];
|
|
2544
2642
|
tools?: components["schemas"]["PromptTools"] | null;
|
|
2545
2643
|
/** Response Format */
|
|
2546
2644
|
response_format?: components["schemas"]["PromptResponseFormatJSONSchema"] | null;
|
|
@@ -4761,6 +4859,8 @@ export interface operations {
|
|
|
4761
4859
|
end_time?: string | null;
|
|
4762
4860
|
/** @description Filter by one or more trace IDs */
|
|
4763
4861
|
trace_id?: string[] | null;
|
|
4862
|
+
/** @description Filter by parent span ID. Use "null" to get root spans only. */
|
|
4863
|
+
parent_id?: string | null;
|
|
4764
4864
|
};
|
|
4765
4865
|
header?: never;
|
|
4766
4866
|
path: {
|
|
@@ -4822,6 +4922,8 @@ export interface operations {
|
|
|
4822
4922
|
end_time?: string | null;
|
|
4823
4923
|
/** @description Filter by one or more trace IDs */
|
|
4824
4924
|
trace_id?: string[] | null;
|
|
4925
|
+
/** @description Filter by parent span ID. Use "null" to get root spans only. */
|
|
4926
|
+
parent_id?: string | null;
|
|
4825
4927
|
};
|
|
4826
4928
|
header?: never;
|
|
4827
4929
|
path: {
|
|
@@ -5879,6 +5981,94 @@ export interface operations {
|
|
|
5879
5981
|
};
|
|
5880
5982
|
};
|
|
5881
5983
|
};
|
|
5984
|
+
deleteSession: {
|
|
5985
|
+
parameters: {
|
|
5986
|
+
query?: never;
|
|
5987
|
+
header?: never;
|
|
5988
|
+
path: {
|
|
5989
|
+
/** @description The session identifier: either a GlobalID or user-provided session_id string. */
|
|
5990
|
+
session_identifier: string;
|
|
5991
|
+
};
|
|
5992
|
+
cookie?: never;
|
|
5993
|
+
};
|
|
5994
|
+
requestBody?: never;
|
|
5995
|
+
responses: {
|
|
5996
|
+
/** @description Successful Response */
|
|
5997
|
+
204: {
|
|
5998
|
+
headers: {
|
|
5999
|
+
[name: string]: unknown;
|
|
6000
|
+
};
|
|
6001
|
+
content?: never;
|
|
6002
|
+
};
|
|
6003
|
+
/** @description Forbidden */
|
|
6004
|
+
403: {
|
|
6005
|
+
headers: {
|
|
6006
|
+
[name: string]: unknown;
|
|
6007
|
+
};
|
|
6008
|
+
content: {
|
|
6009
|
+
"text/plain": string;
|
|
6010
|
+
};
|
|
6011
|
+
};
|
|
6012
|
+
/** @description Not Found */
|
|
6013
|
+
404: {
|
|
6014
|
+
headers: {
|
|
6015
|
+
[name: string]: unknown;
|
|
6016
|
+
};
|
|
6017
|
+
content: {
|
|
6018
|
+
"text/plain": string;
|
|
6019
|
+
};
|
|
6020
|
+
};
|
|
6021
|
+
/** @description Validation Error */
|
|
6022
|
+
422: {
|
|
6023
|
+
headers: {
|
|
6024
|
+
[name: string]: unknown;
|
|
6025
|
+
};
|
|
6026
|
+
content: {
|
|
6027
|
+
"application/json": components["schemas"]["HTTPValidationError"];
|
|
6028
|
+
};
|
|
6029
|
+
};
|
|
6030
|
+
};
|
|
6031
|
+
};
|
|
6032
|
+
deleteSessions: {
|
|
6033
|
+
parameters: {
|
|
6034
|
+
query?: never;
|
|
6035
|
+
header?: never;
|
|
6036
|
+
path?: never;
|
|
6037
|
+
cookie?: never;
|
|
6038
|
+
};
|
|
6039
|
+
requestBody: {
|
|
6040
|
+
content: {
|
|
6041
|
+
"application/json": components["schemas"]["DeleteSessionsRequestBody"];
|
|
6042
|
+
};
|
|
6043
|
+
};
|
|
6044
|
+
responses: {
|
|
6045
|
+
/** @description Successful Response */
|
|
6046
|
+
204: {
|
|
6047
|
+
headers: {
|
|
6048
|
+
[name: string]: unknown;
|
|
6049
|
+
};
|
|
6050
|
+
content?: never;
|
|
6051
|
+
};
|
|
6052
|
+
/** @description Forbidden */
|
|
6053
|
+
403: {
|
|
6054
|
+
headers: {
|
|
6055
|
+
[name: string]: unknown;
|
|
6056
|
+
};
|
|
6057
|
+
content: {
|
|
6058
|
+
"text/plain": string;
|
|
6059
|
+
};
|
|
6060
|
+
};
|
|
6061
|
+
/** @description Unprocessable Entity */
|
|
6062
|
+
422: {
|
|
6063
|
+
headers: {
|
|
6064
|
+
[name: string]: unknown;
|
|
6065
|
+
};
|
|
6066
|
+
content: {
|
|
6067
|
+
"text/plain": string;
|
|
6068
|
+
};
|
|
6069
|
+
};
|
|
6070
|
+
};
|
|
6071
|
+
};
|
|
5882
6072
|
listProjectSessions: {
|
|
5883
6073
|
parameters: {
|
|
5884
6074
|
query?: {
|
package/src/prompts/constants.ts
CHANGED
|
@@ -12,4 +12,9 @@ export const PromptModelProviders: Record<PromptModelProvider, string> = {
|
|
|
12
12
|
XAI: "xAI",
|
|
13
13
|
OLLAMA: "Ollama",
|
|
14
14
|
AWS: "AWS Bedrock",
|
|
15
|
+
CEREBRAS: "Cerebras",
|
|
16
|
+
FIREWORKS: "Fireworks",
|
|
17
|
+
GROQ: "Groq",
|
|
18
|
+
MOONSHOT: "Moonshot",
|
|
19
|
+
PERPLEXITY: "Perplexity",
|
|
15
20
|
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { createClient } from "../client";
|
|
2
|
+
import type { ClientFn } from "../types/core";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Parameters to delete a session
|
|
6
|
+
*/
|
|
7
|
+
export interface DeleteSessionParams extends ClientFn {
|
|
8
|
+
/**
|
|
9
|
+
* The session ID. Can be either:
|
|
10
|
+
* - A user-provided session ID string
|
|
11
|
+
* - A Phoenix Global ID (base64-encoded)
|
|
12
|
+
*/
|
|
13
|
+
sessionId: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Delete a single session by ID.
|
|
18
|
+
*
|
|
19
|
+
* This will permanently remove the session and all associated traces, spans,
|
|
20
|
+
* and annotations via cascade delete.
|
|
21
|
+
*
|
|
22
|
+
* @experimental this function is experimental and may change in the future
|
|
23
|
+
*
|
|
24
|
+
* @param params - The parameters to delete a session
|
|
25
|
+
* @returns Promise that resolves when the session is successfully deleted
|
|
26
|
+
* @throws Error if the session is not found or deletion fails
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* // Delete by user-provided session ID
|
|
31
|
+
* await deleteSession({
|
|
32
|
+
* client,
|
|
33
|
+
* sessionId: "my-session-id"
|
|
34
|
+
* });
|
|
35
|
+
*
|
|
36
|
+
* // Delete by Phoenix Global ID
|
|
37
|
+
* await deleteSession({
|
|
38
|
+
* client,
|
|
39
|
+
* sessionId: "UHJvamVjdFNlc3Npb246MTIz"
|
|
40
|
+
* });
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export async function deleteSession({
|
|
44
|
+
client: _client,
|
|
45
|
+
sessionId,
|
|
46
|
+
}: DeleteSessionParams): Promise<void> {
|
|
47
|
+
const client = _client ?? createClient();
|
|
48
|
+
|
|
49
|
+
const { error } = await client.DELETE("/v1/sessions/{session_identifier}", {
|
|
50
|
+
params: {
|
|
51
|
+
path: {
|
|
52
|
+
session_identifier: sessionId,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
if (error) {
|
|
58
|
+
const isNotFound =
|
|
59
|
+
typeof error === "object" &&
|
|
60
|
+
error !== null &&
|
|
61
|
+
"status" in error &&
|
|
62
|
+
error.status === 404;
|
|
63
|
+
if (isNotFound) {
|
|
64
|
+
throw new Error(`Session not found: ${sessionId}`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const errorMessage =
|
|
68
|
+
typeof error === "object" && error !== null
|
|
69
|
+
? JSON.stringify(error, null, 2)
|
|
70
|
+
: String(error);
|
|
71
|
+
throw new Error(`Failed to delete session: ${errorMessage}`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { createClient } from "../client";
|
|
2
|
+
import type { ClientFn } from "../types/core";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Parameters to bulk delete sessions
|
|
6
|
+
*/
|
|
7
|
+
export interface DeleteSessionsParams extends ClientFn {
|
|
8
|
+
/**
|
|
9
|
+
* List of session identifiers to delete. Each can be either:
|
|
10
|
+
* - A user-provided session ID string
|
|
11
|
+
* - A Phoenix Global ID (base64-encoded)
|
|
12
|
+
*
|
|
13
|
+
* All identifiers must be the same type (no mixing).
|
|
14
|
+
*/
|
|
15
|
+
sessionIds: string[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Delete multiple sessions by their identifiers.
|
|
20
|
+
*
|
|
21
|
+
* All identifiers must be the same type: either all GlobalIDs or all
|
|
22
|
+
* user-provided session_id strings. Non-existent IDs are silently skipped.
|
|
23
|
+
* All associated traces, spans, and annotations are cascade deleted.
|
|
24
|
+
*
|
|
25
|
+
* @experimental this function is experimental and may change in the future
|
|
26
|
+
*
|
|
27
|
+
* @param params - The parameters to bulk delete sessions
|
|
28
|
+
* @returns Promise that resolves when the sessions are successfully deleted
|
|
29
|
+
* @throws Error if identifiers are mixed types or deletion fails
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* // Delete by user-provided session IDs
|
|
34
|
+
* await deleteSessions({
|
|
35
|
+
* client,
|
|
36
|
+
* sessionIds: ["session-1", "session-2", "session-3"]
|
|
37
|
+
* });
|
|
38
|
+
*
|
|
39
|
+
* // Delete by Phoenix Global IDs
|
|
40
|
+
* await deleteSessions({
|
|
41
|
+
* client,
|
|
42
|
+
* sessionIds: ["UHJvamVjdFNlc3Npb246MQ==", "UHJvamVjdFNlc3Npb246Mg=="]
|
|
43
|
+
* });
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export async function deleteSessions({
|
|
47
|
+
client: _client,
|
|
48
|
+
sessionIds,
|
|
49
|
+
}: DeleteSessionsParams): Promise<void> {
|
|
50
|
+
const client = _client ?? createClient();
|
|
51
|
+
|
|
52
|
+
const { error } = await client.POST("/v1/sessions/delete", {
|
|
53
|
+
body: {
|
|
54
|
+
session_identifiers: sessionIds,
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
if (error) {
|
|
59
|
+
const errorMessage =
|
|
60
|
+
typeof error === "object" && error !== null
|
|
61
|
+
? JSON.stringify(error, null, 2)
|
|
62
|
+
: String(error);
|
|
63
|
+
throw new Error(`Failed to delete sessions: ${errorMessage}`);
|
|
64
|
+
}
|
|
65
|
+
}
|
package/src/sessions/index.ts
CHANGED
package/src/spans/getSpans.ts
CHANGED
|
@@ -20,6 +20,8 @@ export interface GetSpansParams extends ClientFn {
|
|
|
20
20
|
limit?: number;
|
|
21
21
|
/** Filter spans by one or more trace IDs */
|
|
22
22
|
traceIds?: string[] | null;
|
|
23
|
+
/** Filter by parent span ID. Use `null` or the string `"null"` to get root spans only. */
|
|
24
|
+
parentId?: string | null;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
export type GetSpansResponse = operations["getSpans"]["responses"]["200"];
|
|
@@ -96,6 +98,7 @@ export async function getSpans({
|
|
|
96
98
|
startTime,
|
|
97
99
|
endTime,
|
|
98
100
|
traceIds,
|
|
101
|
+
parentId,
|
|
99
102
|
}: GetSpansParams): Promise<GetSpansResult> {
|
|
100
103
|
const client = _client ?? createClient();
|
|
101
104
|
const projectIdentifier = resolveProjectIdentifier(project);
|
|
@@ -121,6 +124,10 @@ export async function getSpans({
|
|
|
121
124
|
params.trace_id = traceIds;
|
|
122
125
|
}
|
|
123
126
|
|
|
127
|
+
if (parentId !== undefined) {
|
|
128
|
+
params.parent_id = parentId === null ? "null" : parentId;
|
|
129
|
+
}
|
|
130
|
+
|
|
124
131
|
const { data, error } = await client.GET(
|
|
125
132
|
"/v1/projects/{project_identifier}/spans",
|
|
126
133
|
{
|
package/src/types/prompts.ts
CHANGED