@amigo-ai/platform-sdk 0.17.3 → 0.19.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/api.md +1 -0
- package/dist/index.cjs +38 -1
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs +38 -1
- package/dist/index.mjs.map +2 -2
- package/dist/resources/conversations.js +34 -0
- package/dist/resources/conversations.js.map +1 -1
- package/dist/types/generated/api.d.ts +615 -31
- package/dist/types/generated/api.d.ts.map +1 -1
- package/dist/types/resources/billing.d.ts +4 -0
- package/dist/types/resources/billing.d.ts.map +1 -1
- package/dist/types/resources/conversations.d.ts +29 -0
- package/dist/types/resources/conversations.d.ts.map +1 -1
- package/dist/types/resources/functions.d.ts.map +1 -1
- package/dist/types/resources/integrations.d.ts +140 -10
- package/dist/types/resources/integrations.d.ts.map +1 -1
- package/dist/types/resources/metrics.d.ts.map +1 -1
- package/dist/types/resources/settings.d.ts.map +1 -1
- package/package.json +1 -1
package/api.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1984,10 +1984,47 @@ var ConversationsResource = class extends WorkspaceScopedResource {
|
|
|
1984
1984
|
params: {
|
|
1985
1985
|
path: { workspace_id: this.workspaceId, conversation_id: conversationId }
|
|
1986
1986
|
},
|
|
1987
|
-
body: request
|
|
1987
|
+
body: request,
|
|
1988
|
+
headers: { Accept: "application/json" }
|
|
1988
1989
|
})
|
|
1989
1990
|
);
|
|
1990
1991
|
}
|
|
1992
|
+
/**
|
|
1993
|
+
* Send a message and receive the agent's response as an SSE stream.
|
|
1994
|
+
*
|
|
1995
|
+
* Returns a `ReadableStream` of SSE bytes. Use `EventSourceParserStream`
|
|
1996
|
+
* (from `eventsource-parser/stream`) to parse into typed `TurnStreamEvent`.
|
|
1997
|
+
*
|
|
1998
|
+
* @example
|
|
1999
|
+
* ```ts
|
|
2000
|
+
* const stream = await client.conversations.createTurnStream(convId, { message: "Hello" });
|
|
2001
|
+
* const events = stream
|
|
2002
|
+
* .pipeThrough(new TextDecoderStream())
|
|
2003
|
+
* .pipeThrough(new EventSourceParserStream());
|
|
2004
|
+
* for await (const event of events) {
|
|
2005
|
+
* const parsed = JSON.parse(event.data) as TurnStreamEvent;
|
|
2006
|
+
* if (parsed.event === "token") console.log(parsed.text);
|
|
2007
|
+
* }
|
|
2008
|
+
* ```
|
|
2009
|
+
*/
|
|
2010
|
+
async createTurnStream(conversationId, request, options) {
|
|
2011
|
+
const result = await this.client.POST(
|
|
2012
|
+
"/v1/{workspace_id}/conversations/{conversation_id}/turns",
|
|
2013
|
+
{
|
|
2014
|
+
params: {
|
|
2015
|
+
path: { workspace_id: this.workspaceId, conversation_id: conversationId }
|
|
2016
|
+
},
|
|
2017
|
+
body: request,
|
|
2018
|
+
headers: { Accept: "text/event-stream" },
|
|
2019
|
+
parseAs: "stream",
|
|
2020
|
+
signal: options?.signal
|
|
2021
|
+
}
|
|
2022
|
+
);
|
|
2023
|
+
if (result.error !== void 0) {
|
|
2024
|
+
throw new Error(`API error: ${JSON.stringify(result.error)}`);
|
|
2025
|
+
}
|
|
2026
|
+
return result.data;
|
|
2027
|
+
}
|
|
1991
2028
|
/** Build the real-time text WebSocket URL for browser or custom clients. */
|
|
1992
2029
|
textStreamUrl(params) {
|
|
1993
2030
|
const url = buildTextStreamUrl({
|