@arizeai/phoenix-client 5.7.0 → 5.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arizeai/phoenix-client",
3
- "version": "5.7.0",
3
+ "version": "5.8.0",
4
4
  "description": "A client for the Phoenix API",
5
5
  "main": "dist/src/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -85,8 +85,8 @@
85
85
  "tiny-invariant": "^1.3.3",
86
86
  "zod": "^3.24.3",
87
87
  "zod-to-json-schema": "^3.24.3",
88
- "@arizeai/phoenix-otel": "0.3.4",
89
- "@arizeai/phoenix-config": "0.1.0"
88
+ "@arizeai/phoenix-config": "0.1.0",
89
+ "@arizeai/phoenix-otel": "0.3.4"
90
90
  },
91
91
  "engines": {
92
92
  "node": ">=18"
@@ -1,3 +1,4 @@
1
1
  export * from "./getPrompt";
2
2
  export * from "./createPrompt";
3
+ export * from "./listPrompts";
3
4
  export * from "./sdks";
@@ -0,0 +1,29 @@
1
+ import { createClient } from "../client";
2
+ import { ClientFn } from "../types/core";
3
+ import { Prompt } from "../types/prompts";
4
+
5
+ import invariant from "tiny-invariant";
6
+
7
+ export type ListPromptsParams = ClientFn;
8
+
9
+ /**
10
+ * List all prompts available to the client.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import { listPrompts } from "@arizeai/phoenix-client/prompts";
15
+ *
16
+ * const prompts = await listPrompts({});
17
+ * console.log(prompts);
18
+ * ```
19
+ *
20
+ * @throws {Error} If the prompts cannot be listed or the response is invalid.
21
+ */
22
+ export async function listPrompts({
23
+ client: _client,
24
+ }: ListPromptsParams): Promise<Prompt[]> {
25
+ const client = _client || createClient();
26
+ const response = await client.GET("/v1/prompts");
27
+ invariant(response.data?.data, "Failed to list prompts");
28
+ return response.data.data;
29
+ }