@letta-ai/letta-client 0.1.170 → 0.1.172
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 +16 -3
- package/api/errors/BadRequestError.d.ts +2 -1
- package/api/errors/BadRequestError.js +2 -1
- package/api/errors/ConflictError.d.ts +2 -1
- package/api/errors/ConflictError.js +2 -1
- package/api/errors/InternalServerError.d.ts +2 -1
- package/api/errors/InternalServerError.js +2 -1
- package/api/errors/NotFoundError.d.ts +2 -1
- package/api/errors/NotFoundError.js +2 -1
- package/api/errors/PaymentRequiredError.d.ts +2 -1
- package/api/errors/PaymentRequiredError.js +2 -1
- package/api/errors/UnprocessableEntityError.d.ts +2 -1
- package/api/errors/UnprocessableEntityError.js +2 -1
- package/api/resources/agents/client/Client.d.ts +20 -10
- package/api/resources/agents/client/Client.js +166 -82
- package/api/resources/agents/resources/blocks/client/Client.d.ts +10 -5
- package/api/resources/agents/resources/blocks/client/Client.js +90 -45
- package/api/resources/agents/resources/context/client/Client.d.ts +2 -1
- package/api/resources/agents/resources/context/client/Client.js +18 -9
- package/api/resources/agents/resources/coreMemory/client/Client.d.ts +2 -1
- package/api/resources/agents/resources/coreMemory/client/Client.js +18 -9
- package/api/resources/agents/resources/files/client/Client.d.ts +6 -3
- package/api/resources/agents/resources/files/client/Client.js +45 -21
- package/api/resources/agents/resources/folders/client/Client.d.ts +6 -3
- package/api/resources/agents/resources/folders/client/Client.js +54 -27
- package/api/resources/agents/resources/groups/client/Client.d.ts +2 -1
- package/api/resources/agents/resources/groups/client/Client.js +19 -10
- package/api/resources/agents/resources/memoryVariables/client/Client.d.ts +2 -1
- package/api/resources/agents/resources/memoryVariables/client/Client.js +18 -9
- package/api/resources/agents/resources/messages/client/Client.d.ts +16 -8
- package/api/resources/agents/resources/messages/client/Client.js +155 -83
- package/api/resources/agents/resources/passages/client/Client.d.ts +8 -4
- package/api/resources/agents/resources/passages/client/Client.js +64 -31
- package/api/resources/agents/resources/sources/client/Client.d.ts +6 -3
- package/api/resources/agents/resources/sources/client/Client.js +54 -27
- package/api/resources/agents/resources/templates/client/Client.d.ts +6 -3
- package/api/resources/agents/resources/templates/client/Client.js +54 -27
- package/api/resources/agents/resources/tools/client/Client.d.ts +6 -3
- package/api/resources/agents/resources/tools/client/Client.js +54 -27
- package/api/resources/batches/client/Client.d.ts +8 -4
- package/api/resources/batches/client/Client.js +63 -30
- package/api/resources/blocks/client/Client.d.ts +12 -6
- package/api/resources/blocks/client/Client.js +100 -49
- package/api/resources/blocks/resources/agents/client/Client.d.ts +2 -1
- package/api/resources/blocks/resources/agents/client/Client.js +19 -10
- package/api/resources/clientSideAccessTokens/client/Client.d.ts +6 -3
- package/api/resources/clientSideAccessTokens/client/Client.js +46 -22
- package/api/resources/embeddingModels/client/Client.d.ts +2 -1
- package/api/resources/embeddingModels/client/Client.js +18 -9
- package/api/resources/folders/client/Client.d.ts +18 -9
- package/api/resources/folders/client/Client.js +154 -76
- package/api/resources/folders/resources/files/client/Client.d.ts +6 -3
- package/api/resources/folders/resources/files/client/Client.js +48 -24
- package/api/resources/folders/resources/passages/client/Client.d.ts +2 -1
- package/api/resources/folders/resources/passages/client/Client.js +19 -10
- package/api/resources/groups/client/Client.d.ts +12 -6
- package/api/resources/groups/client/Client.js +105 -52
- package/api/resources/groups/resources/messages/client/Client.d.ts +10 -5
- package/api/resources/groups/resources/messages/client/Client.js +91 -49
- package/api/resources/health/client/Client.d.ts +2 -1
- package/api/resources/health/client/Client.js +17 -8
- package/api/resources/identities/client/Client.d.ts +14 -7
- package/api/resources/identities/client/Client.js +123 -61
- package/api/resources/identities/resources/properties/client/Client.d.ts +2 -1
- package/api/resources/identities/resources/properties/client/Client.js +9 -3
- package/api/resources/jobs/client/Client.d.ts +10 -5
- package/api/resources/jobs/client/Client.js +92 -47
- package/api/resources/messages/client/Client.d.ts +2 -1
- package/api/resources/messages/client/Client.js +19 -10
- package/api/resources/models/client/Client.d.ts +2 -1
- package/api/resources/models/client/Client.js +27 -14
- package/api/resources/projects/client/Client.d.ts +2 -1
- package/api/resources/projects/client/Client.js +18 -9
- package/api/resources/providers/client/Client.d.ts +10 -5
- package/api/resources/providers/client/Client.js +77 -36
- package/api/resources/runs/client/Client.d.ts +8 -4
- package/api/resources/runs/client/Client.js +74 -38
- package/api/resources/runs/resources/messages/client/Client.d.ts +2 -1
- package/api/resources/runs/resources/messages/client/Client.js +21 -12
- package/api/resources/runs/resources/steps/client/Client.d.ts +2 -1
- package/api/resources/runs/resources/steps/client/Client.js +19 -10
- package/api/resources/runs/resources/usage/client/Client.d.ts +2 -1
- package/api/resources/runs/resources/usage/client/Client.js +18 -9
- package/api/resources/sources/client/Client.d.ts +20 -10
- package/api/resources/sources/client/Client.js +173 -86
- package/api/resources/sources/resources/files/client/Client.d.ts +6 -3
- package/api/resources/sources/resources/files/client/Client.js +48 -24
- package/api/resources/sources/resources/passages/client/Client.d.ts +2 -1
- package/api/resources/sources/resources/passages/client/Client.js +19 -10
- package/api/resources/steps/client/Client.d.ts +4 -2
- package/api/resources/steps/client/Client.js +41 -21
- package/api/resources/steps/resources/feedback/client/Client.d.ts +2 -1
- package/api/resources/steps/resources/feedback/client/Client.js +23 -12
- package/api/resources/tags/client/Client.d.ts +2 -1
- package/api/resources/tags/client/Client.js +19 -10
- package/api/resources/telemetry/client/Client.d.ts +2 -1
- package/api/resources/telemetry/client/Client.js +18 -9
- package/api/resources/templates/client/Client.d.ts +2 -1
- package/api/resources/templates/client/Client.js +18 -9
- package/api/resources/templates/resources/agents/client/Client.d.ts +2 -1
- package/api/resources/templates/resources/agents/client/Client.js +19 -10
- package/api/resources/tools/client/Client.d.ts +40 -20
- package/api/resources/tools/client/Client.js +356 -182
- package/api/resources/voice/client/Client.d.ts +2 -1
- package/api/resources/voice/client/Client.js +9 -3
- package/api/types/LettaStreamingRequest.d.ts +2 -0
- package/core/fetcher/APIResponse.d.ts +10 -0
- package/core/fetcher/Fetcher.d.ts +1 -1
- package/core/fetcher/Fetcher.js +11 -3
- package/core/fetcher/Headers.d.ts +2 -0
- package/core/fetcher/Headers.js +84 -0
- package/core/fetcher/HttpResponsePromise.d.ts +58 -0
- package/core/fetcher/HttpResponsePromise.js +103 -0
- package/core/fetcher/RawResponse.d.ts +29 -0
- package/core/fetcher/RawResponse.js +44 -0
- package/core/fetcher/createRequestUrl.d.ts +1 -1
- package/core/fetcher/getRequestBody.js +2 -1
- package/core/fetcher/index.d.ts +3 -0
- package/core/fetcher/index.js +7 -1
- package/core/fetcher/requestWithRetries.js +1 -1
- package/core/form-data-utils/FormDataWrapper.d.ts +3 -0
- package/core/form-data-utils/FormDataWrapper.js +53 -10
- package/core/form-data-utils/encodeAsFormParameter.d.ts +4 -0
- package/core/form-data-utils/encodeAsFormParameter.js +18 -0
- package/core/form-data-utils/index.d.ts +1 -0
- package/core/form-data-utils/index.js +3 -0
- package/core/json.d.ts +15 -0
- package/core/json.js +24 -0
- package/core/schemas/Schema.d.ts +2 -0
- package/core/schemas/Schema.js +2 -0
- package/core/schemas/builders/bigint/bigint.d.ts +1 -1
- package/core/schemas/builders/bigint/bigint.js +21 -17
- package/core/schemas/builders/object/object.js +1 -0
- package/core/schemas/builders/record/record.js +1 -2
- package/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +4 -0
- package/core/schemas/builders/schema-utils/getSchemaUtils.js +64 -0
- package/core/schemas/utils/addQuestionMarksToNullableProperties.d.ts +1 -1
- package/dist/api/errors/BadRequestError.d.ts +2 -1
- package/dist/api/errors/BadRequestError.js +2 -1
- package/dist/api/errors/ConflictError.d.ts +2 -1
- package/dist/api/errors/ConflictError.js +2 -1
- package/dist/api/errors/InternalServerError.d.ts +2 -1
- package/dist/api/errors/InternalServerError.js +2 -1
- package/dist/api/errors/NotFoundError.d.ts +2 -1
- package/dist/api/errors/NotFoundError.js +2 -1
- package/dist/api/errors/PaymentRequiredError.d.ts +2 -1
- package/dist/api/errors/PaymentRequiredError.js +2 -1
- package/dist/api/errors/UnprocessableEntityError.d.ts +2 -1
- package/dist/api/errors/UnprocessableEntityError.js +2 -1
- package/dist/api/resources/agents/client/Client.d.ts +20 -10
- package/dist/api/resources/agents/client/Client.js +166 -82
- package/dist/api/resources/agents/resources/blocks/client/Client.d.ts +10 -5
- package/dist/api/resources/agents/resources/blocks/client/Client.js +90 -45
- package/dist/api/resources/agents/resources/context/client/Client.d.ts +2 -1
- package/dist/api/resources/agents/resources/context/client/Client.js +18 -9
- package/dist/api/resources/agents/resources/coreMemory/client/Client.d.ts +2 -1
- package/dist/api/resources/agents/resources/coreMemory/client/Client.js +18 -9
- package/dist/api/resources/agents/resources/files/client/Client.d.ts +6 -3
- package/dist/api/resources/agents/resources/files/client/Client.js +45 -21
- package/dist/api/resources/agents/resources/folders/client/Client.d.ts +6 -3
- package/dist/api/resources/agents/resources/folders/client/Client.js +54 -27
- package/dist/api/resources/agents/resources/groups/client/Client.d.ts +2 -1
- package/dist/api/resources/agents/resources/groups/client/Client.js +19 -10
- package/dist/api/resources/agents/resources/memoryVariables/client/Client.d.ts +2 -1
- package/dist/api/resources/agents/resources/memoryVariables/client/Client.js +18 -9
- package/dist/api/resources/agents/resources/messages/client/Client.d.ts +16 -8
- package/dist/api/resources/agents/resources/messages/client/Client.js +155 -83
- package/dist/api/resources/agents/resources/passages/client/Client.d.ts +8 -4
- package/dist/api/resources/agents/resources/passages/client/Client.js +64 -31
- package/dist/api/resources/agents/resources/sources/client/Client.d.ts +6 -3
- package/dist/api/resources/agents/resources/sources/client/Client.js +54 -27
- package/dist/api/resources/agents/resources/templates/client/Client.d.ts +6 -3
- package/dist/api/resources/agents/resources/templates/client/Client.js +54 -27
- package/dist/api/resources/agents/resources/tools/client/Client.d.ts +6 -3
- package/dist/api/resources/agents/resources/tools/client/Client.js +54 -27
- package/dist/api/resources/batches/client/Client.d.ts +8 -4
- package/dist/api/resources/batches/client/Client.js +63 -30
- package/dist/api/resources/blocks/client/Client.d.ts +12 -6
- package/dist/api/resources/blocks/client/Client.js +100 -49
- package/dist/api/resources/blocks/resources/agents/client/Client.d.ts +2 -1
- package/dist/api/resources/blocks/resources/agents/client/Client.js +19 -10
- package/dist/api/resources/clientSideAccessTokens/client/Client.d.ts +6 -3
- package/dist/api/resources/clientSideAccessTokens/client/Client.js +46 -22
- package/dist/api/resources/embeddingModels/client/Client.d.ts +2 -1
- package/dist/api/resources/embeddingModels/client/Client.js +18 -9
- package/dist/api/resources/folders/client/Client.d.ts +18 -9
- package/dist/api/resources/folders/client/Client.js +154 -76
- package/dist/api/resources/folders/resources/files/client/Client.d.ts +6 -3
- package/dist/api/resources/folders/resources/files/client/Client.js +48 -24
- package/dist/api/resources/folders/resources/passages/client/Client.d.ts +2 -1
- package/dist/api/resources/folders/resources/passages/client/Client.js +19 -10
- package/dist/api/resources/groups/client/Client.d.ts +12 -6
- package/dist/api/resources/groups/client/Client.js +105 -52
- package/dist/api/resources/groups/resources/messages/client/Client.d.ts +10 -5
- package/dist/api/resources/groups/resources/messages/client/Client.js +91 -49
- package/dist/api/resources/health/client/Client.d.ts +2 -1
- package/dist/api/resources/health/client/Client.js +17 -8
- package/dist/api/resources/identities/client/Client.d.ts +14 -7
- package/dist/api/resources/identities/client/Client.js +123 -61
- package/dist/api/resources/identities/resources/properties/client/Client.d.ts +2 -1
- package/dist/api/resources/identities/resources/properties/client/Client.js +9 -3
- package/dist/api/resources/jobs/client/Client.d.ts +10 -5
- package/dist/api/resources/jobs/client/Client.js +92 -47
- package/dist/api/resources/messages/client/Client.d.ts +2 -1
- package/dist/api/resources/messages/client/Client.js +19 -10
- package/dist/api/resources/models/client/Client.d.ts +2 -1
- package/dist/api/resources/models/client/Client.js +27 -14
- package/dist/api/resources/projects/client/Client.d.ts +2 -1
- package/dist/api/resources/projects/client/Client.js +18 -9
- package/dist/api/resources/providers/client/Client.d.ts +10 -5
- package/dist/api/resources/providers/client/Client.js +77 -36
- package/dist/api/resources/runs/client/Client.d.ts +8 -4
- package/dist/api/resources/runs/client/Client.js +74 -38
- package/dist/api/resources/runs/resources/messages/client/Client.d.ts +2 -1
- package/dist/api/resources/runs/resources/messages/client/Client.js +21 -12
- package/dist/api/resources/runs/resources/steps/client/Client.d.ts +2 -1
- package/dist/api/resources/runs/resources/steps/client/Client.js +19 -10
- package/dist/api/resources/runs/resources/usage/client/Client.d.ts +2 -1
- package/dist/api/resources/runs/resources/usage/client/Client.js +18 -9
- package/dist/api/resources/sources/client/Client.d.ts +20 -10
- package/dist/api/resources/sources/client/Client.js +173 -86
- package/dist/api/resources/sources/resources/files/client/Client.d.ts +6 -3
- package/dist/api/resources/sources/resources/files/client/Client.js +48 -24
- package/dist/api/resources/sources/resources/passages/client/Client.d.ts +2 -1
- package/dist/api/resources/sources/resources/passages/client/Client.js +19 -10
- package/dist/api/resources/steps/client/Client.d.ts +4 -2
- package/dist/api/resources/steps/client/Client.js +41 -21
- package/dist/api/resources/steps/resources/feedback/client/Client.d.ts +2 -1
- package/dist/api/resources/steps/resources/feedback/client/Client.js +23 -12
- package/dist/api/resources/tags/client/Client.d.ts +2 -1
- package/dist/api/resources/tags/client/Client.js +19 -10
- package/dist/api/resources/telemetry/client/Client.d.ts +2 -1
- package/dist/api/resources/telemetry/client/Client.js +18 -9
- package/dist/api/resources/templates/client/Client.d.ts +2 -1
- package/dist/api/resources/templates/client/Client.js +18 -9
- package/dist/api/resources/templates/resources/agents/client/Client.d.ts +2 -1
- package/dist/api/resources/templates/resources/agents/client/Client.js +19 -10
- package/dist/api/resources/tools/client/Client.d.ts +40 -20
- package/dist/api/resources/tools/client/Client.js +356 -182
- package/dist/api/resources/voice/client/Client.d.ts +2 -1
- package/dist/api/resources/voice/client/Client.js +9 -3
- package/dist/api/types/LettaStreamingRequest.d.ts +2 -0
- package/dist/core/fetcher/APIResponse.d.ts +10 -0
- package/dist/core/fetcher/Fetcher.d.ts +1 -1
- package/dist/core/fetcher/Fetcher.js +11 -3
- package/dist/core/fetcher/Headers.d.ts +2 -0
- package/dist/core/fetcher/Headers.js +84 -0
- package/dist/core/fetcher/HttpResponsePromise.d.ts +58 -0
- package/dist/core/fetcher/HttpResponsePromise.js +103 -0
- package/dist/core/fetcher/RawResponse.d.ts +29 -0
- package/dist/core/fetcher/RawResponse.js +44 -0
- package/dist/core/fetcher/createRequestUrl.d.ts +1 -1
- package/dist/core/fetcher/getRequestBody.js +2 -1
- package/dist/core/fetcher/index.d.ts +3 -0
- package/dist/core/fetcher/index.js +7 -1
- package/dist/core/fetcher/requestWithRetries.js +1 -1
- package/dist/core/form-data-utils/FormDataWrapper.d.ts +3 -0
- package/dist/core/form-data-utils/FormDataWrapper.js +53 -10
- package/dist/core/form-data-utils/encodeAsFormParameter.d.ts +4 -0
- package/dist/core/form-data-utils/encodeAsFormParameter.js +18 -0
- package/dist/core/form-data-utils/index.d.ts +1 -0
- package/dist/core/form-data-utils/index.js +3 -0
- package/dist/core/json.d.ts +15 -0
- package/dist/core/json.js +24 -0
- package/dist/core/schemas/Schema.d.ts +2 -0
- package/dist/core/schemas/Schema.js +2 -0
- package/dist/core/schemas/builders/bigint/bigint.d.ts +1 -1
- package/dist/core/schemas/builders/bigint/bigint.js +21 -17
- package/dist/core/schemas/builders/object/object.js +1 -0
- package/dist/core/schemas/builders/record/record.js +1 -2
- package/dist/core/schemas/builders/schema-utils/getSchemaUtils.d.ts +4 -0
- package/dist/core/schemas/builders/schema-utils/getSchemaUtils.js +64 -0
- package/dist/core/schemas/utils/addQuestionMarksToNullableProperties.d.ts +1 -1
- package/dist/errors/LettaError.d.ts +4 -1
- package/dist/errors/LettaError.js +6 -8
- package/dist/serialization/types/LettaStreamingRequest.d.ts +1 -0
- package/dist/serialization/types/LettaStreamingRequest.js +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/errors/LettaError.d.ts +4 -1
- package/errors/LettaError.js +6 -8
- package/package.json +4 -4
- package/serialization/types/LettaStreamingRequest.d.ts +1 -0
- package/serialization/types/LettaStreamingRequest.js +1 -0
- package/version.d.ts +1 -1
- package/version.js +1 -1
|
@@ -71,7 +71,10 @@ class Messages {
|
|
|
71
71
|
* @example
|
|
72
72
|
* await client.agents.messages.list("agent_id")
|
|
73
73
|
*/
|
|
74
|
-
list(
|
|
74
|
+
list(agentId, request = {}, requestOptions) {
|
|
75
|
+
return core.HttpResponsePromise.fromPromise(this.__list(agentId, request, requestOptions));
|
|
76
|
+
}
|
|
77
|
+
__list(agentId_1) {
|
|
75
78
|
return __awaiter(this, arguments, void 0, function* (agentId, request = {}, requestOptions) {
|
|
76
79
|
var _a, _b, _c;
|
|
77
80
|
const { after, before, limit, groupId, useAssistantMessage, assistantMessageToolName, assistantMessageToolKwarg, includeErr, } = request;
|
|
@@ -105,7 +108,7 @@ class Messages {
|
|
|
105
108
|
method: "GET",
|
|
106
109
|
headers: Object.assign(Object.assign({ "X-Project": (yield core.Supplier.get(this._options.project)) != null
|
|
107
110
|
? yield core.Supplier.get(this._options.project)
|
|
108
|
-
: undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.
|
|
111
|
+
: undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.172", "User-Agent": "@letta-ai/letta-client/0.1.172", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
109
112
|
contentType: "application/json",
|
|
110
113
|
queryParameters: _queryParams,
|
|
111
114
|
requestType: "json",
|
|
@@ -114,13 +117,16 @@ class Messages {
|
|
|
114
117
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
115
118
|
});
|
|
116
119
|
if (_response.ok) {
|
|
117
|
-
return
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
120
|
+
return {
|
|
121
|
+
data: serializers.agents.messages.list.Response.parseOrThrow(_response.body, {
|
|
122
|
+
unrecognizedObjectKeys: "passthrough",
|
|
123
|
+
allowUnrecognizedUnionMembers: true,
|
|
124
|
+
allowUnrecognizedEnumValues: true,
|
|
125
|
+
skipValidation: true,
|
|
126
|
+
breadcrumbsPrefix: ["response"],
|
|
127
|
+
}),
|
|
128
|
+
rawResponse: _response.rawResponse,
|
|
129
|
+
};
|
|
124
130
|
}
|
|
125
131
|
if (_response.error.reason === "status-code") {
|
|
126
132
|
switch (_response.error.statusCode) {
|
|
@@ -131,11 +137,12 @@ class Messages {
|
|
|
131
137
|
allowUnrecognizedEnumValues: true,
|
|
132
138
|
skipValidation: true,
|
|
133
139
|
breadcrumbsPrefix: ["response"],
|
|
134
|
-
}));
|
|
140
|
+
}), _response.rawResponse);
|
|
135
141
|
default:
|
|
136
142
|
throw new errors.LettaError({
|
|
137
143
|
statusCode: _response.error.statusCode,
|
|
138
144
|
body: _response.error.body,
|
|
145
|
+
rawResponse: _response.rawResponse,
|
|
139
146
|
});
|
|
140
147
|
}
|
|
141
148
|
}
|
|
@@ -144,12 +151,14 @@ class Messages {
|
|
|
144
151
|
throw new errors.LettaError({
|
|
145
152
|
statusCode: _response.error.statusCode,
|
|
146
153
|
body: _response.error.rawBody,
|
|
154
|
+
rawResponse: _response.rawResponse,
|
|
147
155
|
});
|
|
148
156
|
case "timeout":
|
|
149
157
|
throw new errors.LettaTimeoutError("Timeout exceeded when calling GET /v1/agents/{agent_id}/messages.");
|
|
150
158
|
case "unknown":
|
|
151
159
|
throw new errors.LettaError({
|
|
152
160
|
message: _response.error.errorMessage,
|
|
161
|
+
rawResponse: _response.rawResponse,
|
|
153
162
|
});
|
|
154
163
|
}
|
|
155
164
|
});
|
|
@@ -176,6 +185,9 @@ class Messages {
|
|
|
176
185
|
* })
|
|
177
186
|
*/
|
|
178
187
|
create(agentId, request, requestOptions) {
|
|
188
|
+
return core.HttpResponsePromise.fromPromise(this.__create(agentId, request, requestOptions));
|
|
189
|
+
}
|
|
190
|
+
__create(agentId, request, requestOptions) {
|
|
179
191
|
return __awaiter(this, void 0, void 0, function* () {
|
|
180
192
|
var _a, _b, _c;
|
|
181
193
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
@@ -183,7 +195,7 @@ class Messages {
|
|
|
183
195
|
method: "POST",
|
|
184
196
|
headers: Object.assign(Object.assign({ "X-Project": (yield core.Supplier.get(this._options.project)) != null
|
|
185
197
|
? yield core.Supplier.get(this._options.project)
|
|
186
|
-
: undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.
|
|
198
|
+
: undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.172", "User-Agent": "@letta-ai/letta-client/0.1.172", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
187
199
|
contentType: "application/json",
|
|
188
200
|
requestType: "json",
|
|
189
201
|
body: serializers.LettaRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -192,13 +204,16 @@ class Messages {
|
|
|
192
204
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
193
205
|
});
|
|
194
206
|
if (_response.ok) {
|
|
195
|
-
return
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
207
|
+
return {
|
|
208
|
+
data: serializers.LettaResponse.parseOrThrow(_response.body, {
|
|
209
|
+
unrecognizedObjectKeys: "passthrough",
|
|
210
|
+
allowUnrecognizedUnionMembers: true,
|
|
211
|
+
allowUnrecognizedEnumValues: true,
|
|
212
|
+
skipValidation: true,
|
|
213
|
+
breadcrumbsPrefix: ["response"],
|
|
214
|
+
}),
|
|
215
|
+
rawResponse: _response.rawResponse,
|
|
216
|
+
};
|
|
202
217
|
}
|
|
203
218
|
if (_response.error.reason === "status-code") {
|
|
204
219
|
switch (_response.error.statusCode) {
|
|
@@ -209,11 +224,12 @@ class Messages {
|
|
|
209
224
|
allowUnrecognizedEnumValues: true,
|
|
210
225
|
skipValidation: true,
|
|
211
226
|
breadcrumbsPrefix: ["response"],
|
|
212
|
-
}));
|
|
227
|
+
}), _response.rawResponse);
|
|
213
228
|
default:
|
|
214
229
|
throw new errors.LettaError({
|
|
215
230
|
statusCode: _response.error.statusCode,
|
|
216
231
|
body: _response.error.body,
|
|
232
|
+
rawResponse: _response.rawResponse,
|
|
217
233
|
});
|
|
218
234
|
}
|
|
219
235
|
}
|
|
@@ -222,12 +238,14 @@ class Messages {
|
|
|
222
238
|
throw new errors.LettaError({
|
|
223
239
|
statusCode: _response.error.statusCode,
|
|
224
240
|
body: _response.error.rawBody,
|
|
241
|
+
rawResponse: _response.rawResponse,
|
|
225
242
|
});
|
|
226
243
|
case "timeout":
|
|
227
244
|
throw new errors.LettaTimeoutError("Timeout exceeded when calling POST /v1/agents/{agent_id}/messages.");
|
|
228
245
|
case "unknown":
|
|
229
246
|
throw new errors.LettaError({
|
|
230
247
|
message: _response.error.errorMessage,
|
|
248
|
+
rawResponse: _response.rawResponse,
|
|
231
249
|
});
|
|
232
250
|
}
|
|
233
251
|
});
|
|
@@ -248,6 +266,9 @@ class Messages {
|
|
|
248
266
|
* })
|
|
249
267
|
*/
|
|
250
268
|
modify(agentId, messageId, request, requestOptions) {
|
|
269
|
+
return core.HttpResponsePromise.fromPromise(this.__modify(agentId, messageId, request, requestOptions));
|
|
270
|
+
}
|
|
271
|
+
__modify(agentId, messageId, request, requestOptions) {
|
|
251
272
|
return __awaiter(this, void 0, void 0, function* () {
|
|
252
273
|
var _a, _b, _c;
|
|
253
274
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
@@ -255,7 +276,7 @@ class Messages {
|
|
|
255
276
|
method: "PATCH",
|
|
256
277
|
headers: Object.assign(Object.assign({ "X-Project": (yield core.Supplier.get(this._options.project)) != null
|
|
257
278
|
? yield core.Supplier.get(this._options.project)
|
|
258
|
-
: undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.
|
|
279
|
+
: undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.172", "User-Agent": "@letta-ai/letta-client/0.1.172", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
259
280
|
contentType: "application/json",
|
|
260
281
|
requestType: "json",
|
|
261
282
|
body: serializers.agents.MessagesModifyRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -264,13 +285,16 @@ class Messages {
|
|
|
264
285
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
265
286
|
});
|
|
266
287
|
if (_response.ok) {
|
|
267
|
-
return
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
288
|
+
return {
|
|
289
|
+
data: serializers.agents.MessagesModifyResponse.parseOrThrow(_response.body, {
|
|
290
|
+
unrecognizedObjectKeys: "passthrough",
|
|
291
|
+
allowUnrecognizedUnionMembers: true,
|
|
292
|
+
allowUnrecognizedEnumValues: true,
|
|
293
|
+
skipValidation: true,
|
|
294
|
+
breadcrumbsPrefix: ["response"],
|
|
295
|
+
}),
|
|
296
|
+
rawResponse: _response.rawResponse,
|
|
297
|
+
};
|
|
274
298
|
}
|
|
275
299
|
if (_response.error.reason === "status-code") {
|
|
276
300
|
switch (_response.error.statusCode) {
|
|
@@ -281,11 +305,12 @@ class Messages {
|
|
|
281
305
|
allowUnrecognizedEnumValues: true,
|
|
282
306
|
skipValidation: true,
|
|
283
307
|
breadcrumbsPrefix: ["response"],
|
|
284
|
-
}));
|
|
308
|
+
}), _response.rawResponse);
|
|
285
309
|
default:
|
|
286
310
|
throw new errors.LettaError({
|
|
287
311
|
statusCode: _response.error.statusCode,
|
|
288
312
|
body: _response.error.body,
|
|
313
|
+
rawResponse: _response.rawResponse,
|
|
289
314
|
});
|
|
290
315
|
}
|
|
291
316
|
}
|
|
@@ -294,12 +319,14 @@ class Messages {
|
|
|
294
319
|
throw new errors.LettaError({
|
|
295
320
|
statusCode: _response.error.statusCode,
|
|
296
321
|
body: _response.error.rawBody,
|
|
322
|
+
rawResponse: _response.rawResponse,
|
|
297
323
|
});
|
|
298
324
|
case "timeout":
|
|
299
325
|
throw new errors.LettaTimeoutError("Timeout exceeded when calling PATCH /v1/agents/{agent_id}/messages/{message_id}.");
|
|
300
326
|
case "unknown":
|
|
301
327
|
throw new errors.LettaError({
|
|
302
328
|
message: _response.error.errorMessage,
|
|
329
|
+
rawResponse: _response.rawResponse,
|
|
303
330
|
});
|
|
304
331
|
}
|
|
305
332
|
});
|
|
@@ -310,6 +337,9 @@ class Messages {
|
|
|
310
337
|
* It will stream the steps of the response always, and stream the tokens if 'stream_tokens' is set to True.
|
|
311
338
|
*/
|
|
312
339
|
createStream(agentId, request, requestOptions) {
|
|
340
|
+
return core.HttpResponsePromise.fromPromise(this.__createStream(agentId, request, requestOptions));
|
|
341
|
+
}
|
|
342
|
+
__createStream(agentId, request, requestOptions) {
|
|
313
343
|
return __awaiter(this, void 0, void 0, function* () {
|
|
314
344
|
var _a, _b, _c;
|
|
315
345
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
@@ -317,7 +347,7 @@ class Messages {
|
|
|
317
347
|
method: "POST",
|
|
318
348
|
headers: Object.assign(Object.assign({ "X-Project": (yield core.Supplier.get(this._options.project)) != null
|
|
319
349
|
? yield core.Supplier.get(this._options.project)
|
|
320
|
-
: undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.
|
|
350
|
+
: undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.172", "User-Agent": "@letta-ai/letta-client/0.1.172", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
321
351
|
contentType: "application/json",
|
|
322
352
|
requestType: "json",
|
|
323
353
|
body: serializers.LettaStreamingRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -327,23 +357,26 @@ class Messages {
|
|
|
327
357
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
328
358
|
});
|
|
329
359
|
if (_response.ok) {
|
|
330
|
-
return
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
360
|
+
return {
|
|
361
|
+
data: new core.Stream({
|
|
362
|
+
stream: _response.body,
|
|
363
|
+
parse: (data) => __awaiter(this, void 0, void 0, function* () {
|
|
364
|
+
return serializers.agents.LettaStreamingResponse.parseOrThrow(data, {
|
|
365
|
+
unrecognizedObjectKeys: "passthrough",
|
|
366
|
+
allowUnrecognizedUnionMembers: true,
|
|
367
|
+
allowUnrecognizedEnumValues: true,
|
|
368
|
+
skipValidation: true,
|
|
369
|
+
breadcrumbsPrefix: ["response"],
|
|
370
|
+
});
|
|
371
|
+
}),
|
|
372
|
+
signal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
373
|
+
eventShape: {
|
|
374
|
+
type: "sse",
|
|
375
|
+
streamTerminator: "[DONE]",
|
|
376
|
+
},
|
|
340
377
|
}),
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
type: "sse",
|
|
344
|
-
streamTerminator: "[DONE]",
|
|
345
|
-
},
|
|
346
|
-
});
|
|
378
|
+
rawResponse: _response.rawResponse,
|
|
379
|
+
};
|
|
347
380
|
}
|
|
348
381
|
if (_response.error.reason === "status-code") {
|
|
349
382
|
switch (_response.error.statusCode) {
|
|
@@ -354,11 +387,12 @@ class Messages {
|
|
|
354
387
|
allowUnrecognizedEnumValues: true,
|
|
355
388
|
skipValidation: true,
|
|
356
389
|
breadcrumbsPrefix: ["response"],
|
|
357
|
-
}));
|
|
390
|
+
}), _response.rawResponse);
|
|
358
391
|
default:
|
|
359
392
|
throw new errors.LettaError({
|
|
360
393
|
statusCode: _response.error.statusCode,
|
|
361
394
|
body: _response.error.body,
|
|
395
|
+
rawResponse: _response.rawResponse,
|
|
362
396
|
});
|
|
363
397
|
}
|
|
364
398
|
}
|
|
@@ -367,12 +401,14 @@ class Messages {
|
|
|
367
401
|
throw new errors.LettaError({
|
|
368
402
|
statusCode: _response.error.statusCode,
|
|
369
403
|
body: _response.error.rawBody,
|
|
404
|
+
rawResponse: _response.rawResponse,
|
|
370
405
|
});
|
|
371
406
|
case "timeout":
|
|
372
407
|
throw new errors.LettaTimeoutError("Timeout exceeded when calling POST /v1/agents/{agent_id}/messages/stream.");
|
|
373
408
|
case "unknown":
|
|
374
409
|
throw new errors.LettaError({
|
|
375
410
|
message: _response.error.errorMessage,
|
|
411
|
+
rawResponse: _response.rawResponse,
|
|
376
412
|
});
|
|
377
413
|
}
|
|
378
414
|
});
|
|
@@ -392,6 +428,9 @@ class Messages {
|
|
|
392
428
|
* await client.agents.messages.cancel("agent_id", undefined)
|
|
393
429
|
*/
|
|
394
430
|
cancel(agentId, request, requestOptions) {
|
|
431
|
+
return core.HttpResponsePromise.fromPromise(this.__cancel(agentId, request, requestOptions));
|
|
432
|
+
}
|
|
433
|
+
__cancel(agentId, request, requestOptions) {
|
|
395
434
|
return __awaiter(this, void 0, void 0, function* () {
|
|
396
435
|
var _a, _b, _c;
|
|
397
436
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
@@ -399,7 +438,7 @@ class Messages {
|
|
|
399
438
|
method: "POST",
|
|
400
439
|
headers: Object.assign(Object.assign({ "X-Project": (yield core.Supplier.get(this._options.project)) != null
|
|
401
440
|
? yield core.Supplier.get(this._options.project)
|
|
402
|
-
: undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.
|
|
441
|
+
: undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.172", "User-Agent": "@letta-ai/letta-client/0.1.172", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
403
442
|
contentType: "application/json",
|
|
404
443
|
requestType: "json",
|
|
405
444
|
body: request != null
|
|
@@ -412,13 +451,16 @@ class Messages {
|
|
|
412
451
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
413
452
|
});
|
|
414
453
|
if (_response.ok) {
|
|
415
|
-
return
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
454
|
+
return {
|
|
455
|
+
data: serializers.agents.messages.cancel.Response.parseOrThrow(_response.body, {
|
|
456
|
+
unrecognizedObjectKeys: "passthrough",
|
|
457
|
+
allowUnrecognizedUnionMembers: true,
|
|
458
|
+
allowUnrecognizedEnumValues: true,
|
|
459
|
+
skipValidation: true,
|
|
460
|
+
breadcrumbsPrefix: ["response"],
|
|
461
|
+
}),
|
|
462
|
+
rawResponse: _response.rawResponse,
|
|
463
|
+
};
|
|
422
464
|
}
|
|
423
465
|
if (_response.error.reason === "status-code") {
|
|
424
466
|
switch (_response.error.statusCode) {
|
|
@@ -429,11 +471,12 @@ class Messages {
|
|
|
429
471
|
allowUnrecognizedEnumValues: true,
|
|
430
472
|
skipValidation: true,
|
|
431
473
|
breadcrumbsPrefix: ["response"],
|
|
432
|
-
}));
|
|
474
|
+
}), _response.rawResponse);
|
|
433
475
|
default:
|
|
434
476
|
throw new errors.LettaError({
|
|
435
477
|
statusCode: _response.error.statusCode,
|
|
436
478
|
body: _response.error.body,
|
|
479
|
+
rawResponse: _response.rawResponse,
|
|
437
480
|
});
|
|
438
481
|
}
|
|
439
482
|
}
|
|
@@ -442,12 +485,14 @@ class Messages {
|
|
|
442
485
|
throw new errors.LettaError({
|
|
443
486
|
statusCode: _response.error.statusCode,
|
|
444
487
|
body: _response.error.rawBody,
|
|
488
|
+
rawResponse: _response.rawResponse,
|
|
445
489
|
});
|
|
446
490
|
case "timeout":
|
|
447
491
|
throw new errors.LettaTimeoutError("Timeout exceeded when calling POST /v1/agents/{agent_id}/messages/cancel.");
|
|
448
492
|
case "unknown":
|
|
449
493
|
throw new errors.LettaError({
|
|
450
494
|
message: _response.error.errorMessage,
|
|
495
|
+
rawResponse: _response.rawResponse,
|
|
451
496
|
});
|
|
452
497
|
}
|
|
453
498
|
});
|
|
@@ -477,6 +522,9 @@ class Messages {
|
|
|
477
522
|
* })
|
|
478
523
|
*/
|
|
479
524
|
createAsync(agentId, request, requestOptions) {
|
|
525
|
+
return core.HttpResponsePromise.fromPromise(this.__createAsync(agentId, request, requestOptions));
|
|
526
|
+
}
|
|
527
|
+
__createAsync(agentId, request, requestOptions) {
|
|
480
528
|
return __awaiter(this, void 0, void 0, function* () {
|
|
481
529
|
var _a, _b, _c;
|
|
482
530
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
@@ -484,7 +532,7 @@ class Messages {
|
|
|
484
532
|
method: "POST",
|
|
485
533
|
headers: Object.assign(Object.assign({ "X-Project": (yield core.Supplier.get(this._options.project)) != null
|
|
486
534
|
? yield core.Supplier.get(this._options.project)
|
|
487
|
-
: undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.
|
|
535
|
+
: undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.172", "User-Agent": "@letta-ai/letta-client/0.1.172", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
488
536
|
contentType: "application/json",
|
|
489
537
|
requestType: "json",
|
|
490
538
|
body: serializers.agents.LettaAsyncRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -493,13 +541,16 @@ class Messages {
|
|
|
493
541
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
494
542
|
});
|
|
495
543
|
if (_response.ok) {
|
|
496
|
-
return
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
544
|
+
return {
|
|
545
|
+
data: serializers.Run.parseOrThrow(_response.body, {
|
|
546
|
+
unrecognizedObjectKeys: "passthrough",
|
|
547
|
+
allowUnrecognizedUnionMembers: true,
|
|
548
|
+
allowUnrecognizedEnumValues: true,
|
|
549
|
+
skipValidation: true,
|
|
550
|
+
breadcrumbsPrefix: ["response"],
|
|
551
|
+
}),
|
|
552
|
+
rawResponse: _response.rawResponse,
|
|
553
|
+
};
|
|
503
554
|
}
|
|
504
555
|
if (_response.error.reason === "status-code") {
|
|
505
556
|
switch (_response.error.statusCode) {
|
|
@@ -510,11 +561,12 @@ class Messages {
|
|
|
510
561
|
allowUnrecognizedEnumValues: true,
|
|
511
562
|
skipValidation: true,
|
|
512
563
|
breadcrumbsPrefix: ["response"],
|
|
513
|
-
}));
|
|
564
|
+
}), _response.rawResponse);
|
|
514
565
|
default:
|
|
515
566
|
throw new errors.LettaError({
|
|
516
567
|
statusCode: _response.error.statusCode,
|
|
517
568
|
body: _response.error.body,
|
|
569
|
+
rawResponse: _response.rawResponse,
|
|
518
570
|
});
|
|
519
571
|
}
|
|
520
572
|
}
|
|
@@ -523,12 +575,14 @@ class Messages {
|
|
|
523
575
|
throw new errors.LettaError({
|
|
524
576
|
statusCode: _response.error.statusCode,
|
|
525
577
|
body: _response.error.rawBody,
|
|
578
|
+
rawResponse: _response.rawResponse,
|
|
526
579
|
});
|
|
527
580
|
case "timeout":
|
|
528
581
|
throw new errors.LettaTimeoutError("Timeout exceeded when calling POST /v1/agents/{agent_id}/messages/async.");
|
|
529
582
|
case "unknown":
|
|
530
583
|
throw new errors.LettaError({
|
|
531
584
|
message: _response.error.errorMessage,
|
|
585
|
+
rawResponse: _response.rawResponse,
|
|
532
586
|
});
|
|
533
587
|
}
|
|
534
588
|
});
|
|
@@ -545,7 +599,10 @@ class Messages {
|
|
|
545
599
|
* @example
|
|
546
600
|
* await client.agents.messages.reset("agent_id")
|
|
547
601
|
*/
|
|
548
|
-
reset(
|
|
602
|
+
reset(agentId, request = {}, requestOptions) {
|
|
603
|
+
return core.HttpResponsePromise.fromPromise(this.__reset(agentId, request, requestOptions));
|
|
604
|
+
}
|
|
605
|
+
__reset(agentId_1) {
|
|
549
606
|
return __awaiter(this, arguments, void 0, function* (agentId, request = {}, requestOptions) {
|
|
550
607
|
var _a, _b, _c;
|
|
551
608
|
const { addDefaultInitialMessages } = request;
|
|
@@ -558,7 +615,7 @@ class Messages {
|
|
|
558
615
|
method: "PATCH",
|
|
559
616
|
headers: Object.assign(Object.assign({ "X-Project": (yield core.Supplier.get(this._options.project)) != null
|
|
560
617
|
? yield core.Supplier.get(this._options.project)
|
|
561
|
-
: undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.
|
|
618
|
+
: undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.172", "User-Agent": "@letta-ai/letta-client/0.1.172", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
562
619
|
contentType: "application/json",
|
|
563
620
|
queryParameters: _queryParams,
|
|
564
621
|
requestType: "json",
|
|
@@ -567,13 +624,16 @@ class Messages {
|
|
|
567
624
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
568
625
|
});
|
|
569
626
|
if (_response.ok) {
|
|
570
|
-
return
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
627
|
+
return {
|
|
628
|
+
data: serializers.AgentState.parseOrThrow(_response.body, {
|
|
629
|
+
unrecognizedObjectKeys: "passthrough",
|
|
630
|
+
allowUnrecognizedUnionMembers: true,
|
|
631
|
+
allowUnrecognizedEnumValues: true,
|
|
632
|
+
skipValidation: true,
|
|
633
|
+
breadcrumbsPrefix: ["response"],
|
|
634
|
+
}),
|
|
635
|
+
rawResponse: _response.rawResponse,
|
|
636
|
+
};
|
|
577
637
|
}
|
|
578
638
|
if (_response.error.reason === "status-code") {
|
|
579
639
|
switch (_response.error.statusCode) {
|
|
@@ -584,11 +644,12 @@ class Messages {
|
|
|
584
644
|
allowUnrecognizedEnumValues: true,
|
|
585
645
|
skipValidation: true,
|
|
586
646
|
breadcrumbsPrefix: ["response"],
|
|
587
|
-
}));
|
|
647
|
+
}), _response.rawResponse);
|
|
588
648
|
default:
|
|
589
649
|
throw new errors.LettaError({
|
|
590
650
|
statusCode: _response.error.statusCode,
|
|
591
651
|
body: _response.error.body,
|
|
652
|
+
rawResponse: _response.rawResponse,
|
|
592
653
|
});
|
|
593
654
|
}
|
|
594
655
|
}
|
|
@@ -597,12 +658,14 @@ class Messages {
|
|
|
597
658
|
throw new errors.LettaError({
|
|
598
659
|
statusCode: _response.error.statusCode,
|
|
599
660
|
body: _response.error.rawBody,
|
|
661
|
+
rawResponse: _response.rawResponse,
|
|
600
662
|
});
|
|
601
663
|
case "timeout":
|
|
602
664
|
throw new errors.LettaTimeoutError("Timeout exceeded when calling PATCH /v1/agents/{agent_id}/reset-messages.");
|
|
603
665
|
case "unknown":
|
|
604
666
|
throw new errors.LettaError({
|
|
605
667
|
message: _response.error.errorMessage,
|
|
668
|
+
rawResponse: _response.rawResponse,
|
|
606
669
|
});
|
|
607
670
|
}
|
|
608
671
|
});
|
|
@@ -632,6 +695,9 @@ class Messages {
|
|
|
632
695
|
* })
|
|
633
696
|
*/
|
|
634
697
|
previewRawPayload(agentId, request, requestOptions) {
|
|
698
|
+
return core.HttpResponsePromise.fromPromise(this.__previewRawPayload(agentId, request, requestOptions));
|
|
699
|
+
}
|
|
700
|
+
__previewRawPayload(agentId, request, requestOptions) {
|
|
635
701
|
return __awaiter(this, void 0, void 0, function* () {
|
|
636
702
|
var _a, _b, _c;
|
|
637
703
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
@@ -639,7 +705,7 @@ class Messages {
|
|
|
639
705
|
method: "POST",
|
|
640
706
|
headers: Object.assign(Object.assign({ "X-Project": (yield core.Supplier.get(this._options.project)) != null
|
|
641
707
|
? yield core.Supplier.get(this._options.project)
|
|
642
|
-
: undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.
|
|
708
|
+
: undefined, "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.172", "User-Agent": "@letta-ai/letta-client/0.1.172", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
643
709
|
contentType: "application/json",
|
|
644
710
|
requestType: "json",
|
|
645
711
|
body: serializers.agents.MessagesPreviewRawPayloadRequest.jsonOrThrow(request, {
|
|
@@ -650,13 +716,16 @@ class Messages {
|
|
|
650
716
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
651
717
|
});
|
|
652
718
|
if (_response.ok) {
|
|
653
|
-
return
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
719
|
+
return {
|
|
720
|
+
data: serializers.agents.messages.previewRawPayload.Response.parseOrThrow(_response.body, {
|
|
721
|
+
unrecognizedObjectKeys: "passthrough",
|
|
722
|
+
allowUnrecognizedUnionMembers: true,
|
|
723
|
+
allowUnrecognizedEnumValues: true,
|
|
724
|
+
skipValidation: true,
|
|
725
|
+
breadcrumbsPrefix: ["response"],
|
|
726
|
+
}),
|
|
727
|
+
rawResponse: _response.rawResponse,
|
|
728
|
+
};
|
|
660
729
|
}
|
|
661
730
|
if (_response.error.reason === "status-code") {
|
|
662
731
|
switch (_response.error.statusCode) {
|
|
@@ -667,11 +736,12 @@ class Messages {
|
|
|
667
736
|
allowUnrecognizedEnumValues: true,
|
|
668
737
|
skipValidation: true,
|
|
669
738
|
breadcrumbsPrefix: ["response"],
|
|
670
|
-
}));
|
|
739
|
+
}), _response.rawResponse);
|
|
671
740
|
default:
|
|
672
741
|
throw new errors.LettaError({
|
|
673
742
|
statusCode: _response.error.statusCode,
|
|
674
743
|
body: _response.error.body,
|
|
744
|
+
rawResponse: _response.rawResponse,
|
|
675
745
|
});
|
|
676
746
|
}
|
|
677
747
|
}
|
|
@@ -680,12 +750,14 @@ class Messages {
|
|
|
680
750
|
throw new errors.LettaError({
|
|
681
751
|
statusCode: _response.error.statusCode,
|
|
682
752
|
body: _response.error.rawBody,
|
|
753
|
+
rawResponse: _response.rawResponse,
|
|
683
754
|
});
|
|
684
755
|
case "timeout":
|
|
685
756
|
throw new errors.LettaTimeoutError("Timeout exceeded when calling POST /v1/agents/{agent_id}/messages/preview-raw-payload.");
|
|
686
757
|
case "unknown":
|
|
687
758
|
throw new errors.LettaError({
|
|
688
759
|
message: _response.error.errorMessage,
|
|
760
|
+
rawResponse: _response.rawResponse,
|
|
689
761
|
});
|
|
690
762
|
}
|
|
691
763
|
});
|
|
@@ -42,7 +42,8 @@ export declare class Passages {
|
|
|
42
42
|
* @example
|
|
43
43
|
* await client.agents.passages.list("agent_id")
|
|
44
44
|
*/
|
|
45
|
-
list(agentId: string, request?: Letta.agents.PassagesListRequest, requestOptions?: Passages.RequestOptions):
|
|
45
|
+
list(agentId: string, request?: Letta.agents.PassagesListRequest, requestOptions?: Passages.RequestOptions): core.HttpResponsePromise<Letta.Passage[]>;
|
|
46
|
+
private __list;
|
|
46
47
|
/**
|
|
47
48
|
* Insert a memory into an agent's archival memory store.
|
|
48
49
|
*
|
|
@@ -57,7 +58,8 @@ export declare class Passages {
|
|
|
57
58
|
* text: "text"
|
|
58
59
|
* })
|
|
59
60
|
*/
|
|
60
|
-
create(agentId: string, request: Letta.agents.CreateArchivalMemory, requestOptions?: Passages.RequestOptions):
|
|
61
|
+
create(agentId: string, request: Letta.agents.CreateArchivalMemory, requestOptions?: Passages.RequestOptions): core.HttpResponsePromise<Letta.Passage[]>;
|
|
62
|
+
private __create;
|
|
61
63
|
/**
|
|
62
64
|
* Delete a memory from an agent's archival memory store.
|
|
63
65
|
*
|
|
@@ -70,7 +72,8 @@ export declare class Passages {
|
|
|
70
72
|
* @example
|
|
71
73
|
* await client.agents.passages.delete("agent_id", "memory_id")
|
|
72
74
|
*/
|
|
73
|
-
delete(agentId: string, memoryId: string, requestOptions?: Passages.RequestOptions):
|
|
75
|
+
delete(agentId: string, memoryId: string, requestOptions?: Passages.RequestOptions): core.HttpResponsePromise<unknown>;
|
|
76
|
+
private __delete;
|
|
74
77
|
/**
|
|
75
78
|
* Modify a memory in the agent's archival memory store.
|
|
76
79
|
*
|
|
@@ -86,7 +89,8 @@ export declare class Passages {
|
|
|
86
89
|
* id: "id"
|
|
87
90
|
* })
|
|
88
91
|
*/
|
|
89
|
-
modify(agentId: string, memoryId: string, request: Letta.agents.PassageUpdate, requestOptions?: Passages.RequestOptions):
|
|
92
|
+
modify(agentId: string, memoryId: string, request: Letta.agents.PassageUpdate, requestOptions?: Passages.RequestOptions): core.HttpResponsePromise<Letta.Passage[]>;
|
|
93
|
+
private __modify;
|
|
90
94
|
protected _getCustomAuthorizationHeaders(): Promise<{
|
|
91
95
|
Authorization: string;
|
|
92
96
|
}>;
|