@arizeai/phoenix-client 6.12.2 → 6.14.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/README.md +27 -0
- package/dist/esm/__generated__/api/v1.d.ts +669 -29
- package/dist/esm/__generated__/api/v1.d.ts.map +1 -1
- package/dist/esm/authFetch.d.ts +30 -0
- package/dist/esm/authFetch.d.ts.map +1 -0
- package/dist/esm/authFetch.js +49 -0
- package/dist/esm/authFetch.js.map +1 -0
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +2 -2
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/errors.d.ts +15 -0
- package/dist/esm/errors.d.ts.map +1 -0
- package/dist/esm/errors.js +22 -0
- package/dist/esm/errors.js.map +1 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/spans/logSpans.d.ts.map +1 -1
- package/dist/esm/spans/logSpans.js +32 -9
- package/dist/esm/spans/logSpans.js.map +1 -1
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/src/__generated__/api/v1.d.ts +669 -29
- package/dist/src/__generated__/api/v1.d.ts.map +1 -1
- package/dist/src/authFetch.d.ts +30 -0
- package/dist/src/authFetch.d.ts.map +1 -0
- package/dist/src/authFetch.js +52 -0
- package/dist/src/authFetch.js.map +1 -0
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/client.js +2 -2
- package/dist/src/client.js.map +1 -1
- package/dist/src/errors.d.ts +15 -0
- package/dist/src/errors.d.ts.map +1 -0
- package/dist/src/errors.js +22 -0
- package/dist/src/errors.js.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/spans/logSpans.d.ts.map +1 -1
- package/dist/src/spans/logSpans.js +32 -9
- package/dist/src/spans/logSpans.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/docs/overview.mdx +1 -0
- package/package.json +14 -13
- package/src/__generated__/api/v1.ts +669 -29
- package/src/authFetch.ts +87 -0
- package/src/client.ts +2 -4
- package/src/errors.ts +22 -0
- package/src/index.ts +2 -0
- package/src/spans/logSpans.ts +27 -4
package/README.md
CHANGED
|
@@ -63,6 +63,31 @@ const phoenix = createClient({
|
|
|
63
63
|
});
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
+
For credentials that can expire, create an authenticated fetch implementation
|
|
67
|
+
and pass it to the client. The token provider controls storage and refresh-token
|
|
68
|
+
rotation. Requests that receive a `401` share one refresh operation and are
|
|
69
|
+
retried once.
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
import { createAuthFetch, createClient } from "@arizeai/phoenix-client";
|
|
73
|
+
|
|
74
|
+
const authFetch = createAuthFetch({
|
|
75
|
+
getAccessToken: async ({ forceRefresh }) => {
|
|
76
|
+
if (forceRefresh) {
|
|
77
|
+
await refreshAndPersistTokens();
|
|
78
|
+
}
|
|
79
|
+
return loadTokens().accessToken;
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
const phoenix = createClient({
|
|
84
|
+
options: {
|
|
85
|
+
baseUrl: "http://localhost:6006",
|
|
86
|
+
fetch: authFetch,
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
66
91
|
## Prompts
|
|
67
92
|
|
|
68
93
|
`@arizeai/phoenix-client` provides a `prompts` export that exposes utilities for working with prompts for LLMs.
|
|
@@ -128,6 +153,8 @@ The following LLM provider SDKs are supported:
|
|
|
128
153
|
- OpenAI: `openai` [openai](https://www.npmjs.com/package/openai)
|
|
129
154
|
- Anthropic: `anthropic` [@anthropic-ai/sdk](https://www.npmjs.com/package/@anthropic-ai/sdk)
|
|
130
155
|
|
|
156
|
+
> **Note:** These provider SDKs are optional peer dependencies — installing `@arizeai/phoenix-client` does not pull them in. Install the one you convert to yourself, e.g. `npm install ai`, `npm install openai`, or `npm install @anthropic-ai/sdk`. Calling `toSDK({ sdk: "ai" | "openai" | "anthropic" })` without the matching SDK installed fails at runtime.
|
|
157
|
+
|
|
131
158
|
```ts
|
|
132
159
|
import { generateText } from "ai";
|
|
133
160
|
import { openai } from "@ai-sdk/openai";
|