@arizeai/phoenix-client 2.1.1 → 2.2.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.
Files changed (71) hide show
  1. package/dist/esm/__generated__/api/v1.d.ts +331 -16
  2. package/dist/esm/__generated__/api/v1.d.ts.map +1 -1
  3. package/dist/esm/prompts/constants.d.ts.map +1 -1
  4. package/dist/esm/prompts/constants.js +4 -0
  5. package/dist/esm/prompts/constants.js.map +1 -1
  6. package/dist/esm/prompts/createPrompt.d.ts +12 -4
  7. package/dist/esm/prompts/createPrompt.d.ts.map +1 -1
  8. package/dist/esm/prompts/createPrompt.js +32 -0
  9. package/dist/esm/prompts/createPrompt.js.map +1 -1
  10. package/dist/esm/spans/getSpanAnnotations.d.ts +78 -0
  11. package/dist/esm/spans/getSpanAnnotations.d.ts.map +1 -0
  12. package/dist/esm/spans/getSpanAnnotations.js +83 -0
  13. package/dist/esm/spans/getSpanAnnotations.js.map +1 -0
  14. package/dist/esm/spans/getSpans.d.ts +78 -0
  15. package/dist/esm/spans/getSpans.d.ts.map +1 -0
  16. package/dist/esm/spans/getSpans.js +85 -0
  17. package/dist/esm/spans/getSpans.js.map +1 -0
  18. package/dist/esm/spans/index.d.ts +2 -0
  19. package/dist/esm/spans/index.d.ts.map +1 -1
  20. package/dist/esm/spans/index.js +2 -0
  21. package/dist/esm/spans/index.js.map +1 -1
  22. package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
  23. package/dist/esm/types/projects.d.ts +10 -0
  24. package/dist/esm/types/projects.d.ts.map +1 -0
  25. package/dist/esm/types/projects.js +2 -0
  26. package/dist/esm/types/projects.js.map +1 -0
  27. package/dist/esm/types/prompts.d.ts +17 -1
  28. package/dist/esm/types/prompts.d.ts.map +1 -1
  29. package/dist/esm/utils/formatPromptMessages.d.ts.map +1 -1
  30. package/dist/esm/utils/getPromptBySelector.d.ts +1 -1
  31. package/dist/esm/utils/getPromptBySelector.d.ts.map +1 -1
  32. package/dist/src/__generated__/api/v1.d.ts +331 -16
  33. package/dist/src/__generated__/api/v1.d.ts.map +1 -1
  34. package/dist/src/prompts/constants.d.ts.map +1 -1
  35. package/dist/src/prompts/constants.js +4 -0
  36. package/dist/src/prompts/constants.js.map +1 -1
  37. package/dist/src/prompts/createPrompt.d.ts +12 -4
  38. package/dist/src/prompts/createPrompt.d.ts.map +1 -1
  39. package/dist/src/prompts/createPrompt.js +32 -0
  40. package/dist/src/prompts/createPrompt.js.map +1 -1
  41. package/dist/src/spans/getSpanAnnotations.d.ts +78 -0
  42. package/dist/src/spans/getSpanAnnotations.d.ts.map +1 -0
  43. package/dist/src/spans/getSpanAnnotations.js +98 -0
  44. package/dist/src/spans/getSpanAnnotations.js.map +1 -0
  45. package/dist/src/spans/getSpans.d.ts +78 -0
  46. package/dist/src/spans/getSpans.d.ts.map +1 -0
  47. package/dist/src/spans/getSpans.js +100 -0
  48. package/dist/src/spans/getSpans.js.map +1 -0
  49. package/dist/src/spans/index.d.ts +2 -0
  50. package/dist/src/spans/index.d.ts.map +1 -1
  51. package/dist/src/spans/index.js +2 -0
  52. package/dist/src/spans/index.js.map +1 -1
  53. package/dist/src/types/projects.d.ts +10 -0
  54. package/dist/src/types/projects.d.ts.map +1 -0
  55. package/dist/src/types/projects.js +3 -0
  56. package/dist/src/types/projects.js.map +1 -0
  57. package/dist/src/types/prompts.d.ts +17 -1
  58. package/dist/src/types/prompts.d.ts.map +1 -1
  59. package/dist/src/utils/formatPromptMessages.d.ts.map +1 -1
  60. package/dist/src/utils/getPromptBySelector.d.ts +1 -1
  61. package/dist/src/utils/getPromptBySelector.d.ts.map +1 -1
  62. package/dist/tsconfig.tsbuildinfo +1 -1
  63. package/package.json +1 -1
  64. package/src/__generated__/api/v1.ts +331 -16
  65. package/src/prompts/constants.ts +4 -0
  66. package/src/prompts/createPrompt.ts +51 -3
  67. package/src/spans/getSpanAnnotations.ts +131 -0
  68. package/src/spans/getSpans.ts +127 -0
  69. package/src/spans/index.ts +2 -0
  70. package/src/types/projects.ts +5 -0
  71. package/src/types/prompts.ts +29 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arizeai/phoenix-client",
3
- "version": "2.1.1",
3
+ "version": "2.2.0",
4
4
  "description": "A client for the Phoenix API",
5
5
  "main": "dist/src/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -327,7 +327,7 @@ export interface paths {
327
327
  };
328
328
  /**
329
329
  * Search spans with simple filters (no DSL)
330
- * @description Return spans within a project filtered by time range, annotation names, and ordered by start_time. Supports cursor-based pagination.
330
+ * @description Return spans within a project filtered by time range. Supports cursor-based pagination.
331
331
  */
332
332
  get: operations["spanSearch"];
333
333
  put?: never;
@@ -338,6 +338,30 @@ export interface paths {
338
338
  patch?: never;
339
339
  trace?: never;
340
340
  };
341
+ "/v1/projects/{project_identifier}/spans": {
342
+ parameters: {
343
+ query?: never;
344
+ header?: never;
345
+ path?: never;
346
+ cookie?: never;
347
+ };
348
+ /**
349
+ * List spans with simple filters (no DSL)
350
+ * @description Return spans within a project filtered by time range. Supports cursor-based pagination.
351
+ */
352
+ get: operations["getSpans"];
353
+ put?: never;
354
+ /**
355
+ * Create spans
356
+ * @description Submit spans to be inserted into a project. If any spans are invalid or duplicates, no spans will be inserted.
357
+ */
358
+ post: operations["createSpans"];
359
+ delete?: never;
360
+ options?: never;
361
+ head?: never;
362
+ patch?: never;
363
+ trace?: never;
364
+ };
341
365
  "/v1/span_annotations": {
342
366
  parameters: {
343
367
  query?: never;
@@ -803,6 +827,24 @@ export interface components {
803
827
  CreatePromptResponseBody: {
804
828
  data: components["schemas"]["PromptVersion"];
805
829
  };
830
+ /** CreateSpansRequestBody */
831
+ CreateSpansRequestBody: {
832
+ /** Data */
833
+ data: components["schemas"]["Span"][];
834
+ };
835
+ /** CreateSpansResponseBody */
836
+ CreateSpansResponseBody: {
837
+ /**
838
+ * Total Received
839
+ * @description Total number of spans received
840
+ */
841
+ total_received: number;
842
+ /**
843
+ * Total Queued
844
+ * @description Number of spans successfully queued for insertion
845
+ */
846
+ total_queued: number;
847
+ };
806
848
  /** CreateUserRequestBody */
807
849
  CreateUserRequestBody: {
808
850
  /** User */
@@ -1221,7 +1263,7 @@ export interface components {
1221
1263
  * ModelProvider
1222
1264
  * @enum {string}
1223
1265
  */
1224
- ModelProvider: "OPENAI" | "AZURE_OPENAI" | "ANTHROPIC" | "GOOGLE" | "DEEPSEEK" | "XAI";
1266
+ ModelProvider: "OPENAI" | "AZURE_OPENAI" | "ANTHROPIC" | "GOOGLE" | "DEEPSEEK" | "XAI" | "OLLAMA" | "AWS";
1225
1267
  /** OAuth2User */
1226
1268
  OAuth2User: {
1227
1269
  /** Id */
@@ -1463,6 +1505,16 @@ export interface components {
1463
1505
  */
1464
1506
  trace_state?: string | null;
1465
1507
  };
1508
+ /**
1509
+ * OtlpSpansResponseBody
1510
+ * @description Paginated response where each span follows OTLP JSON structure.
1511
+ */
1512
+ OtlpSpansResponseBody: {
1513
+ /** Data */
1514
+ data: components["schemas"]["OtlpSpan"][];
1515
+ /** Next Cursor */
1516
+ next_cursor: string | null;
1517
+ };
1466
1518
  /** OtlpStatus */
1467
1519
  OtlpStatus: {
1468
1520
  /**
@@ -1535,6 +1587,24 @@ export interface components {
1535
1587
  /** Budget Tokens */
1536
1588
  budget_tokens: number;
1537
1589
  };
1590
+ /** PromptAwsInvocationParameters */
1591
+ PromptAwsInvocationParameters: {
1592
+ /**
1593
+ * @description discriminator enum property added by openapi-typescript
1594
+ * @enum {string}
1595
+ */
1596
+ type: "aws";
1597
+ aws: components["schemas"]["PromptAwsInvocationParametersContent"];
1598
+ };
1599
+ /** PromptAwsInvocationParametersContent */
1600
+ PromptAwsInvocationParametersContent: {
1601
+ /** Max Tokens */
1602
+ max_tokens?: number;
1603
+ /** Temperature */
1604
+ temperature?: number;
1605
+ /** Top P */
1606
+ top_p?: number;
1607
+ };
1538
1608
  /** PromptAzureOpenAIInvocationParameters */
1539
1609
  PromptAzureOpenAIInvocationParameters: {
1540
1610
  /**
@@ -1651,6 +1721,37 @@ export interface components {
1651
1721
  /** Content */
1652
1722
  content: string | (components["schemas"]["TextContentPart"] | components["schemas"]["ToolCallContentPart"] | components["schemas"]["ToolResultContentPart"])[];
1653
1723
  };
1724
+ /** PromptOllamaInvocationParameters */
1725
+ PromptOllamaInvocationParameters: {
1726
+ /**
1727
+ * @description discriminator enum property added by openapi-typescript
1728
+ * @enum {string}
1729
+ */
1730
+ type: "ollama";
1731
+ ollama: components["schemas"]["PromptOllamaInvocationParametersContent"];
1732
+ };
1733
+ /** PromptOllamaInvocationParametersContent */
1734
+ PromptOllamaInvocationParametersContent: {
1735
+ /** Temperature */
1736
+ temperature?: number;
1737
+ /** Max Tokens */
1738
+ max_tokens?: number;
1739
+ /** Max Completion Tokens */
1740
+ max_completion_tokens?: number;
1741
+ /** Frequency Penalty */
1742
+ frequency_penalty?: number;
1743
+ /** Presence Penalty */
1744
+ presence_penalty?: number;
1745
+ /** Top P */
1746
+ top_p?: number;
1747
+ /** Seed */
1748
+ seed?: number;
1749
+ /**
1750
+ * Reasoning Effort
1751
+ * @enum {string}
1752
+ */
1753
+ reasoning_effort?: "low" | "medium" | "high";
1754
+ };
1654
1755
  /** PromptOpenAIInvocationParameters */
1655
1756
  PromptOpenAIInvocationParameters: {
1656
1757
  /**
@@ -1806,7 +1907,7 @@ export interface components {
1806
1907
  template_type: components["schemas"]["PromptTemplateType"];
1807
1908
  template_format: components["schemas"]["PromptTemplateFormat"];
1808
1909
  /** Invocation Parameters */
1809
- invocation_parameters: components["schemas"]["PromptOpenAIInvocationParameters"] | components["schemas"]["PromptAzureOpenAIInvocationParameters"] | components["schemas"]["PromptAnthropicInvocationParameters"] | components["schemas"]["PromptGoogleInvocationParameters"] | components["schemas"]["PromptDeepSeekInvocationParameters"] | components["schemas"]["PromptXAIInvocationParameters"];
1910
+ 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"];
1810
1911
  tools?: components["schemas"]["PromptTools"] | null;
1811
1912
  /** Response Format */
1812
1913
  response_format?: components["schemas"]["PromptResponseFormatJSONSchema"] | null;
@@ -1825,7 +1926,7 @@ export interface components {
1825
1926
  template_type: components["schemas"]["PromptTemplateType"];
1826
1927
  template_format: components["schemas"]["PromptTemplateFormat"];
1827
1928
  /** Invocation Parameters */
1828
- invocation_parameters: components["schemas"]["PromptOpenAIInvocationParameters"] | components["schemas"]["PromptAzureOpenAIInvocationParameters"] | components["schemas"]["PromptAnthropicInvocationParameters"] | components["schemas"]["PromptGoogleInvocationParameters"] | components["schemas"]["PromptDeepSeekInvocationParameters"] | components["schemas"]["PromptXAIInvocationParameters"];
1929
+ 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"];
1829
1930
  tools?: components["schemas"]["PromptTools"] | null;
1830
1931
  /** Response Format */
1831
1932
  response_format?: components["schemas"]["PromptResponseFormatJSONSchema"] | null;
@@ -1875,6 +1976,67 @@ export interface components {
1875
1976
  */
1876
1977
  reasoning_effort?: "low" | "medium" | "high";
1877
1978
  };
1979
+ /** Span */
1980
+ Span: {
1981
+ /**
1982
+ * Id
1983
+ * @description Span Global ID, distinct from the OpenTelemetry span ID
1984
+ * @default
1985
+ */
1986
+ id?: string;
1987
+ /**
1988
+ * Name
1989
+ * @description Name of the span operation
1990
+ */
1991
+ name: string;
1992
+ /** @description Span context containing trace_id and span_id */
1993
+ context: components["schemas"]["SpanContext"];
1994
+ /**
1995
+ * Span Kind
1996
+ * @description Type of work that the span encapsulates
1997
+ */
1998
+ span_kind: string;
1999
+ /**
2000
+ * Parent Id
2001
+ * @description OpenTelemetry span ID of the parent span
2002
+ */
2003
+ parent_id?: string | null;
2004
+ /**
2005
+ * Start Time
2006
+ * Format: date-time
2007
+ * @description Start time of the span
2008
+ */
2009
+ start_time: string;
2010
+ /**
2011
+ * End Time
2012
+ * Format: date-time
2013
+ * @description End time of the span
2014
+ */
2015
+ end_time: string;
2016
+ /**
2017
+ * Status Code
2018
+ * @description Status code of the span
2019
+ */
2020
+ status_code: string;
2021
+ /**
2022
+ * Status Message
2023
+ * @description Status message
2024
+ * @default
2025
+ */
2026
+ status_message?: string;
2027
+ /**
2028
+ * Attributes
2029
+ * @description Span attributes
2030
+ */
2031
+ attributes?: {
2032
+ [key: string]: unknown;
2033
+ };
2034
+ /**
2035
+ * Events
2036
+ * @description Span events
2037
+ */
2038
+ events?: components["schemas"]["SpanEvent"][];
2039
+ };
1878
2040
  /** SpanAnnotation */
1879
2041
  SpanAnnotation: {
1880
2042
  /**
@@ -1987,13 +2149,44 @@ export interface components {
1987
2149
  /** Next Cursor */
1988
2150
  next_cursor: string | null;
1989
2151
  };
1990
- /**
1991
- * SpanSearchResponseBody
1992
- * @description Paginated response where each span follows OTLP JSON structure.
1993
- */
1994
- SpanSearchResponseBody: {
2152
+ /** SpanContext */
2153
+ SpanContext: {
2154
+ /**
2155
+ * Trace Id
2156
+ * @description OpenTelemetry trace ID
2157
+ */
2158
+ trace_id: string;
2159
+ /**
2160
+ * Span Id
2161
+ * @description OpenTelemetry span ID
2162
+ */
2163
+ span_id: string;
2164
+ };
2165
+ /** SpanEvent */
2166
+ SpanEvent: {
2167
+ /**
2168
+ * Name
2169
+ * @description Name of the event
2170
+ */
2171
+ name: string;
2172
+ /**
2173
+ * Timestamp
2174
+ * Format: date-time
2175
+ * @description When the event occurred
2176
+ */
2177
+ timestamp: string;
2178
+ /**
2179
+ * Attributes
2180
+ * @description Event attributes
2181
+ */
2182
+ attributes?: {
2183
+ [key: string]: unknown;
2184
+ };
2185
+ };
2186
+ /** SpansResponseBody */
2187
+ SpansResponseBody: {
1995
2188
  /** Data */
1996
- data: components["schemas"]["OtlpSpan"][];
2189
+ data: components["schemas"]["Span"][];
1997
2190
  /** Next Cursor */
1998
2191
  next_cursor: string | null;
1999
2192
  };
@@ -2367,6 +2560,10 @@ export interface operations {
2367
2560
  query: {
2368
2561
  /** @description One or more span id to fetch annotations for */
2369
2562
  span_ids: string[];
2563
+ /** @description 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. */
2564
+ include_annotation_names?: string[] | null;
2565
+ /** @description Optional list of annotation names to exclude from results. */
2566
+ exclude_annotation_names?: string[] | null;
2370
2567
  /** @description A cursor for pagination */
2371
2568
  cursor?: string | null;
2372
2569
  /** @description The maximum number of annotations to return in a single request */
@@ -3263,18 +3460,73 @@ export interface operations {
3263
3460
  spanSearch: {
3264
3461
  parameters: {
3265
3462
  query?: {
3266
- /** @description Pagination cursor (GlobalID of Span) */
3463
+ /** @description Pagination cursor (Span Global ID) */
3464
+ cursor?: string | null;
3465
+ /** @description Maximum number of spans to return */
3466
+ limit?: number;
3467
+ /** @description Inclusive lower bound time */
3468
+ start_time?: string | null;
3469
+ /** @description Exclusive upper bound time */
3470
+ end_time?: string | null;
3471
+ };
3472
+ header?: never;
3473
+ path: {
3474
+ /** @description The project identifier: either project ID or project name. If using a project name, it cannot contain slash (/), question mark (?), or pound sign (#) characters. */
3475
+ project_identifier: string;
3476
+ };
3477
+ cookie?: never;
3478
+ };
3479
+ requestBody?: never;
3480
+ responses: {
3481
+ /** @description Successful Response */
3482
+ 200: {
3483
+ headers: {
3484
+ [name: string]: unknown;
3485
+ };
3486
+ content: {
3487
+ "application/json": components["schemas"]["OtlpSpansResponseBody"];
3488
+ };
3489
+ };
3490
+ /** @description Forbidden */
3491
+ 403: {
3492
+ headers: {
3493
+ [name: string]: unknown;
3494
+ };
3495
+ content: {
3496
+ "text/plain": string;
3497
+ };
3498
+ };
3499
+ /** @description Not Found */
3500
+ 404: {
3501
+ headers: {
3502
+ [name: string]: unknown;
3503
+ };
3504
+ content: {
3505
+ "text/plain": string;
3506
+ };
3507
+ };
3508
+ /** @description Unprocessable Entity */
3509
+ 422: {
3510
+ headers: {
3511
+ [name: string]: unknown;
3512
+ };
3513
+ content: {
3514
+ "text/plain": string;
3515
+ };
3516
+ };
3517
+ };
3518
+ };
3519
+ getSpans: {
3520
+ parameters: {
3521
+ query?: {
3522
+ /** @description Pagination cursor (Span Global ID) */
3267
3523
  cursor?: string | null;
3268
3524
  /** @description Maximum number of spans to return */
3269
3525
  limit?: number;
3270
- /** @description Sort direction for the sort field */
3271
- sort_direction?: "asc" | "desc";
3272
3526
  /** @description Inclusive lower bound time */
3273
3527
  start_time?: string | null;
3274
3528
  /** @description Exclusive upper bound time */
3275
3529
  end_time?: string | null;
3276
- /** @description If provided, only include spans that have at least one annotation with one of these names. */
3277
- annotationNames?: string[] | null;
3278
3530
  };
3279
3531
  header?: never;
3280
3532
  path: {
@@ -3291,7 +3543,7 @@ export interface operations {
3291
3543
  [name: string]: unknown;
3292
3544
  };
3293
3545
  content: {
3294
- "application/json": components["schemas"]["SpanSearchResponseBody"];
3546
+ "application/json": components["schemas"]["SpansResponseBody"];
3295
3547
  };
3296
3548
  };
3297
3549
  /** @description Forbidden */
@@ -3323,6 +3575,69 @@ export interface operations {
3323
3575
  };
3324
3576
  };
3325
3577
  };
3578
+ createSpans: {
3579
+ parameters: {
3580
+ query?: never;
3581
+ header?: never;
3582
+ path: {
3583
+ /** @description The project identifier: either project ID or project name. If using a project name, it cannot contain slash (/), question mark (?), or pound sign (#) characters. */
3584
+ project_identifier: string;
3585
+ };
3586
+ cookie?: never;
3587
+ };
3588
+ requestBody: {
3589
+ content: {
3590
+ "application/json": components["schemas"]["CreateSpansRequestBody"];
3591
+ };
3592
+ };
3593
+ responses: {
3594
+ /** @description Successful Response */
3595
+ 202: {
3596
+ headers: {
3597
+ [name: string]: unknown;
3598
+ };
3599
+ content: {
3600
+ "application/json": components["schemas"]["CreateSpansResponseBody"];
3601
+ };
3602
+ };
3603
+ /** @description Bad Request */
3604
+ 400: {
3605
+ headers: {
3606
+ [name: string]: unknown;
3607
+ };
3608
+ content: {
3609
+ "text/plain": string;
3610
+ };
3611
+ };
3612
+ /** @description Forbidden */
3613
+ 403: {
3614
+ headers: {
3615
+ [name: string]: unknown;
3616
+ };
3617
+ content: {
3618
+ "text/plain": string;
3619
+ };
3620
+ };
3621
+ /** @description Not Found */
3622
+ 404: {
3623
+ headers: {
3624
+ [name: string]: unknown;
3625
+ };
3626
+ content: {
3627
+ "text/plain": string;
3628
+ };
3629
+ };
3630
+ /** @description Validation Error */
3631
+ 422: {
3632
+ headers: {
3633
+ [name: string]: unknown;
3634
+ };
3635
+ content: {
3636
+ "application/json": components["schemas"]["HTTPValidationError"];
3637
+ };
3638
+ };
3639
+ };
3640
+ };
3326
3641
  annotateSpans: {
3327
3642
  parameters: {
3328
3643
  query?: {
@@ -8,4 +8,8 @@ export const PromptModelProviders: Record<PromptModelProvider, string> = {
8
8
  AZURE_OPENAI: "Azure OpenAI",
9
9
  ANTHROPIC: "Anthropic",
10
10
  GOOGLE: "Google",
11
+ DEEPSEEK: "DeepSeek",
12
+ XAI: "xAI",
13
+ OLLAMA: "Ollama",
14
+ AWS: "AWS Bedrock",
11
15
  };
@@ -8,6 +8,10 @@ import {
8
8
  AzureOpenAIInvocationParameters,
9
9
  AnthropicInvocationParameters,
10
10
  GoogleInvocationParameters,
11
+ DeepSeekInvocationParameters,
12
+ XAIInvocationParameters,
13
+ OllamaInvocationParameters,
14
+ AwsInvocationParameters,
11
15
  PromptChatMessage,
12
16
  } from "../types/prompts";
13
17
  import { assertUnreachable } from "../utils/assertUnreachable";
@@ -104,12 +108,22 @@ interface GooglePromptVersionInput extends PromptVersionInputBase {
104
108
 
105
109
  interface DeepSeekPromptVersionInput extends PromptVersionInputBase {
106
110
  modelProvider: "DEEPSEEK";
107
- invocationParameters?: OpenAIInvocationParameters;
111
+ invocationParameters?: DeepSeekInvocationParameters;
108
112
  }
109
113
 
110
114
  interface XAIPromptVersionInput extends PromptVersionInputBase {
111
115
  modelProvider: "XAI";
112
- invocationParameters?: OpenAIInvocationParameters;
116
+ invocationParameters?: XAIInvocationParameters;
117
+ }
118
+
119
+ interface OllamaPromptVersionInput extends PromptVersionInputBase {
120
+ modelProvider: "OLLAMA";
121
+ invocationParameters?: OllamaInvocationParameters;
122
+ }
123
+
124
+ interface AwsPromptVersionInput extends PromptVersionInputBase {
125
+ modelProvider: "AWS";
126
+ invocationParameters?: AwsInvocationParameters;
113
127
  }
114
128
 
115
129
  type PromptVersionInput =
@@ -118,7 +132,9 @@ type PromptVersionInput =
118
132
  | AnthropicPromptVersionInput
119
133
  | GooglePromptVersionInput
120
134
  | DeepSeekPromptVersionInput
121
- | XAIPromptVersionInput;
135
+ | XAIPromptVersionInput
136
+ | OllamaPromptVersionInput
137
+ | AwsPromptVersionInput;
122
138
 
123
139
  /**
124
140
  * A helper function to construct a prompt version declaratively.
@@ -234,6 +250,38 @@ export function promptVersion(params: PromptVersionInput): PromptVersionData {
234
250
  xai: invocation_parameters ?? {},
235
251
  },
236
252
  };
253
+ case "OLLAMA":
254
+ return {
255
+ description,
256
+ model_provider,
257
+ model_name,
258
+ template_type: "CHAT",
259
+ template_format,
260
+ template: {
261
+ type: "chat",
262
+ messages: templateMessages,
263
+ },
264
+ invocation_parameters: {
265
+ type: "ollama",
266
+ ollama: invocation_parameters ?? {},
267
+ },
268
+ };
269
+ case "AWS":
270
+ return {
271
+ description,
272
+ model_provider,
273
+ model_name,
274
+ template_type: "CHAT",
275
+ template_format,
276
+ template: {
277
+ type: "chat",
278
+ messages: templateMessages,
279
+ },
280
+ invocation_parameters: {
281
+ type: "aws",
282
+ aws: invocation_parameters ?? {},
283
+ },
284
+ };
237
285
  default:
238
286
  assertUnreachable(model_provider);
239
287
  }
@@ -0,0 +1,131 @@
1
+ import { createClient } from "../client";
2
+ import { ClientFn } from "../types/core";
3
+ import { operations } from "../__generated__/api/v1";
4
+ import { ProjectSelector } from "../types/projects";
5
+
6
+ /**
7
+ * Parameters to get span annotations from a project using auto-generated types
8
+ */
9
+ interface GetSpanAnnotationsParams extends ClientFn {
10
+ /** The project to get span annotations from */
11
+ project: ProjectSelector;
12
+ /** One or more span IDs to fetch annotations for */
13
+ spanIds: string[];
14
+ /** 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. */
15
+ includeAnnotationNames?: string[];
16
+ /** Optional list of annotation names to exclude from results. */
17
+ excludeAnnotationNames?: string[];
18
+ /** Pagination cursor */
19
+ cursor?: string | null;
20
+ /** Maximum number of annotations to return */
21
+ limit?: number;
22
+ }
23
+
24
+ type GetSpanAnnotationsResponse =
25
+ operations["listSpanAnnotationsBySpanIds"]["responses"]["200"];
26
+
27
+ export type GetSpanAnnotationsResult = {
28
+ annotations: GetSpanAnnotationsResponse["content"]["application/json"]["data"];
29
+ nextCursor: GetSpanAnnotationsResponse["content"]["application/json"]["next_cursor"];
30
+ };
31
+
32
+ /**
33
+ * Get span annotations for a list of span IDs.
34
+ *
35
+ * This method allows you to retrieve annotations for specific spans within a project.
36
+ * You can filter annotations by name and support cursor-based pagination.
37
+ *
38
+ * @experimental this function is experimental and may change in the future
39
+ *
40
+ * @param params - The parameters to get span annotations
41
+ * @returns A paginated response containing annotations and optional next cursor
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * // Get annotations for specific spans
46
+ * const result = await getSpanAnnotations({
47
+ * client,
48
+ * project: { projectName: "my-project" },
49
+ * spanIds: ["span1", "span2", "span3"],
50
+ * limit: 50
51
+ * });
52
+ *
53
+ * // Get specific annotation types
54
+ * const result = await getSpanAnnotations({
55
+ * client,
56
+ * project: { projectName: "my-project" },
57
+ * spanIds: ["span1"],
58
+ * includeAnnotationNames: ["quality_score", "sentiment"],
59
+ * limit: 100
60
+ * });
61
+ *
62
+ * // Paginate through results
63
+ * let cursor: string | undefined;
64
+ * do {
65
+ * const result = await getSpanAnnotations({
66
+ * client,
67
+ * project: { projectName: "my-project" },
68
+ * spanIds: ["span1"],
69
+ * cursor,
70
+ * limit: 100
71
+ * });
72
+ *
73
+ * // Process annotations
74
+ * result.annotations.forEach(annotation => {
75
+ * console.log(`Annotation: ${annotation.name}, Label: ${annotation.result.label}`);
76
+ * });
77
+ *
78
+ * cursor = result.nextCursor || undefined;
79
+ * } while (cursor);
80
+ * ```
81
+ */
82
+ export async function getSpanAnnotations({
83
+ client: _client,
84
+ project,
85
+ spanIds,
86
+ includeAnnotationNames,
87
+ excludeAnnotationNames,
88
+ cursor,
89
+ limit = 100,
90
+ }: GetSpanAnnotationsParams): Promise<GetSpanAnnotationsResult> {
91
+ const client = _client ?? createClient();
92
+ const projectIdentifier =
93
+ "projectId" in project ? project.projectId : project.projectName;
94
+
95
+ const params: NonNullable<
96
+ operations["listSpanAnnotationsBySpanIds"]["parameters"]["query"]
97
+ > = {
98
+ span_ids: spanIds,
99
+ limit,
100
+ };
101
+
102
+ if (cursor) {
103
+ params.cursor = cursor;
104
+ }
105
+
106
+ if (includeAnnotationNames !== undefined) {
107
+ params.include_annotation_names = includeAnnotationNames;
108
+ }
109
+
110
+ if (excludeAnnotationNames !== undefined) {
111
+ params.exclude_annotation_names = excludeAnnotationNames;
112
+ }
113
+
114
+ const { data, error } = await client.GET(
115
+ "/v1/projects/{project_identifier}/span_annotations",
116
+ {
117
+ params: {
118
+ path: {
119
+ project_identifier: projectIdentifier,
120
+ },
121
+ query: params,
122
+ },
123
+ }
124
+ );
125
+
126
+ if (error) throw error;
127
+ return {
128
+ annotations: data?.data ?? [],
129
+ nextCursor: data?.next_cursor ?? null,
130
+ };
131
+ }