@serenity-star/sdk 2.6.4 → 2.6.5
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/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/readme.md +25 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serenity-star/sdk",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.5",
|
|
4
4
|
"description": "The Serenity Star JavaScript SDK provides a convenient way to interact with the Serenity Star API, enabling you to build custom applications.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
package/readme.md
CHANGED
|
@@ -38,6 +38,7 @@ The Serenity Star JS/TS SDK provides a comprehensive interface for interacting w
|
|
|
38
38
|
- [Shared Features](#shared-features)
|
|
39
39
|
- [Download Attached Files](#download-attached-files)
|
|
40
40
|
- [Stop Streaming Response](#stop-streaming-response)
|
|
41
|
+
- [Reasoning (Chain-of-Thought)](#reasoning-chain-of-thought)
|
|
41
42
|
- [Citations](#citations)
|
|
42
43
|
- [Citations on stored messages](#citations-on-stored-messages)
|
|
43
44
|
- [Upload Files (Volatile Knowledge)](#upload-files-volatile-knowledge)
|
|
@@ -844,6 +845,30 @@ const activity = client.agents.activities.create("translator-activity", {
|
|
|
844
845
|
await activity.stream();
|
|
845
846
|
```
|
|
846
847
|
|
|
848
|
+
## Reasoning (Chain-of-Thought)
|
|
849
|
+
|
|
850
|
+
When an agent is configured with a reasoning-capable model, its chain-of-thought is streamed incrementally through the `reasoning` event, separate from the final answer delivered on `content`. This works across all streaming agent types: **Assistants**, **Copilots**, **Activities**, **Proxies**, and **Chat Completions**.
|
|
851
|
+
|
|
852
|
+
```tsx
|
|
853
|
+
import SerenityClient from '@serenity-star/sdk';
|
|
854
|
+
|
|
855
|
+
const client = new SerenityClient({
|
|
856
|
+
apiKey: '<SERENITY_API_KEY>',
|
|
857
|
+
});
|
|
858
|
+
|
|
859
|
+
const conversation = await client.agents.assistants.createConversation("chef-assistant");
|
|
860
|
+
|
|
861
|
+
conversation
|
|
862
|
+
.on("reasoning", (chunk) => {
|
|
863
|
+
process.stdout.write(chunk); // Stream the model's thinking as it happens
|
|
864
|
+
})
|
|
865
|
+
.on("content", (chunk) => {
|
|
866
|
+
process.stdout.write(chunk); // The final answer
|
|
867
|
+
});
|
|
868
|
+
|
|
869
|
+
await conversation.streamMessage("Plan a three-course vegetarian dinner");
|
|
870
|
+
```
|
|
871
|
+
|
|
847
872
|
## Citations
|
|
848
873
|
|
|
849
874
|
When an agent grounds its response in knowledge sources (knowledge files or websites), it returns **citations** that map spans of the generated message back to the source passages they came from. Citations are available across all agent types that support knowledge grounding.
|