@serenity-star/sdk 2.5.2 → 2.6.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/dist/index.d.mts +43 -4
- package/dist/index.d.ts +43 -4
- 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 +28 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serenity-star/sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
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
|
@@ -834,7 +834,7 @@ await activity.stream();
|
|
|
834
834
|
|
|
835
835
|
## Upload Files (Volatile Knowledge)
|
|
836
836
|
|
|
837
|
-
Upload files to be used as context in your agent executions. This feature is available for all agent types: **Assistants**, **Copilots**, **Activities**, **Proxies**, and **Chat Completions**. Files are automatically included in the next message or execution.
|
|
837
|
+
Upload files to be used as context in your agent executions. This feature is available for all agent types: **Assistants**, **Copilots**, **Activities**, **Proxies**, and **Chat Completions**. Files are agent-scoped automatically and are included in the next message or execution.
|
|
838
838
|
|
|
839
839
|
```tsx
|
|
840
840
|
import SerenityClient from '@serenity-star/sdk';
|
|
@@ -846,6 +846,10 @@ const client = new SerenityClient({
|
|
|
846
846
|
// Works with any agent type (Assistant, Copilot, Activity, Proxy, Chat Completion)
|
|
847
847
|
const conversation = await client.agents.assistants.createConversation("document-analyzer");
|
|
848
848
|
|
|
849
|
+
// Check the file types supported by this specific agent
|
|
850
|
+
const supportedMimeTypes = await conversation.volatileKnowledge.getSupportedMimeTypes();
|
|
851
|
+
console.log("Supported MIME types:", supportedMimeTypes);
|
|
852
|
+
|
|
849
853
|
// Upload a file (basic example)
|
|
850
854
|
const file = new File(["content"], "document.pdf", { type: "application/pdf" });
|
|
851
855
|
const uploadResult = await conversation.volatileKnowledge.upload(file);
|
|
@@ -872,6 +876,7 @@ if (uploadResult.success) {
|
|
|
872
876
|
const imageFile = new File(["image data"], "chart.png", { type: "image/png" });
|
|
873
877
|
const uploadWithOptions = await conversation.volatileKnowledge.upload(imageFile, {
|
|
874
878
|
useVision: true, // Enable vision for image files (automatically skips embeddings for images)
|
|
879
|
+
processEmbeddings: false, // Optional: explicitly control embeddings generation
|
|
875
880
|
noExpiration: false, // File will expire (default behavior)
|
|
876
881
|
expirationDays: 7, // Custom expiration in days
|
|
877
882
|
locale: {
|
|
@@ -885,6 +890,28 @@ if (uploadWithOptions.success) {
|
|
|
885
890
|
console.log(response.content);
|
|
886
891
|
}
|
|
887
892
|
|
|
893
|
+
// Create volatile knowledge from an existing platform file ID
|
|
894
|
+
const fromFileId = await conversation.volatileKnowledge.uploadFromFileId("existing-file-id", {
|
|
895
|
+
callbackUrl: "https://example.com/volatile-knowledge/callback",
|
|
896
|
+
processEmbeddings: true,
|
|
897
|
+
expirationDays: 7,
|
|
898
|
+
});
|
|
899
|
+
|
|
900
|
+
// Create volatile knowledge from a remote URL
|
|
901
|
+
const fromUrl = await conversation.volatileKnowledge.uploadFromUrl("https://example.com/report.pdf", {
|
|
902
|
+
fileName: "report.pdf",
|
|
903
|
+
processEmbeddings: true,
|
|
904
|
+
noExpiration: false,
|
|
905
|
+
});
|
|
906
|
+
|
|
907
|
+
// Create volatile knowledge from base64 content
|
|
908
|
+
const fromBase64 = await conversation.volatileKnowledge.uploadFromBase64(contentBase64, {
|
|
909
|
+
fileName: "report.pdf",
|
|
910
|
+
mimeType: "application/pdf",
|
|
911
|
+
processEmbeddings: true,
|
|
912
|
+
expirationDays: 7,
|
|
913
|
+
});
|
|
914
|
+
|
|
888
915
|
// Check file status by ID
|
|
889
916
|
const fileStatus = await conversation.volatileKnowledge.getById(uploadResult.id);
|
|
890
917
|
|