@arizeai/phoenix-client 6.5.3 → 6.5.4
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 +45 -0
- package/dist/esm/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -492,6 +492,51 @@ console.log(result.data); // array of span annotation objects
|
|
|
492
492
|
| `cursor` | `string \| null` | Pagination cursor |
|
|
493
493
|
| `limit` | `number` | Maximum annotations to return |
|
|
494
494
|
|
|
495
|
+
## Sessions
|
|
496
|
+
|
|
497
|
+
The `@arizeai/phoenix-client` package provides a `sessions` export for managing conversation sessions and their annotations.
|
|
498
|
+
|
|
499
|
+
### Fetching Sessions
|
|
500
|
+
|
|
501
|
+
Use `listSessions` to list all sessions for a project, or `getSession` to retrieve a single session by ID.
|
|
502
|
+
|
|
503
|
+
```ts
|
|
504
|
+
import {
|
|
505
|
+
listSessions,
|
|
506
|
+
getSession,
|
|
507
|
+
addSessionAnnotation,
|
|
508
|
+
} from "@arizeai/phoenix-client/sessions";
|
|
509
|
+
|
|
510
|
+
// List all sessions for a project
|
|
511
|
+
const sessions = await listSessions({
|
|
512
|
+
project: "my-project",
|
|
513
|
+
});
|
|
514
|
+
|
|
515
|
+
for (const session of sessions) {
|
|
516
|
+
console.log(
|
|
517
|
+
`Session: ${session.sessionId}, Traces: ${session.traces.length}`
|
|
518
|
+
);
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
// Get a single session by its ID
|
|
522
|
+
const session = await getSession({ sessionId: "my-session-id" });
|
|
523
|
+
console.log(session.traces); // array of trace summaries in the session
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
### Adding Session Annotations
|
|
527
|
+
|
|
528
|
+
```ts
|
|
529
|
+
await addSessionAnnotation({
|
|
530
|
+
sessionAnnotation: {
|
|
531
|
+
sessionId: "my-session-id",
|
|
532
|
+
name: "user-satisfaction",
|
|
533
|
+
label: "satisfied",
|
|
534
|
+
score: 0.9,
|
|
535
|
+
annotatorKind: "HUMAN",
|
|
536
|
+
},
|
|
537
|
+
});
|
|
538
|
+
```
|
|
539
|
+
|
|
495
540
|
## Examples
|
|
496
541
|
|
|
497
542
|
To run examples, install dependencies using `pnpm` and run:
|