@letta-ai/letta-client 1.6.3 → 1.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/CHANGELOG.md +22 -0
- package/client.d.mts +3 -0
- package/client.d.mts.map +1 -1
- package/client.d.ts +3 -0
- package/client.d.ts.map +1 -1
- package/client.js +3 -0
- package/client.js.map +1 -1
- package/client.mjs +3 -0
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/agents/messages.d.mts +19 -3
- package/resources/agents/messages.d.mts.map +1 -1
- package/resources/agents/messages.d.ts +19 -3
- package/resources/agents/messages.d.ts.map +1 -1
- package/resources/agents/messages.js +10 -3
- package/resources/agents/messages.js.map +1 -1
- package/resources/agents/messages.mjs +10 -3
- package/resources/agents/messages.mjs.map +1 -1
- package/resources/conversations/conversations.d.mts +96 -0
- package/resources/conversations/conversations.d.mts.map +1 -0
- package/resources/conversations/conversations.d.ts +96 -0
- package/resources/conversations/conversations.d.ts.map +1 -0
- package/resources/conversations/conversations.js +37 -0
- package/resources/conversations/conversations.js.map +1 -0
- package/resources/conversations/conversations.mjs +32 -0
- package/resources/conversations/conversations.mjs.map +1 -0
- package/resources/conversations/index.d.mts +3 -0
- package/resources/conversations/index.d.mts.map +1 -0
- package/resources/conversations/index.d.ts +3 -0
- package/resources/conversations/index.d.ts.map +1 -0
- package/resources/conversations/index.js +9 -0
- package/resources/conversations/index.js.map +1 -0
- package/resources/conversations/index.mjs +4 -0
- package/resources/conversations/index.mjs.map +1 -0
- package/resources/conversations/messages.d.mts +198 -0
- package/resources/conversations/messages.d.mts.map +1 -0
- package/resources/conversations/messages.d.ts +198 -0
- package/resources/conversations/messages.d.ts.map +1 -0
- package/resources/conversations/messages.js +46 -0
- package/resources/conversations/messages.js.map +1 -0
- package/resources/conversations/messages.mjs +42 -0
- package/resources/conversations/messages.mjs.map +1 -0
- package/resources/conversations.d.mts +2 -0
- package/resources/conversations.d.mts.map +1 -0
- package/resources/conversations.d.ts +2 -0
- package/resources/conversations.d.ts.map +1 -0
- package/resources/conversations.js +6 -0
- package/resources/conversations.js.map +1 -0
- package/resources/conversations.mjs +3 -0
- package/resources/conversations.mjs.map +1 -0
- package/resources/index.d.mts +1 -0
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/resources/messages.d.mts +8 -0
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts +8 -0
- package/resources/messages.d.ts.map +1 -1
- package/src/client.ts +19 -0
- package/src/resources/agents/messages.ts +21 -3
- package/src/resources/conversations/conversations.ts +148 -0
- package/src/resources/conversations/index.ts +18 -0
- package/src/resources/conversations/messages.ts +277 -0
- package/src/resources/conversations.ts +3 -0
- package/src/resources/index.ts +8 -0
- package/src/resources/messages.ts +10 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../../core/resource.mjs";
|
|
3
|
+
import * as MessagesAPI from "./messages.mjs";
|
|
4
|
+
import { Messages, } from "./messages.mjs";
|
|
5
|
+
import { path } from "../../internal/utils/path.mjs";
|
|
6
|
+
export class Conversations extends APIResource {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.messages = new MessagesAPI.Messages(this._client);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Create a new conversation for an agent.
|
|
13
|
+
*/
|
|
14
|
+
create(params, options) {
|
|
15
|
+
const { agent_id, ...body } = params;
|
|
16
|
+
return this._client.post('/v1/conversations/', { query: { agent_id }, body, ...options });
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Retrieve a specific conversation.
|
|
20
|
+
*/
|
|
21
|
+
retrieve(conversationID, options) {
|
|
22
|
+
return this._client.get(path `/v1/conversations/${conversationID}`, options);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* List all conversations for an agent.
|
|
26
|
+
*/
|
|
27
|
+
list(query, options) {
|
|
28
|
+
return this._client.get('/v1/conversations/', { query, ...options });
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
Conversations.Messages = Messages;
|
|
32
|
+
//# sourceMappingURL=conversations.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversations.mjs","sourceRoot":"","sources":["../../src/resources/conversations/conversations.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,KAAK,WAAW;OAChB,EAML,QAAQ,GACT;OAGM,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,aAAc,SAAQ,WAAW;IAA9C;;QACE,aAAQ,GAAyB,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAuB1E,CAAC;IArBC;;OAEG;IACH,MAAM,CAAC,MAAgC,EAAE,OAAwB;QAC/D,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QACrC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC5F,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,cAAsB,EAAE,OAAwB;QACvD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,qBAAqB,cAAc,EAAE,EAAE,OAAO,CAAC,CAAC;IAC9E,CAAC;IAED;;OAEG;IACH,IAAI,CAAC,KAA6B,EAAE,OAAwB;QAC1D,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACvE,CAAC;CACF;AAwFD,aAAa,CAAC,QAAQ,GAAG,QAAQ,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { Conversations, type Conversation, type CreateConversation, type ConversationListResponse, type ConversationCreateParams, type ConversationListParams, } from "./conversations.mjs";
|
|
2
|
+
export { Messages, type MessageListResponse, type MessageStreamResponse, type MessageCreateParams, type MessageListParams, type MessageStreamParams, } from "./messages.mjs";
|
|
3
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/resources/conversations/index.ts"],"names":[],"mappings":"OAEO,EACL,aAAa,EACb,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,GAC5B;OACM,EACL,QAAQ,EACR,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,GACzB"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { Conversations, type Conversation, type CreateConversation, type ConversationListResponse, type ConversationCreateParams, type ConversationListParams, } from "./conversations.js";
|
|
2
|
+
export { Messages, type MessageListResponse, type MessageStreamResponse, type MessageCreateParams, type MessageListParams, type MessageStreamParams, } from "./messages.js";
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/conversations/index.ts"],"names":[],"mappings":"OAEO,EACL,aAAa,EACb,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,GAC5B;OACM,EACL,QAAQ,EACR,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,GACzB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Messages = exports.Conversations = void 0;
|
|
5
|
+
var conversations_1 = require("./conversations.js");
|
|
6
|
+
Object.defineProperty(exports, "Conversations", { enumerable: true, get: function () { return conversations_1.Conversations; } });
|
|
7
|
+
var messages_1 = require("./messages.js");
|
|
8
|
+
Object.defineProperty(exports, "Messages", { enumerable: true, get: function () { return messages_1.Messages; } });
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/conversations/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,oDAOyB;AANvB,8GAAA,aAAa,OAAA;AAOf,0CAOoB;AANlB,oGAAA,QAAQ,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/resources/conversations/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EACL,aAAa,GAMd;OACM,EACL,QAAQ,GAMT"}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { APIResource } from "../../core/resource.mjs";
|
|
2
|
+
import * as AgentsAPI from "../agents/agents.mjs";
|
|
3
|
+
import * as MessagesAPI from "../agents/messages.mjs";
|
|
4
|
+
import { APIPromise } from "../../core/api-promise.mjs";
|
|
5
|
+
import { Stream } from "../../core/streaming.mjs";
|
|
6
|
+
import { RequestOptions } from "../../internal/request-options.mjs";
|
|
7
|
+
export declare class Messages extends APIResource {
|
|
8
|
+
/**
|
|
9
|
+
* Send a message to a conversation and get a streaming response.
|
|
10
|
+
*
|
|
11
|
+
* This endpoint sends a message to an existing conversation and streams the
|
|
12
|
+
* agent's response back.
|
|
13
|
+
*/
|
|
14
|
+
create(conversationID: string, body: MessageCreateParams, options?: RequestOptions): APIPromise<Stream<MessagesAPI.LettaStreamingResponse>>;
|
|
15
|
+
/**
|
|
16
|
+
* List all messages in a conversation.
|
|
17
|
+
*
|
|
18
|
+
* Returns LettaMessage objects (UserMessage, AssistantMessage, etc.) for all
|
|
19
|
+
* messages in the conversation, ordered by position (oldest first), with support
|
|
20
|
+
* for cursor-based pagination.
|
|
21
|
+
*/
|
|
22
|
+
list(conversationID: string, query?: MessageListParams | null | undefined, options?: RequestOptions): APIPromise<MessageListResponse>;
|
|
23
|
+
/**
|
|
24
|
+
* Resume the stream for the most recent active run in a conversation.
|
|
25
|
+
*
|
|
26
|
+
* This endpoint allows you to reconnect to an active background stream for a
|
|
27
|
+
* conversation, enabling recovery from network interruptions.
|
|
28
|
+
*/
|
|
29
|
+
stream(conversationID: string, body?: MessageStreamParams | undefined, options?: RequestOptions): APIPromise<Stream<MessagesAPI.LettaStreamingResponse>>;
|
|
30
|
+
}
|
|
31
|
+
export type MessageListResponse = Array<MessagesAPI.Message>;
|
|
32
|
+
export type MessageStreamResponse = unknown;
|
|
33
|
+
export interface MessageCreateParams {
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated The name of the message argument in the designated message tool.
|
|
36
|
+
* Still supported for legacy agent types, but deprecated for letta_v1_agent
|
|
37
|
+
* onward.
|
|
38
|
+
*/
|
|
39
|
+
assistant_message_tool_kwarg?: string;
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated The name of the designated message tool. Still supported for legacy
|
|
42
|
+
* agent types, but deprecated for letta_v1_agent onward.
|
|
43
|
+
*/
|
|
44
|
+
assistant_message_tool_name?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Whether to process the request in the background (only used when
|
|
47
|
+
* streaming=true).
|
|
48
|
+
*/
|
|
49
|
+
background?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Client-side tools that the agent can call. When the agent calls a client-side
|
|
52
|
+
* tool, execution pauses and returns control to the client to execute the tool and
|
|
53
|
+
* provide the result via a ToolReturn.
|
|
54
|
+
*/
|
|
55
|
+
client_tools?: Array<MessageCreateParams.ClientTool> | null;
|
|
56
|
+
/**
|
|
57
|
+
* @deprecated If set to True, enables reasoning before responses or tool calls
|
|
58
|
+
* from the agent.
|
|
59
|
+
*/
|
|
60
|
+
enable_thinking?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Whether to include periodic keepalive ping messages in the stream to prevent
|
|
63
|
+
* connection timeouts (only used when streaming=true).
|
|
64
|
+
*/
|
|
65
|
+
include_pings?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Only return specified message types in the response. If `None` (default) returns
|
|
68
|
+
* all messages.
|
|
69
|
+
*/
|
|
70
|
+
include_return_message_types?: Array<MessagesAPI.MessageType> | null;
|
|
71
|
+
/**
|
|
72
|
+
* Syntactic sugar for a single user message. Equivalent to messages=[{'role':
|
|
73
|
+
* 'user', 'content': input}].
|
|
74
|
+
*/
|
|
75
|
+
input?: string | Array<MessagesAPI.TextContent | MessagesAPI.ImageContent | MessagesAPI.ToolCallContent | MessagesAPI.ToolReturnContent | MessagesAPI.ReasoningContent | MessagesAPI.RedactedReasoningContent | MessagesAPI.OmittedReasoningContent | MessageCreateParams.SummarizedReasoningContent> | null;
|
|
76
|
+
/**
|
|
77
|
+
* Maximum number of steps the agent should take to process the request.
|
|
78
|
+
*/
|
|
79
|
+
max_steps?: number;
|
|
80
|
+
/**
|
|
81
|
+
* The messages to be sent to the agent.
|
|
82
|
+
*/
|
|
83
|
+
messages?: Array<AgentsAPI.MessageCreate | MessagesAPI.ApprovalCreate> | null;
|
|
84
|
+
/**
|
|
85
|
+
* Flag to determine if individual tokens should be streamed, rather than streaming
|
|
86
|
+
* per step (only used when streaming=true).
|
|
87
|
+
*/
|
|
88
|
+
stream_tokens?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* If True, returns a streaming response (Server-Sent Events). If False (default),
|
|
91
|
+
* returns a complete response.
|
|
92
|
+
*/
|
|
93
|
+
streaming?: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* @deprecated Whether the server should parse specific tool call arguments
|
|
96
|
+
* (default `send_message`) as `AssistantMessage` objects. Still supported for
|
|
97
|
+
* legacy agent types, but deprecated for letta_v1_agent onward.
|
|
98
|
+
*/
|
|
99
|
+
use_assistant_message?: boolean;
|
|
100
|
+
}
|
|
101
|
+
export declare namespace MessageCreateParams {
|
|
102
|
+
/**
|
|
103
|
+
* Schema for a client-side tool passed in the request.
|
|
104
|
+
*
|
|
105
|
+
* Client-side tools are executed by the client, not the server. When the agent
|
|
106
|
+
* calls a client-side tool, execution pauses and returns control to the client to
|
|
107
|
+
* execute the tool and provide the result.
|
|
108
|
+
*/
|
|
109
|
+
interface ClientTool {
|
|
110
|
+
/**
|
|
111
|
+
* The name of the tool function
|
|
112
|
+
*/
|
|
113
|
+
name: string;
|
|
114
|
+
/**
|
|
115
|
+
* Description of what the tool does
|
|
116
|
+
*/
|
|
117
|
+
description?: string | null;
|
|
118
|
+
/**
|
|
119
|
+
* JSON Schema for the function parameters
|
|
120
|
+
*/
|
|
121
|
+
parameters?: {
|
|
122
|
+
[key: string]: unknown;
|
|
123
|
+
} | null;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* The style of reasoning content returned by the OpenAI Responses API
|
|
127
|
+
*/
|
|
128
|
+
interface SummarizedReasoningContent {
|
|
129
|
+
/**
|
|
130
|
+
* The unique identifier for this reasoning step.
|
|
131
|
+
*/
|
|
132
|
+
id: string;
|
|
133
|
+
/**
|
|
134
|
+
* Summaries of the reasoning content.
|
|
135
|
+
*/
|
|
136
|
+
summary: Array<SummarizedReasoningContent.Summary>;
|
|
137
|
+
/**
|
|
138
|
+
* The encrypted reasoning content.
|
|
139
|
+
*/
|
|
140
|
+
encrypted_content?: string;
|
|
141
|
+
/**
|
|
142
|
+
* Indicates this is a summarized reasoning step.
|
|
143
|
+
*/
|
|
144
|
+
type?: 'summarized_reasoning';
|
|
145
|
+
}
|
|
146
|
+
namespace SummarizedReasoningContent {
|
|
147
|
+
interface Summary {
|
|
148
|
+
/**
|
|
149
|
+
* The index of the summary part.
|
|
150
|
+
*/
|
|
151
|
+
index: number;
|
|
152
|
+
/**
|
|
153
|
+
* The text of the summary part.
|
|
154
|
+
*/
|
|
155
|
+
text: string;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
export interface MessageListParams {
|
|
160
|
+
/**
|
|
161
|
+
* Message ID cursor for pagination. Returns messages that come after this message
|
|
162
|
+
* ID in the conversation
|
|
163
|
+
*/
|
|
164
|
+
after?: string | null;
|
|
165
|
+
/**
|
|
166
|
+
* Message ID cursor for pagination. Returns messages that come before this message
|
|
167
|
+
* ID in the conversation
|
|
168
|
+
*/
|
|
169
|
+
before?: string | null;
|
|
170
|
+
/**
|
|
171
|
+
* Maximum number of messages to return
|
|
172
|
+
*/
|
|
173
|
+
limit?: number | null;
|
|
174
|
+
}
|
|
175
|
+
export interface MessageStreamParams {
|
|
176
|
+
/**
|
|
177
|
+
* Number of entries to read per batch.
|
|
178
|
+
*/
|
|
179
|
+
batch_size?: number | null;
|
|
180
|
+
/**
|
|
181
|
+
* Whether to include periodic keepalive ping messages in the stream to prevent
|
|
182
|
+
* connection timeouts.
|
|
183
|
+
*/
|
|
184
|
+
include_pings?: boolean | null;
|
|
185
|
+
/**
|
|
186
|
+
* Seconds to wait between polls when no new data.
|
|
187
|
+
*/
|
|
188
|
+
poll_interval?: number | null;
|
|
189
|
+
/**
|
|
190
|
+
* Sequence id to use as a cursor for pagination. Response will start streaming
|
|
191
|
+
* after this chunk sequence id
|
|
192
|
+
*/
|
|
193
|
+
starting_after?: number;
|
|
194
|
+
}
|
|
195
|
+
export declare namespace Messages {
|
|
196
|
+
export { type MessageListResponse as MessageListResponse, type MessageStreamResponse as MessageStreamResponse, type MessageCreateParams as MessageCreateParams, type MessageListParams as MessageListParams, type MessageStreamParams as MessageStreamParams, };
|
|
197
|
+
}
|
|
198
|
+
//# sourceMappingURL=messages.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.mts","sourceRoot":"","sources":["../../src/resources/conversations/messages.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,SAAS;OACd,KAAK,WAAW;OAChB,EAAE,UAAU,EAAE;OACd,EAAE,MAAM,EAAE;OACV,EAAE,cAAc,EAAE;AAGzB,qBAAa,QAAS,SAAQ,WAAW;IACvC;;;;;OAKG;IACH,MAAM,CACJ,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,mBAAmB,EACzB,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,MAAM,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC;IAQzD;;;;;;OAMG;IACH,IAAI,CACF,cAAc,EAAE,MAAM,EACtB,KAAK,GAAE,iBAAiB,GAAG,IAAI,GAAG,SAAc,EAChD,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,mBAAmB,CAAC;IAIlC;;;;;OAKG;IACH,MAAM,CACJ,cAAc,EAAE,MAAM,EACtB,IAAI,GAAE,mBAAmB,GAAG,SAAc,EAC1C,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,MAAM,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC;CAO1D;AAED,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;AAE7D,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAAC;AAE5C,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,4BAA4B,CAAC,EAAE,MAAM,CAAC;IAEtC;;;OAGG;IACH,2BAA2B,CAAC,EAAE,MAAM,CAAC;IAErC;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;OAIG;IAC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AAC;QAEX;;WAEG;QACH,OAAO,EAAE,KAAK,CAAC,0BAA0B,CAAC,OAAO,CAAC,CAAC;QAEnD;;WAEG;QACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAE3B;;WAEG;QACH,IAAI,CAAC,EAAE,sBAAsB,CAAC;KAC/B;IAED,UAAiB,0BAA0B,CAAC;QAC1C,UAAiB,OAAO;YACtB;;eAEG;YACH,KAAK,EAAE,MAAM,CAAC;YAEd;;eAEG;YACH,IAAI,EAAE,MAAM,CAAC;SACd;KACF;CACF;AAED,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAEvB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE3B;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAE/B;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9B;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,OAAO,EACL,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,mBAAmB,IAAI,mBAAmB,GAChD,CAAC;CACH"}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { APIResource } from "../../core/resource.js";
|
|
2
|
+
import * as AgentsAPI from "../agents/agents.js";
|
|
3
|
+
import * as MessagesAPI from "../agents/messages.js";
|
|
4
|
+
import { APIPromise } from "../../core/api-promise.js";
|
|
5
|
+
import { Stream } from "../../core/streaming.js";
|
|
6
|
+
import { RequestOptions } from "../../internal/request-options.js";
|
|
7
|
+
export declare class Messages extends APIResource {
|
|
8
|
+
/**
|
|
9
|
+
* Send a message to a conversation and get a streaming response.
|
|
10
|
+
*
|
|
11
|
+
* This endpoint sends a message to an existing conversation and streams the
|
|
12
|
+
* agent's response back.
|
|
13
|
+
*/
|
|
14
|
+
create(conversationID: string, body: MessageCreateParams, options?: RequestOptions): APIPromise<Stream<MessagesAPI.LettaStreamingResponse>>;
|
|
15
|
+
/**
|
|
16
|
+
* List all messages in a conversation.
|
|
17
|
+
*
|
|
18
|
+
* Returns LettaMessage objects (UserMessage, AssistantMessage, etc.) for all
|
|
19
|
+
* messages in the conversation, ordered by position (oldest first), with support
|
|
20
|
+
* for cursor-based pagination.
|
|
21
|
+
*/
|
|
22
|
+
list(conversationID: string, query?: MessageListParams | null | undefined, options?: RequestOptions): APIPromise<MessageListResponse>;
|
|
23
|
+
/**
|
|
24
|
+
* Resume the stream for the most recent active run in a conversation.
|
|
25
|
+
*
|
|
26
|
+
* This endpoint allows you to reconnect to an active background stream for a
|
|
27
|
+
* conversation, enabling recovery from network interruptions.
|
|
28
|
+
*/
|
|
29
|
+
stream(conversationID: string, body?: MessageStreamParams | undefined, options?: RequestOptions): APIPromise<Stream<MessagesAPI.LettaStreamingResponse>>;
|
|
30
|
+
}
|
|
31
|
+
export type MessageListResponse = Array<MessagesAPI.Message>;
|
|
32
|
+
export type MessageStreamResponse = unknown;
|
|
33
|
+
export interface MessageCreateParams {
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated The name of the message argument in the designated message tool.
|
|
36
|
+
* Still supported for legacy agent types, but deprecated for letta_v1_agent
|
|
37
|
+
* onward.
|
|
38
|
+
*/
|
|
39
|
+
assistant_message_tool_kwarg?: string;
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated The name of the designated message tool. Still supported for legacy
|
|
42
|
+
* agent types, but deprecated for letta_v1_agent onward.
|
|
43
|
+
*/
|
|
44
|
+
assistant_message_tool_name?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Whether to process the request in the background (only used when
|
|
47
|
+
* streaming=true).
|
|
48
|
+
*/
|
|
49
|
+
background?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Client-side tools that the agent can call. When the agent calls a client-side
|
|
52
|
+
* tool, execution pauses and returns control to the client to execute the tool and
|
|
53
|
+
* provide the result via a ToolReturn.
|
|
54
|
+
*/
|
|
55
|
+
client_tools?: Array<MessageCreateParams.ClientTool> | null;
|
|
56
|
+
/**
|
|
57
|
+
* @deprecated If set to True, enables reasoning before responses or tool calls
|
|
58
|
+
* from the agent.
|
|
59
|
+
*/
|
|
60
|
+
enable_thinking?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Whether to include periodic keepalive ping messages in the stream to prevent
|
|
63
|
+
* connection timeouts (only used when streaming=true).
|
|
64
|
+
*/
|
|
65
|
+
include_pings?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Only return specified message types in the response. If `None` (default) returns
|
|
68
|
+
* all messages.
|
|
69
|
+
*/
|
|
70
|
+
include_return_message_types?: Array<MessagesAPI.MessageType> | null;
|
|
71
|
+
/**
|
|
72
|
+
* Syntactic sugar for a single user message. Equivalent to messages=[{'role':
|
|
73
|
+
* 'user', 'content': input}].
|
|
74
|
+
*/
|
|
75
|
+
input?: string | Array<MessagesAPI.TextContent | MessagesAPI.ImageContent | MessagesAPI.ToolCallContent | MessagesAPI.ToolReturnContent | MessagesAPI.ReasoningContent | MessagesAPI.RedactedReasoningContent | MessagesAPI.OmittedReasoningContent | MessageCreateParams.SummarizedReasoningContent> | null;
|
|
76
|
+
/**
|
|
77
|
+
* Maximum number of steps the agent should take to process the request.
|
|
78
|
+
*/
|
|
79
|
+
max_steps?: number;
|
|
80
|
+
/**
|
|
81
|
+
* The messages to be sent to the agent.
|
|
82
|
+
*/
|
|
83
|
+
messages?: Array<AgentsAPI.MessageCreate | MessagesAPI.ApprovalCreate> | null;
|
|
84
|
+
/**
|
|
85
|
+
* Flag to determine if individual tokens should be streamed, rather than streaming
|
|
86
|
+
* per step (only used when streaming=true).
|
|
87
|
+
*/
|
|
88
|
+
stream_tokens?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* If True, returns a streaming response (Server-Sent Events). If False (default),
|
|
91
|
+
* returns a complete response.
|
|
92
|
+
*/
|
|
93
|
+
streaming?: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* @deprecated Whether the server should parse specific tool call arguments
|
|
96
|
+
* (default `send_message`) as `AssistantMessage` objects. Still supported for
|
|
97
|
+
* legacy agent types, but deprecated for letta_v1_agent onward.
|
|
98
|
+
*/
|
|
99
|
+
use_assistant_message?: boolean;
|
|
100
|
+
}
|
|
101
|
+
export declare namespace MessageCreateParams {
|
|
102
|
+
/**
|
|
103
|
+
* Schema for a client-side tool passed in the request.
|
|
104
|
+
*
|
|
105
|
+
* Client-side tools are executed by the client, not the server. When the agent
|
|
106
|
+
* calls a client-side tool, execution pauses and returns control to the client to
|
|
107
|
+
* execute the tool and provide the result.
|
|
108
|
+
*/
|
|
109
|
+
interface ClientTool {
|
|
110
|
+
/**
|
|
111
|
+
* The name of the tool function
|
|
112
|
+
*/
|
|
113
|
+
name: string;
|
|
114
|
+
/**
|
|
115
|
+
* Description of what the tool does
|
|
116
|
+
*/
|
|
117
|
+
description?: string | null;
|
|
118
|
+
/**
|
|
119
|
+
* JSON Schema for the function parameters
|
|
120
|
+
*/
|
|
121
|
+
parameters?: {
|
|
122
|
+
[key: string]: unknown;
|
|
123
|
+
} | null;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* The style of reasoning content returned by the OpenAI Responses API
|
|
127
|
+
*/
|
|
128
|
+
interface SummarizedReasoningContent {
|
|
129
|
+
/**
|
|
130
|
+
* The unique identifier for this reasoning step.
|
|
131
|
+
*/
|
|
132
|
+
id: string;
|
|
133
|
+
/**
|
|
134
|
+
* Summaries of the reasoning content.
|
|
135
|
+
*/
|
|
136
|
+
summary: Array<SummarizedReasoningContent.Summary>;
|
|
137
|
+
/**
|
|
138
|
+
* The encrypted reasoning content.
|
|
139
|
+
*/
|
|
140
|
+
encrypted_content?: string;
|
|
141
|
+
/**
|
|
142
|
+
* Indicates this is a summarized reasoning step.
|
|
143
|
+
*/
|
|
144
|
+
type?: 'summarized_reasoning';
|
|
145
|
+
}
|
|
146
|
+
namespace SummarizedReasoningContent {
|
|
147
|
+
interface Summary {
|
|
148
|
+
/**
|
|
149
|
+
* The index of the summary part.
|
|
150
|
+
*/
|
|
151
|
+
index: number;
|
|
152
|
+
/**
|
|
153
|
+
* The text of the summary part.
|
|
154
|
+
*/
|
|
155
|
+
text: string;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
export interface MessageListParams {
|
|
160
|
+
/**
|
|
161
|
+
* Message ID cursor for pagination. Returns messages that come after this message
|
|
162
|
+
* ID in the conversation
|
|
163
|
+
*/
|
|
164
|
+
after?: string | null;
|
|
165
|
+
/**
|
|
166
|
+
* Message ID cursor for pagination. Returns messages that come before this message
|
|
167
|
+
* ID in the conversation
|
|
168
|
+
*/
|
|
169
|
+
before?: string | null;
|
|
170
|
+
/**
|
|
171
|
+
* Maximum number of messages to return
|
|
172
|
+
*/
|
|
173
|
+
limit?: number | null;
|
|
174
|
+
}
|
|
175
|
+
export interface MessageStreamParams {
|
|
176
|
+
/**
|
|
177
|
+
* Number of entries to read per batch.
|
|
178
|
+
*/
|
|
179
|
+
batch_size?: number | null;
|
|
180
|
+
/**
|
|
181
|
+
* Whether to include periodic keepalive ping messages in the stream to prevent
|
|
182
|
+
* connection timeouts.
|
|
183
|
+
*/
|
|
184
|
+
include_pings?: boolean | null;
|
|
185
|
+
/**
|
|
186
|
+
* Seconds to wait between polls when no new data.
|
|
187
|
+
*/
|
|
188
|
+
poll_interval?: number | null;
|
|
189
|
+
/**
|
|
190
|
+
* Sequence id to use as a cursor for pagination. Response will start streaming
|
|
191
|
+
* after this chunk sequence id
|
|
192
|
+
*/
|
|
193
|
+
starting_after?: number;
|
|
194
|
+
}
|
|
195
|
+
export declare namespace Messages {
|
|
196
|
+
export { type MessageListResponse as MessageListResponse, type MessageStreamResponse as MessageStreamResponse, type MessageCreateParams as MessageCreateParams, type MessageListParams as MessageListParams, type MessageStreamParams as MessageStreamParams, };
|
|
197
|
+
}
|
|
198
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/resources/conversations/messages.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,SAAS;OACd,KAAK,WAAW;OAChB,EAAE,UAAU,EAAE;OACd,EAAE,MAAM,EAAE;OACV,EAAE,cAAc,EAAE;AAGzB,qBAAa,QAAS,SAAQ,WAAW;IACvC;;;;;OAKG;IACH,MAAM,CACJ,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,mBAAmB,EACzB,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,MAAM,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC;IAQzD;;;;;;OAMG;IACH,IAAI,CACF,cAAc,EAAE,MAAM,EACtB,KAAK,GAAE,iBAAiB,GAAG,IAAI,GAAG,SAAc,EAChD,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,mBAAmB,CAAC;IAIlC;;;;;OAKG;IACH,MAAM,CACJ,cAAc,EAAE,MAAM,EACtB,IAAI,GAAE,mBAAmB,GAAG,SAAc,EAC1C,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,MAAM,CAAC,WAAW,CAAC,sBAAsB,CAAC,CAAC;CAO1D;AAED,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;AAE7D,MAAM,MAAM,qBAAqB,GAAG,OAAO,CAAC;AAE5C,MAAM,WAAW,mBAAmB;IA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CACH"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Messages = void 0;
|
|
5
|
+
const resource_1 = require("../../core/resource.js");
|
|
6
|
+
const path_1 = require("../../internal/utils/path.js");
|
|
7
|
+
class Messages extends resource_1.APIResource {
|
|
8
|
+
/**
|
|
9
|
+
* Send a message to a conversation and get a streaming response.
|
|
10
|
+
*
|
|
11
|
+
* This endpoint sends a message to an existing conversation and streams the
|
|
12
|
+
* agent's response back.
|
|
13
|
+
*/
|
|
14
|
+
create(conversationID, body, options) {
|
|
15
|
+
return this._client.post((0, path_1.path) `/v1/conversations/${conversationID}/messages`, {
|
|
16
|
+
body,
|
|
17
|
+
...options,
|
|
18
|
+
stream: true,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* List all messages in a conversation.
|
|
23
|
+
*
|
|
24
|
+
* Returns LettaMessage objects (UserMessage, AssistantMessage, etc.) for all
|
|
25
|
+
* messages in the conversation, ordered by position (oldest first), with support
|
|
26
|
+
* for cursor-based pagination.
|
|
27
|
+
*/
|
|
28
|
+
list(conversationID, query = {}, options) {
|
|
29
|
+
return this._client.get((0, path_1.path) `/v1/conversations/${conversationID}/messages`, { query, ...options });
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Resume the stream for the most recent active run in a conversation.
|
|
33
|
+
*
|
|
34
|
+
* This endpoint allows you to reconnect to an active background stream for a
|
|
35
|
+
* conversation, enabling recovery from network interruptions.
|
|
36
|
+
*/
|
|
37
|
+
stream(conversationID, body = {}, options) {
|
|
38
|
+
return this._client.post((0, path_1.path) `/v1/conversations/${conversationID}/stream`, {
|
|
39
|
+
body,
|
|
40
|
+
...options,
|
|
41
|
+
stream: true,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.Messages = Messages;
|
|
46
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/resources/conversations/messages.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAMlD,uDAAiD;AAEjD,MAAa,QAAS,SAAQ,sBAAW;IACvC;;;;;OAKG;IACH,MAAM,CACJ,cAAsB,EACtB,IAAyB,EACzB,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,qBAAqB,cAAc,WAAW,EAAE;YAC3E,IAAI;YACJ,GAAG,OAAO;YACV,MAAM,EAAE,IAAI;SACb,CAA2D,CAAC;IAC/D,CAAC;IAED;;;;;;OAMG;IACH,IAAI,CACF,cAAsB,EACtB,QAA8C,EAAE,EAChD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,qBAAqB,cAAc,WAAW,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACrG,CAAC;IAED;;;;;OAKG;IACH,MAAM,CACJ,cAAsB,EACtB,OAAwC,EAAE,EAC1C,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,qBAAqB,cAAc,SAAS,EAAE;YACzE,IAAI;YACJ,GAAG,OAAO;YACV,MAAM,EAAE,IAAI;SACb,CAA2D,CAAC;IAC/D,CAAC;CACF;AAnDD,4BAmDC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../../core/resource.mjs";
|
|
3
|
+
import { path } from "../../internal/utils/path.mjs";
|
|
4
|
+
export class Messages extends APIResource {
|
|
5
|
+
/**
|
|
6
|
+
* Send a message to a conversation and get a streaming response.
|
|
7
|
+
*
|
|
8
|
+
* This endpoint sends a message to an existing conversation and streams the
|
|
9
|
+
* agent's response back.
|
|
10
|
+
*/
|
|
11
|
+
create(conversationID, body, options) {
|
|
12
|
+
return this._client.post(path `/v1/conversations/${conversationID}/messages`, {
|
|
13
|
+
body,
|
|
14
|
+
...options,
|
|
15
|
+
stream: true,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* List all messages in a conversation.
|
|
20
|
+
*
|
|
21
|
+
* Returns LettaMessage objects (UserMessage, AssistantMessage, etc.) for all
|
|
22
|
+
* messages in the conversation, ordered by position (oldest first), with support
|
|
23
|
+
* for cursor-based pagination.
|
|
24
|
+
*/
|
|
25
|
+
list(conversationID, query = {}, options) {
|
|
26
|
+
return this._client.get(path `/v1/conversations/${conversationID}/messages`, { query, ...options });
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Resume the stream for the most recent active run in a conversation.
|
|
30
|
+
*
|
|
31
|
+
* This endpoint allows you to reconnect to an active background stream for a
|
|
32
|
+
* conversation, enabling recovery from network interruptions.
|
|
33
|
+
*/
|
|
34
|
+
stream(conversationID, body = {}, options) {
|
|
35
|
+
return this._client.post(path `/v1/conversations/${conversationID}/stream`, {
|
|
36
|
+
body,
|
|
37
|
+
...options,
|
|
38
|
+
stream: true,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=messages.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.mjs","sourceRoot":"","sources":["../../src/resources/conversations/messages.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAMf,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,QAAS,SAAQ,WAAW;IACvC;;;;;OAKG;IACH,MAAM,CACJ,cAAsB,EACtB,IAAyB,EACzB,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,qBAAqB,cAAc,WAAW,EAAE;YAC3E,IAAI;YACJ,GAAG,OAAO;YACV,MAAM,EAAE,IAAI;SACb,CAA2D,CAAC;IAC/D,CAAC;IAED;;;;;;OAMG;IACH,IAAI,CACF,cAAsB,EACtB,QAA8C,EAAE,EAChD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,qBAAqB,cAAc,WAAW,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACrG,CAAC;IAED;;;;;OAKG;IACH,MAAM,CACJ,cAAsB,EACtB,OAAwC,EAAE,EAC1C,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,qBAAqB,cAAc,SAAS,EAAE;YACzE,IAAI;YACJ,GAAG,OAAO;YACV,MAAM,EAAE,IAAI;SACb,CAA2D,CAAC;IAC/D,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversations.d.mts","sourceRoot":"","sources":["../src/resources/conversations.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversations.d.ts","sourceRoot":"","sources":["../src/resources/conversations.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const tslib_1 = require("../internal/tslib.js");
|
|
5
|
+
tslib_1.__exportStar(require("./conversations/index.js"), exports);
|
|
6
|
+
//# sourceMappingURL=conversations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversations.js","sourceRoot":"","sources":["../src/resources/conversations.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,mEAAsC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversations.mjs","sourceRoot":"","sources":["../src/resources/conversations.ts"],"names":[],"mappings":"AAAA,sFAAsF"}
|
package/resources/index.d.mts
CHANGED
|
@@ -3,6 +3,7 @@ export { Agents, type AgentEnvironmentVariable, type AgentState, type AgentType,
|
|
|
3
3
|
export { Archives, type Archive, type VectorDBProvider, type ArchiveCreateParams, type ArchiveUpdateParams, type ArchiveListParams, type ArchivesArrayPage, } from "./archives/archives.mjs";
|
|
4
4
|
export { Batches, type BatchJob, type BatchCancelResponse, type BatchCreateParams, type BatchListParams, type BatchJobsArrayPage, } from "./batches/batches.mjs";
|
|
5
5
|
export { Blocks, type BlockResponse, type CreateBlock, type BlockDeleteResponse, type BlockCreateParams, type BlockUpdateParams, type BlockListParams, type BlockResponsesArrayPage, } from "./blocks/blocks.mjs";
|
|
6
|
+
export { Conversations, type Conversation, type CreateConversation, type ConversationListResponse, type ConversationCreateParams, type ConversationListParams, } from "./conversations/conversations.mjs";
|
|
6
7
|
export { Folders, type Folder, type FolderDeleteResponse, type FolderCreateParams, type FolderUpdateParams, type FolderListParams, type FoldersArrayPage, } from "./folders/folders.mjs";
|
|
7
8
|
export { Groups, type DynamicManager, type Group, type ManagerType, type RoundRobinManager, type SleeptimeManager, type SupervisorManager, type VoiceSleeptimeManager, type GroupDeleteResponse, type GroupCreateParams, type GroupUpdateParams, type GroupListParams, type GroupsArrayPage, } from "./groups/groups.mjs";
|
|
8
9
|
export { Identities, type Identity, type IdentityProperty, type IdentityType, type IdentityDeleteResponse, type IdentityCreateParams, type IdentityUpdateParams, type IdentityListParams, type IdentityUpsertParams, type IdentitiesArrayPage, } from "./identities/identities.mjs";
|