@letta-ai/letta-client 0.1.14 → 0.1.15
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/resources/agents/client/Client.d.ts +6 -125
- package/api/resources/agents/client/Client.js +22 -626
- package/api/resources/agents/client/requests/index.d.ts +0 -2
- package/api/resources/agents/resources/archivalMemory/client/Client.d.ts +21 -4
- package/api/resources/agents/resources/archivalMemory/client/Client.js +104 -28
- package/api/resources/agents/resources/archivalMemory/client/index.d.ts +1 -1
- package/api/resources/agents/resources/archivalMemory/client/index.js +15 -0
- package/api/resources/agents/{client/requests/ListArchivalMemoryRequest.d.ts → resources/archivalMemory/client/requests/ArchivalMemoryListRequest.d.ts} +1 -1
- package/api/resources/agents/resources/archivalMemory/client/requests/index.d.ts +2 -0
- package/api/resources/agents/resources/archivalMemory/client/requests/index.js +2 -0
- package/api/resources/agents/resources/context/client/Client.js +1 -1
- package/api/resources/agents/resources/coreMemory/client/Client.d.ts +42 -15
- package/api/resources/agents/resources/coreMemory/client/Client.js +195 -64
- package/api/resources/agents/resources/index.d.ts +1 -0
- package/api/resources/agents/resources/index.js +1 -0
- package/api/resources/agents/resources/memoryVariables/client/Client.js +3 -3
- package/api/resources/agents/resources/messages/client/Client.d.ts +2 -2
- package/api/resources/agents/resources/messages/client/Client.js +7 -7
- package/api/resources/agents/resources/messages/client/requests/LettaStreamingRequest.d.ts +1 -1
- package/api/resources/agents/resources/messages/client/requests/MessageUpdate.d.ts +2 -2
- package/api/resources/agents/resources/messages/types/MessageUpdateContent.d.ts +8 -0
- package/api/resources/agents/resources/messages/types/index.d.ts +1 -0
- package/api/resources/agents/resources/messages/types/index.js +1 -0
- package/api/resources/agents/resources/sources/client/Client.js +3 -3
- package/api/resources/agents/resources/templates/client/Client.js +3 -3
- package/api/resources/agents/resources/tools/client/Client.js +3 -3
- package/api/resources/blocks/client/Client.d.ts +13 -0
- package/api/resources/blocks/client/Client.js +71 -5
- package/api/resources/health/client/Client.js +1 -1
- package/api/resources/jobs/client/Client.js +4 -4
- package/api/resources/models/client/Client.js +2 -2
- package/api/resources/providers/client/Client.js +4 -4
- package/api/resources/runs/client/Client.js +6 -6
- package/api/resources/sources/client/Client.js +6 -6
- package/api/resources/sources/resources/files/client/Client.js +3 -3
- package/api/resources/sources/resources/passages/client/Client.js +1 -1
- package/api/resources/tag/client/Client.js +1 -1
- package/api/resources/tools/client/Client.js +11 -11
- package/api/types/AssistantMessage.d.ts +2 -1
- package/api/types/AssistantMessageContent.d.ts +5 -0
- package/api/types/LlmConfig.d.ts +3 -0
- package/api/types/Message.d.ts +2 -2
- package/api/types/MessageCreate.d.ts +2 -2
- package/api/types/MessageCreateContent.d.ts +8 -0
- package/api/types/MessageCreateContent.js +5 -0
- package/api/types/SystemMessage.d.ts +3 -2
- package/api/types/SystemMessageContent.d.ts +5 -0
- package/api/types/SystemMessageContent.js +5 -0
- package/api/types/TextContent.d.ts +8 -0
- package/api/types/TextContent.js +5 -0
- package/api/types/UserMessage.d.ts +3 -2
- package/api/types/UserMessageContent.d.ts +5 -0
- package/api/types/UserMessageContent.js +5 -0
- package/api/types/index.d.ts +5 -0
- package/api/types/index.js +5 -0
- package/dist/api/resources/agents/client/Client.d.ts +6 -125
- package/dist/api/resources/agents/client/Client.js +22 -626
- package/dist/api/resources/agents/client/requests/index.d.ts +0 -2
- package/dist/api/resources/agents/resources/archivalMemory/client/Client.d.ts +21 -4
- package/dist/api/resources/agents/resources/archivalMemory/client/Client.js +104 -28
- package/dist/api/resources/agents/resources/archivalMemory/client/index.d.ts +1 -1
- package/dist/api/resources/agents/resources/archivalMemory/client/index.js +15 -0
- package/dist/api/resources/agents/{client/requests/ListArchivalMemoryRequest.d.ts → resources/archivalMemory/client/requests/ArchivalMemoryListRequest.d.ts} +1 -1
- package/dist/api/resources/agents/resources/archivalMemory/client/requests/ArchivalMemoryListRequest.js +5 -0
- package/dist/api/resources/agents/resources/archivalMemory/client/requests/CreateArchivalMemory.js +5 -0
- package/dist/api/resources/agents/resources/archivalMemory/client/requests/index.d.ts +2 -0
- package/dist/api/resources/agents/resources/archivalMemory/client/requests/index.js +2 -0
- package/dist/api/resources/agents/resources/context/client/Client.js +1 -1
- package/dist/api/resources/agents/resources/coreMemory/client/Client.d.ts +42 -15
- package/dist/api/resources/agents/resources/coreMemory/client/Client.js +195 -64
- package/dist/api/resources/agents/resources/index.d.ts +1 -0
- package/dist/api/resources/agents/resources/index.js +1 -0
- package/dist/api/resources/agents/resources/memoryVariables/client/Client.js +3 -3
- package/dist/api/resources/agents/resources/messages/client/Client.d.ts +2 -2
- package/dist/api/resources/agents/resources/messages/client/Client.js +7 -7
- package/dist/api/resources/agents/resources/messages/client/requests/LettaStreamingRequest.d.ts +1 -1
- package/dist/api/resources/agents/resources/messages/client/requests/MessageUpdate.d.ts +2 -2
- package/dist/api/resources/agents/resources/messages/types/MessageUpdateContent.d.ts +8 -0
- package/dist/api/resources/agents/resources/messages/types/MessageUpdateContent.js +5 -0
- package/dist/api/resources/agents/resources/messages/types/index.d.ts +1 -0
- package/dist/api/resources/agents/resources/messages/types/index.js +1 -0
- package/dist/api/resources/agents/resources/sources/client/Client.js +3 -3
- package/dist/api/resources/agents/resources/templates/client/Client.js +3 -3
- package/dist/api/resources/agents/resources/tools/client/Client.js +3 -3
- package/dist/api/resources/blocks/client/Client.d.ts +13 -0
- package/dist/api/resources/blocks/client/Client.js +71 -5
- package/dist/api/resources/health/client/Client.js +1 -1
- package/dist/api/resources/jobs/client/Client.js +4 -4
- package/dist/api/resources/models/client/Client.js +2 -2
- package/dist/api/resources/providers/client/Client.js +4 -4
- package/dist/api/resources/runs/client/Client.js +6 -6
- package/dist/api/resources/sources/client/Client.js +6 -6
- package/dist/api/resources/sources/resources/files/client/Client.js +3 -3
- package/dist/api/resources/sources/resources/passages/client/Client.js +1 -1
- package/dist/api/resources/tag/client/Client.js +1 -1
- package/dist/api/resources/tools/client/Client.js +11 -11
- package/dist/api/types/AssistantMessage.d.ts +2 -1
- package/dist/api/types/AssistantMessageContent.d.ts +5 -0
- package/dist/api/types/AssistantMessageContent.js +5 -0
- package/dist/api/types/LlmConfig.d.ts +3 -0
- package/dist/api/types/Message.d.ts +2 -2
- package/dist/api/types/MessageCreate.d.ts +2 -2
- package/dist/api/types/MessageCreateContent.d.ts +8 -0
- package/dist/api/types/MessageCreateContent.js +5 -0
- package/dist/api/types/SystemMessage.d.ts +3 -2
- package/dist/api/types/SystemMessageContent.d.ts +5 -0
- package/dist/api/types/SystemMessageContent.js +5 -0
- package/dist/api/types/TextContent.d.ts +8 -0
- package/dist/api/types/TextContent.js +5 -0
- package/dist/api/types/UserMessage.d.ts +3 -2
- package/dist/api/types/UserMessageContent.d.ts +5 -0
- package/dist/api/types/UserMessageContent.js +5 -0
- package/dist/api/types/index.d.ts +5 -0
- package/dist/api/types/index.js +5 -0
- package/dist/serialization/resources/agents/client/index.d.ts +0 -3
- package/dist/serialization/resources/agents/client/index.js +1 -4
- package/dist/serialization/resources/agents/client/requests/index.d.ts +0 -1
- package/dist/serialization/resources/agents/client/requests/index.js +1 -3
- package/dist/serialization/resources/agents/resources/archivalMemory/client/create.d.ts +11 -0
- package/dist/serialization/resources/agents/{client/createArchivalMemory.js → resources/archivalMemory/client/create.js} +2 -2
- package/dist/serialization/resources/agents/resources/archivalMemory/client/index.d.ts +3 -0
- package/dist/serialization/resources/agents/resources/archivalMemory/client/index.js +42 -0
- package/dist/serialization/resources/agents/resources/archivalMemory/client/list.d.ts +11 -0
- package/dist/serialization/resources/agents/{client/listArchivalMemory.js → resources/archivalMemory/client/list.js} +2 -2
- package/dist/serialization/resources/agents/resources/archivalMemory/client/requests/CreateArchivalMemory.d.ts +12 -0
- package/{serialization/resources/agents → dist/serialization/resources/agents/resources/archivalMemory}/client/requests/CreateArchivalMemory.js +1 -1
- package/dist/serialization/resources/agents/resources/archivalMemory/client/requests/index.d.ts +1 -0
- package/dist/serialization/resources/agents/resources/archivalMemory/client/requests/index.js +5 -0
- package/dist/serialization/resources/agents/resources/archivalMemory/index.d.ts +1 -0
- package/dist/serialization/resources/agents/resources/archivalMemory/index.js +17 -0
- package/dist/serialization/resources/agents/resources/coreMemory/client/index.d.ts +1 -0
- package/dist/serialization/resources/agents/resources/coreMemory/client/index.js +37 -0
- package/dist/serialization/resources/agents/resources/coreMemory/client/listBlocks.d.ts +11 -0
- package/{serialization/resources/agents/client/listCoreMemoryBlocks.js → dist/serialization/resources/agents/resources/coreMemory/client/listBlocks.js} +2 -2
- package/dist/serialization/resources/agents/resources/coreMemory/index.d.ts +1 -0
- package/dist/serialization/resources/agents/resources/coreMemory/index.js +17 -0
- package/dist/serialization/resources/agents/resources/index.d.ts +3 -0
- package/dist/serialization/resources/agents/resources/index.js +4 -1
- package/dist/serialization/resources/agents/resources/messages/client/requests/MessageUpdate.d.ts +2 -1
- package/dist/serialization/resources/agents/resources/messages/client/requests/MessageUpdate.js +2 -1
- package/dist/serialization/resources/agents/resources/messages/types/MessageUpdateContent.d.ts +11 -0
- package/dist/serialization/resources/agents/resources/messages/types/MessageUpdateContent.js +42 -0
- package/dist/serialization/resources/agents/resources/messages/types/index.d.ts +1 -0
- package/dist/serialization/resources/agents/resources/messages/types/index.js +1 -0
- package/dist/serialization/resources/blocks/client/index.d.ts +1 -0
- package/dist/serialization/resources/blocks/client/index.js +2 -1
- package/dist/serialization/resources/{agents/client/createArchivalMemory.d.ts → blocks/client/listAgentsForBlock.d.ts} +3 -3
- package/dist/serialization/resources/blocks/client/listAgentsForBlock.js +42 -0
- package/dist/serialization/types/AssistantMessage.d.ts +2 -1
- package/dist/serialization/types/AssistantMessage.js +2 -1
- package/dist/serialization/types/AssistantMessageContent.d.ts +11 -0
- package/dist/serialization/types/AssistantMessageContent.js +42 -0
- package/dist/serialization/types/LlmConfig.d.ts +1 -0
- package/dist/serialization/types/LlmConfig.js +1 -0
- package/dist/serialization/types/Message.d.ts +2 -1
- package/dist/serialization/types/Message.js +2 -1
- package/dist/serialization/types/MessageCreate.d.ts +2 -1
- package/dist/serialization/types/MessageCreate.js +2 -1
- package/dist/serialization/types/MessageCreateContent.d.ts +11 -0
- package/dist/serialization/types/MessageCreateContent.js +42 -0
- package/dist/serialization/types/SystemMessage.d.ts +2 -1
- package/dist/serialization/types/SystemMessage.js +2 -1
- package/dist/serialization/types/SystemMessageContent.d.ts +11 -0
- package/dist/serialization/types/SystemMessageContent.js +42 -0
- package/dist/serialization/types/TextContent.d.ts +13 -0
- package/dist/serialization/types/TextContent.js +44 -0
- package/dist/serialization/types/UserMessage.d.ts +2 -1
- package/dist/serialization/types/UserMessage.js +2 -1
- package/dist/serialization/types/UserMessageContent.d.ts +11 -0
- package/dist/serialization/types/UserMessageContent.js +42 -0
- package/dist/serialization/types/index.d.ts +5 -0
- package/dist/serialization/types/index.js +5 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/reference.md +487 -895
- package/serialization/resources/agents/client/index.d.ts +0 -3
- package/serialization/resources/agents/client/index.js +1 -4
- package/serialization/resources/agents/client/requests/index.d.ts +0 -1
- package/serialization/resources/agents/client/requests/index.js +1 -3
- package/serialization/resources/agents/resources/archivalMemory/client/create.d.ts +11 -0
- package/serialization/resources/agents/{client/listArchivalMemory.js → resources/archivalMemory/client/create.js} +2 -2
- package/serialization/resources/agents/resources/archivalMemory/client/index.d.ts +3 -0
- package/serialization/resources/agents/resources/archivalMemory/client/index.js +42 -0
- package/serialization/resources/agents/resources/archivalMemory/client/list.d.ts +11 -0
- package/serialization/resources/agents/{client/createArchivalMemory.js → resources/archivalMemory/client/list.js} +2 -2
- package/serialization/resources/agents/resources/archivalMemory/client/requests/CreateArchivalMemory.d.ts +12 -0
- package/{dist/serialization/resources/agents → serialization/resources/agents/resources/archivalMemory}/client/requests/CreateArchivalMemory.js +1 -1
- package/serialization/resources/agents/resources/archivalMemory/client/requests/index.d.ts +1 -0
- package/serialization/resources/agents/resources/archivalMemory/client/requests/index.js +5 -0
- package/serialization/resources/agents/resources/archivalMemory/index.d.ts +1 -0
- package/serialization/resources/agents/resources/archivalMemory/index.js +17 -0
- package/serialization/resources/agents/resources/coreMemory/client/index.d.ts +1 -0
- package/serialization/resources/agents/resources/coreMemory/client/index.js +37 -0
- package/serialization/resources/agents/resources/coreMemory/client/listBlocks.d.ts +11 -0
- package/{dist/serialization/resources/agents/client/listCoreMemoryBlocks.js → serialization/resources/agents/resources/coreMemory/client/listBlocks.js} +2 -2
- package/serialization/resources/agents/resources/coreMemory/index.d.ts +1 -0
- package/serialization/resources/agents/resources/coreMemory/index.js +17 -0
- package/serialization/resources/agents/resources/index.d.ts +3 -0
- package/serialization/resources/agents/resources/index.js +4 -1
- package/serialization/resources/agents/resources/messages/client/requests/MessageUpdate.d.ts +2 -1
- package/serialization/resources/agents/resources/messages/client/requests/MessageUpdate.js +2 -1
- package/serialization/resources/agents/resources/messages/types/MessageUpdateContent.d.ts +11 -0
- package/serialization/resources/agents/resources/messages/types/MessageUpdateContent.js +42 -0
- package/serialization/resources/agents/resources/messages/types/index.d.ts +1 -0
- package/serialization/resources/agents/resources/messages/types/index.js +1 -0
- package/serialization/resources/blocks/client/index.d.ts +1 -0
- package/serialization/resources/blocks/client/index.js +2 -1
- package/{dist/serialization/resources/agents/client/listArchivalMemory.d.ts → serialization/resources/blocks/client/listAgentsForBlock.d.ts} +3 -3
- package/serialization/resources/blocks/client/listAgentsForBlock.js +42 -0
- package/serialization/types/AssistantMessage.d.ts +2 -1
- package/serialization/types/AssistantMessage.js +2 -1
- package/serialization/types/AssistantMessageContent.d.ts +11 -0
- package/serialization/types/AssistantMessageContent.js +42 -0
- package/serialization/types/LlmConfig.d.ts +1 -0
- package/serialization/types/LlmConfig.js +1 -0
- package/serialization/types/Message.d.ts +2 -1
- package/serialization/types/Message.js +2 -1
- package/serialization/types/MessageCreate.d.ts +2 -1
- package/serialization/types/MessageCreate.js +2 -1
- package/serialization/types/MessageCreateContent.d.ts +11 -0
- package/serialization/types/MessageCreateContent.js +42 -0
- package/serialization/types/SystemMessage.d.ts +2 -1
- package/serialization/types/SystemMessage.js +2 -1
- package/serialization/types/SystemMessageContent.d.ts +11 -0
- package/serialization/types/SystemMessageContent.js +42 -0
- package/serialization/types/TextContent.d.ts +13 -0
- package/serialization/types/TextContent.js +44 -0
- package/serialization/types/UserMessage.d.ts +2 -1
- package/serialization/types/UserMessage.js +2 -1
- package/serialization/types/UserMessageContent.d.ts +11 -0
- package/serialization/types/UserMessageContent.js +42 -0
- package/serialization/types/index.d.ts +5 -0
- package/serialization/types/index.js +5 -0
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/dist/serialization/resources/agents/client/listCoreMemoryBlocks.d.ts +0 -11
- package/dist/serialization/resources/agents/client/requests/CreateArchivalMemory.d.ts +0 -12
- package/serialization/resources/agents/client/createArchivalMemory.d.ts +0 -11
- package/serialization/resources/agents/client/listArchivalMemory.d.ts +0 -11
- package/serialization/resources/agents/client/listCoreMemoryBlocks.d.ts +0 -11
- package/serialization/resources/agents/client/requests/CreateArchivalMemory.d.ts +0 -12
- /package/api/resources/agents/{client/requests/CreateArchivalMemory.js → resources/archivalMemory/client/requests/ArchivalMemoryListRequest.js} +0 -0
- /package/api/resources/agents/{client → resources/archivalMemory/client}/requests/CreateArchivalMemory.d.ts +0 -0
- /package/{dist/api/resources/agents → api/resources/agents/resources/archivalMemory}/client/requests/CreateArchivalMemory.js +0 -0
- /package/api/resources/agents/{client/requests/ListArchivalMemoryRequest.js → resources/messages/types/MessageUpdateContent.js} +0 -0
- /package/{dist/api/resources/agents/client/requests/ListArchivalMemoryRequest.js → api/types/AssistantMessageContent.js} +0 -0
- /package/dist/api/resources/agents/{client → resources/archivalMemory/client}/requests/CreateArchivalMemory.d.ts +0 -0
|
@@ -51,16 +51,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
51
51
|
exports.CoreMemory = void 0;
|
|
52
52
|
const environments = __importStar(require("../../../../../../environments"));
|
|
53
53
|
const core = __importStar(require("../../../../../../core"));
|
|
54
|
+
const Letta = __importStar(require("../../../../../index"));
|
|
54
55
|
const url_join_1 = __importDefault(require("url-join"));
|
|
56
|
+
const serializers = __importStar(require("../../../../../../serialization/index"));
|
|
55
57
|
const errors = __importStar(require("../../../../../../errors/index"));
|
|
56
58
|
class CoreMemory {
|
|
57
59
|
constructor(_options = {}) {
|
|
58
60
|
this._options = _options;
|
|
59
61
|
}
|
|
60
62
|
/**
|
|
63
|
+
* Retrieve the memory state of a specific agent.
|
|
64
|
+
* This endpoint fetches the current memory state of the agent identified by the user ID and agent ID.
|
|
65
|
+
*
|
|
61
66
|
* @param {string} agentId
|
|
62
67
|
* @param {CoreMemory.RequestOptions} requestOptions - Request-specific configuration.
|
|
63
68
|
*
|
|
69
|
+
* @throws {@link Letta.UnprocessableEntityError}
|
|
70
|
+
*
|
|
64
71
|
* @example
|
|
65
72
|
* await client.agents.coreMemory.retrieve("agent_id")
|
|
66
73
|
*/
|
|
@@ -68,9 +75,9 @@ class CoreMemory {
|
|
|
68
75
|
return __awaiter(this, void 0, void 0, function* () {
|
|
69
76
|
var _a, _b, _c;
|
|
70
77
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
71
|
-
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/
|
|
78
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/core-memory`),
|
|
72
79
|
method: "GET",
|
|
73
|
-
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.
|
|
80
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.15", "User-Agent": "@letta-ai/letta-client/0.1.15", "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),
|
|
74
81
|
contentType: "application/json",
|
|
75
82
|
requestType: "json",
|
|
76
83
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -78,13 +85,30 @@ class CoreMemory {
|
|
|
78
85
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
79
86
|
});
|
|
80
87
|
if (_response.ok) {
|
|
81
|
-
return
|
|
88
|
+
return serializers.Memory.parseOrThrow(_response.body, {
|
|
89
|
+
unrecognizedObjectKeys: "passthrough",
|
|
90
|
+
allowUnrecognizedUnionMembers: true,
|
|
91
|
+
allowUnrecognizedEnumValues: true,
|
|
92
|
+
skipValidation: true,
|
|
93
|
+
breadcrumbsPrefix: ["response"],
|
|
94
|
+
});
|
|
82
95
|
}
|
|
83
96
|
if (_response.error.reason === "status-code") {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
97
|
+
switch (_response.error.statusCode) {
|
|
98
|
+
case 422:
|
|
99
|
+
throw new Letta.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
|
|
100
|
+
unrecognizedObjectKeys: "passthrough",
|
|
101
|
+
allowUnrecognizedUnionMembers: true,
|
|
102
|
+
allowUnrecognizedEnumValues: true,
|
|
103
|
+
skipValidation: true,
|
|
104
|
+
breadcrumbsPrefix: ["response"],
|
|
105
|
+
}));
|
|
106
|
+
default:
|
|
107
|
+
throw new errors.LettaError({
|
|
108
|
+
statusCode: _response.error.statusCode,
|
|
109
|
+
body: _response.error.body,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
88
112
|
}
|
|
89
113
|
switch (_response.error.reason) {
|
|
90
114
|
case "non-json":
|
|
@@ -93,7 +117,7 @@ class CoreMemory {
|
|
|
93
117
|
body: _response.error.rawBody,
|
|
94
118
|
});
|
|
95
119
|
case "timeout":
|
|
96
|
-
throw new errors.LettaTimeoutError("Timeout exceeded when calling GET /v1/agents/{agent_id}/
|
|
120
|
+
throw new errors.LettaTimeoutError("Timeout exceeded when calling GET /v1/agents/{agent_id}/core-memory.");
|
|
97
121
|
case "unknown":
|
|
98
122
|
throw new errors.LettaError({
|
|
99
123
|
message: _response.error.errorMessage,
|
|
@@ -102,19 +126,24 @@ class CoreMemory {
|
|
|
102
126
|
});
|
|
103
127
|
}
|
|
104
128
|
/**
|
|
129
|
+
* Retrieve a memory block from an agent.
|
|
130
|
+
*
|
|
105
131
|
* @param {string} agentId
|
|
132
|
+
* @param {string} blockLabel
|
|
106
133
|
* @param {CoreMemory.RequestOptions} requestOptions - Request-specific configuration.
|
|
107
134
|
*
|
|
135
|
+
* @throws {@link Letta.UnprocessableEntityError}
|
|
136
|
+
*
|
|
108
137
|
* @example
|
|
109
|
-
* await client.agents.coreMemory.
|
|
138
|
+
* await client.agents.coreMemory.retrieveBlock("agent_id", "block_label")
|
|
110
139
|
*/
|
|
111
|
-
|
|
140
|
+
retrieveBlock(agentId, blockLabel, requestOptions) {
|
|
112
141
|
return __awaiter(this, void 0, void 0, function* () {
|
|
113
142
|
var _a, _b, _c;
|
|
114
143
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
115
|
-
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/
|
|
144
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/core-memory/blocks/${encodeURIComponent(blockLabel)}`),
|
|
116
145
|
method: "GET",
|
|
117
|
-
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.
|
|
146
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.15", "User-Agent": "@letta-ai/letta-client/0.1.15", "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),
|
|
118
147
|
contentType: "application/json",
|
|
119
148
|
requestType: "json",
|
|
120
149
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -122,13 +151,30 @@ class CoreMemory {
|
|
|
122
151
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
123
152
|
});
|
|
124
153
|
if (_response.ok) {
|
|
125
|
-
return
|
|
154
|
+
return serializers.Block.parseOrThrow(_response.body, {
|
|
155
|
+
unrecognizedObjectKeys: "passthrough",
|
|
156
|
+
allowUnrecognizedUnionMembers: true,
|
|
157
|
+
allowUnrecognizedEnumValues: true,
|
|
158
|
+
skipValidation: true,
|
|
159
|
+
breadcrumbsPrefix: ["response"],
|
|
160
|
+
});
|
|
126
161
|
}
|
|
127
162
|
if (_response.error.reason === "status-code") {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
163
|
+
switch (_response.error.statusCode) {
|
|
164
|
+
case 422:
|
|
165
|
+
throw new Letta.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
|
|
166
|
+
unrecognizedObjectKeys: "passthrough",
|
|
167
|
+
allowUnrecognizedUnionMembers: true,
|
|
168
|
+
allowUnrecognizedEnumValues: true,
|
|
169
|
+
skipValidation: true,
|
|
170
|
+
breadcrumbsPrefix: ["response"],
|
|
171
|
+
}));
|
|
172
|
+
default:
|
|
173
|
+
throw new errors.LettaError({
|
|
174
|
+
statusCode: _response.error.statusCode,
|
|
175
|
+
body: _response.error.body,
|
|
176
|
+
});
|
|
177
|
+
}
|
|
132
178
|
}
|
|
133
179
|
switch (_response.error.reason) {
|
|
134
180
|
case "non-json":
|
|
@@ -137,7 +183,7 @@ class CoreMemory {
|
|
|
137
183
|
body: _response.error.rawBody,
|
|
138
184
|
});
|
|
139
185
|
case "timeout":
|
|
140
|
-
throw new errors.LettaTimeoutError("Timeout exceeded when calling GET /v1/agents/{agent_id}/
|
|
186
|
+
throw new errors.LettaTimeoutError("Timeout exceeded when calling GET /v1/agents/{agent_id}/core-memory/blocks/{block_label}.");
|
|
141
187
|
case "unknown":
|
|
142
188
|
throw new errors.LettaError({
|
|
143
189
|
message: _response.error.errorMessage,
|
|
@@ -146,34 +192,57 @@ class CoreMemory {
|
|
|
146
192
|
});
|
|
147
193
|
}
|
|
148
194
|
/**
|
|
195
|
+
* Updates a memory block of an agent.
|
|
196
|
+
*
|
|
149
197
|
* @param {string} agentId
|
|
150
|
-
* @param {string}
|
|
198
|
+
* @param {string} blockLabel
|
|
199
|
+
* @param {Letta.BlockUpdate} request
|
|
151
200
|
* @param {CoreMemory.RequestOptions} requestOptions - Request-specific configuration.
|
|
152
201
|
*
|
|
202
|
+
* @throws {@link Letta.UnprocessableEntityError}
|
|
203
|
+
*
|
|
153
204
|
* @example
|
|
154
|
-
* await client.agents.coreMemory.
|
|
205
|
+
* await client.agents.coreMemory.modifyBlock("agent_id", "block_label", {})
|
|
155
206
|
*/
|
|
156
|
-
|
|
207
|
+
modifyBlock(agentId, blockLabel, request, requestOptions) {
|
|
157
208
|
return __awaiter(this, void 0, void 0, function* () {
|
|
158
209
|
var _a, _b, _c;
|
|
159
210
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
160
|
-
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/
|
|
211
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/core-memory/blocks/${encodeURIComponent(blockLabel)}`),
|
|
161
212
|
method: "PATCH",
|
|
162
|
-
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.
|
|
213
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.15", "User-Agent": "@letta-ai/letta-client/0.1.15", "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),
|
|
163
214
|
contentType: "application/json",
|
|
164
215
|
requestType: "json",
|
|
216
|
+
body: serializers.BlockUpdate.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
165
217
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
166
218
|
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
167
219
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
168
220
|
});
|
|
169
221
|
if (_response.ok) {
|
|
170
|
-
return
|
|
222
|
+
return serializers.Block.parseOrThrow(_response.body, {
|
|
223
|
+
unrecognizedObjectKeys: "passthrough",
|
|
224
|
+
allowUnrecognizedUnionMembers: true,
|
|
225
|
+
allowUnrecognizedEnumValues: true,
|
|
226
|
+
skipValidation: true,
|
|
227
|
+
breadcrumbsPrefix: ["response"],
|
|
228
|
+
});
|
|
171
229
|
}
|
|
172
230
|
if (_response.error.reason === "status-code") {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
231
|
+
switch (_response.error.statusCode) {
|
|
232
|
+
case 422:
|
|
233
|
+
throw new Letta.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
|
|
234
|
+
unrecognizedObjectKeys: "passthrough",
|
|
235
|
+
allowUnrecognizedUnionMembers: true,
|
|
236
|
+
allowUnrecognizedEnumValues: true,
|
|
237
|
+
skipValidation: true,
|
|
238
|
+
breadcrumbsPrefix: ["response"],
|
|
239
|
+
}));
|
|
240
|
+
default:
|
|
241
|
+
throw new errors.LettaError({
|
|
242
|
+
statusCode: _response.error.statusCode,
|
|
243
|
+
body: _response.error.body,
|
|
244
|
+
});
|
|
245
|
+
}
|
|
177
246
|
}
|
|
178
247
|
switch (_response.error.reason) {
|
|
179
248
|
case "non-json":
|
|
@@ -182,7 +251,7 @@ class CoreMemory {
|
|
|
182
251
|
body: _response.error.rawBody,
|
|
183
252
|
});
|
|
184
253
|
case "timeout":
|
|
185
|
-
throw new errors.LettaTimeoutError("Timeout exceeded when calling PATCH /v1/agents/{agent_id}/
|
|
254
|
+
throw new errors.LettaTimeoutError("Timeout exceeded when calling PATCH /v1/agents/{agent_id}/core-memory/blocks/{block_label}.");
|
|
186
255
|
case "unknown":
|
|
187
256
|
throw new errors.LettaError({
|
|
188
257
|
message: _response.error.errorMessage,
|
|
@@ -191,20 +260,23 @@ class CoreMemory {
|
|
|
191
260
|
});
|
|
192
261
|
}
|
|
193
262
|
/**
|
|
263
|
+
* Retrieve the memory blocks of a specific agent.
|
|
264
|
+
*
|
|
194
265
|
* @param {string} agentId
|
|
195
|
-
* @param {string} blockId
|
|
196
266
|
* @param {CoreMemory.RequestOptions} requestOptions - Request-specific configuration.
|
|
197
267
|
*
|
|
268
|
+
* @throws {@link Letta.UnprocessableEntityError}
|
|
269
|
+
*
|
|
198
270
|
* @example
|
|
199
|
-
* await client.agents.coreMemory.
|
|
271
|
+
* await client.agents.coreMemory.listBlocks("agent_id")
|
|
200
272
|
*/
|
|
201
|
-
|
|
273
|
+
listBlocks(agentId, requestOptions) {
|
|
202
274
|
return __awaiter(this, void 0, void 0, function* () {
|
|
203
275
|
var _a, _b, _c;
|
|
204
276
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
205
|
-
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/
|
|
206
|
-
method: "
|
|
207
|
-
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.
|
|
277
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/core-memory/blocks`),
|
|
278
|
+
method: "GET",
|
|
279
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.15", "User-Agent": "@letta-ai/letta-client/0.1.15", "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),
|
|
208
280
|
contentType: "application/json",
|
|
209
281
|
requestType: "json",
|
|
210
282
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -212,13 +284,30 @@ class CoreMemory {
|
|
|
212
284
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
213
285
|
});
|
|
214
286
|
if (_response.ok) {
|
|
215
|
-
return
|
|
287
|
+
return serializers.agents.coreMemory.listBlocks.Response.parseOrThrow(_response.body, {
|
|
288
|
+
unrecognizedObjectKeys: "passthrough",
|
|
289
|
+
allowUnrecognizedUnionMembers: true,
|
|
290
|
+
allowUnrecognizedEnumValues: true,
|
|
291
|
+
skipValidation: true,
|
|
292
|
+
breadcrumbsPrefix: ["response"],
|
|
293
|
+
});
|
|
216
294
|
}
|
|
217
295
|
if (_response.error.reason === "status-code") {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
296
|
+
switch (_response.error.statusCode) {
|
|
297
|
+
case 422:
|
|
298
|
+
throw new Letta.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
|
|
299
|
+
unrecognizedObjectKeys: "passthrough",
|
|
300
|
+
allowUnrecognizedUnionMembers: true,
|
|
301
|
+
allowUnrecognizedEnumValues: true,
|
|
302
|
+
skipValidation: true,
|
|
303
|
+
breadcrumbsPrefix: ["response"],
|
|
304
|
+
}));
|
|
305
|
+
default:
|
|
306
|
+
throw new errors.LettaError({
|
|
307
|
+
statusCode: _response.error.statusCode,
|
|
308
|
+
body: _response.error.body,
|
|
309
|
+
});
|
|
310
|
+
}
|
|
222
311
|
}
|
|
223
312
|
switch (_response.error.reason) {
|
|
224
313
|
case "non-json":
|
|
@@ -227,7 +316,7 @@ class CoreMemory {
|
|
|
227
316
|
body: _response.error.rawBody,
|
|
228
317
|
});
|
|
229
318
|
case "timeout":
|
|
230
|
-
throw new errors.LettaTimeoutError("Timeout exceeded when calling
|
|
319
|
+
throw new errors.LettaTimeoutError("Timeout exceeded when calling GET /v1/agents/{agent_id}/core-memory/blocks.");
|
|
231
320
|
case "unknown":
|
|
232
321
|
throw new errors.LettaError({
|
|
233
322
|
message: _response.error.errorMessage,
|
|
@@ -236,20 +325,24 @@ class CoreMemory {
|
|
|
236
325
|
});
|
|
237
326
|
}
|
|
238
327
|
/**
|
|
328
|
+
* Attach a block to an agent.
|
|
329
|
+
*
|
|
239
330
|
* @param {string} agentId
|
|
240
|
-
* @param {string}
|
|
331
|
+
* @param {string} blockId
|
|
241
332
|
* @param {CoreMemory.RequestOptions} requestOptions - Request-specific configuration.
|
|
242
333
|
*
|
|
334
|
+
* @throws {@link Letta.UnprocessableEntityError}
|
|
335
|
+
*
|
|
243
336
|
* @example
|
|
244
|
-
* await client.agents.coreMemory.
|
|
337
|
+
* await client.agents.coreMemory.attachBlock("agent_id", "block_id")
|
|
245
338
|
*/
|
|
246
|
-
|
|
339
|
+
attachBlock(agentId, blockId, requestOptions) {
|
|
247
340
|
return __awaiter(this, void 0, void 0, function* () {
|
|
248
341
|
var _a, _b, _c;
|
|
249
342
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
250
|
-
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/
|
|
251
|
-
method: "
|
|
252
|
-
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.
|
|
343
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/core-memory/blocks/attach/${encodeURIComponent(blockId)}`),
|
|
344
|
+
method: "PATCH",
|
|
345
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.15", "User-Agent": "@letta-ai/letta-client/0.1.15", "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),
|
|
253
346
|
contentType: "application/json",
|
|
254
347
|
requestType: "json",
|
|
255
348
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -257,13 +350,30 @@ class CoreMemory {
|
|
|
257
350
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
258
351
|
});
|
|
259
352
|
if (_response.ok) {
|
|
260
|
-
return
|
|
353
|
+
return serializers.AgentState.parseOrThrow(_response.body, {
|
|
354
|
+
unrecognizedObjectKeys: "passthrough",
|
|
355
|
+
allowUnrecognizedUnionMembers: true,
|
|
356
|
+
allowUnrecognizedEnumValues: true,
|
|
357
|
+
skipValidation: true,
|
|
358
|
+
breadcrumbsPrefix: ["response"],
|
|
359
|
+
});
|
|
261
360
|
}
|
|
262
361
|
if (_response.error.reason === "status-code") {
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
362
|
+
switch (_response.error.statusCode) {
|
|
363
|
+
case 422:
|
|
364
|
+
throw new Letta.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
|
|
365
|
+
unrecognizedObjectKeys: "passthrough",
|
|
366
|
+
allowUnrecognizedUnionMembers: true,
|
|
367
|
+
allowUnrecognizedEnumValues: true,
|
|
368
|
+
skipValidation: true,
|
|
369
|
+
breadcrumbsPrefix: ["response"],
|
|
370
|
+
}));
|
|
371
|
+
default:
|
|
372
|
+
throw new errors.LettaError({
|
|
373
|
+
statusCode: _response.error.statusCode,
|
|
374
|
+
body: _response.error.body,
|
|
375
|
+
});
|
|
376
|
+
}
|
|
267
377
|
}
|
|
268
378
|
switch (_response.error.reason) {
|
|
269
379
|
case "non-json":
|
|
@@ -272,7 +382,7 @@ class CoreMemory {
|
|
|
272
382
|
body: _response.error.rawBody,
|
|
273
383
|
});
|
|
274
384
|
case "timeout":
|
|
275
|
-
throw new errors.LettaTimeoutError("Timeout exceeded when calling
|
|
385
|
+
throw new errors.LettaTimeoutError("Timeout exceeded when calling PATCH /v1/agents/{agent_id}/core-memory/blocks/attach/{block_id}.");
|
|
276
386
|
case "unknown":
|
|
277
387
|
throw new errors.LettaError({
|
|
278
388
|
message: _response.error.errorMessage,
|
|
@@ -281,20 +391,24 @@ class CoreMemory {
|
|
|
281
391
|
});
|
|
282
392
|
}
|
|
283
393
|
/**
|
|
394
|
+
* Detach a block from an agent.
|
|
395
|
+
*
|
|
284
396
|
* @param {string} agentId
|
|
285
|
-
* @param {string}
|
|
397
|
+
* @param {string} blockId
|
|
286
398
|
* @param {CoreMemory.RequestOptions} requestOptions - Request-specific configuration.
|
|
287
399
|
*
|
|
400
|
+
* @throws {@link Letta.UnprocessableEntityError}
|
|
401
|
+
*
|
|
288
402
|
* @example
|
|
289
|
-
* await client.agents.coreMemory.
|
|
403
|
+
* await client.agents.coreMemory.detachBlock("agent_id", "block_id")
|
|
290
404
|
*/
|
|
291
|
-
|
|
405
|
+
detachBlock(agentId, blockId, requestOptions) {
|
|
292
406
|
return __awaiter(this, void 0, void 0, function* () {
|
|
293
407
|
var _a, _b, _c;
|
|
294
408
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
295
|
-
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/
|
|
409
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/core-memory/blocks/detach/${encodeURIComponent(blockId)}`),
|
|
296
410
|
method: "PATCH",
|
|
297
|
-
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.
|
|
411
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.15", "User-Agent": "@letta-ai/letta-client/0.1.15", "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),
|
|
298
412
|
contentType: "application/json",
|
|
299
413
|
requestType: "json",
|
|
300
414
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -302,13 +416,30 @@ class CoreMemory {
|
|
|
302
416
|
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
303
417
|
});
|
|
304
418
|
if (_response.ok) {
|
|
305
|
-
return
|
|
419
|
+
return serializers.AgentState.parseOrThrow(_response.body, {
|
|
420
|
+
unrecognizedObjectKeys: "passthrough",
|
|
421
|
+
allowUnrecognizedUnionMembers: true,
|
|
422
|
+
allowUnrecognizedEnumValues: true,
|
|
423
|
+
skipValidation: true,
|
|
424
|
+
breadcrumbsPrefix: ["response"],
|
|
425
|
+
});
|
|
306
426
|
}
|
|
307
427
|
if (_response.error.reason === "status-code") {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
428
|
+
switch (_response.error.statusCode) {
|
|
429
|
+
case 422:
|
|
430
|
+
throw new Letta.UnprocessableEntityError(serializers.HttpValidationError.parseOrThrow(_response.error.body, {
|
|
431
|
+
unrecognizedObjectKeys: "passthrough",
|
|
432
|
+
allowUnrecognizedUnionMembers: true,
|
|
433
|
+
allowUnrecognizedEnumValues: true,
|
|
434
|
+
skipValidation: true,
|
|
435
|
+
breadcrumbsPrefix: ["response"],
|
|
436
|
+
}));
|
|
437
|
+
default:
|
|
438
|
+
throw new errors.LettaError({
|
|
439
|
+
statusCode: _response.error.statusCode,
|
|
440
|
+
body: _response.error.body,
|
|
441
|
+
});
|
|
442
|
+
}
|
|
312
443
|
}
|
|
313
444
|
switch (_response.error.reason) {
|
|
314
445
|
case "non-json":
|
|
@@ -317,7 +448,7 @@ class CoreMemory {
|
|
|
317
448
|
body: _response.error.rawBody,
|
|
318
449
|
});
|
|
319
450
|
case "timeout":
|
|
320
|
-
throw new errors.LettaTimeoutError("Timeout exceeded when calling PATCH /v1/agents/{agent_id}/
|
|
451
|
+
throw new errors.LettaTimeoutError("Timeout exceeded when calling PATCH /v1/agents/{agent_id}/core-memory/blocks/detach/{block_id}.");
|
|
321
452
|
case "unknown":
|
|
322
453
|
throw new errors.LettaError({
|
|
323
454
|
message: _response.error.errorMessage,
|
|
@@ -9,5 +9,6 @@ export * as tools from "./tools";
|
|
|
9
9
|
export * as sources from "./sources";
|
|
10
10
|
export * as coreMemory from "./coreMemory";
|
|
11
11
|
export * as archivalMemory from "./archivalMemory";
|
|
12
|
+
export * from "./archivalMemory/client/requests";
|
|
12
13
|
export * from "./messages/client/requests";
|
|
13
14
|
export * from "./templates/client/requests";
|
|
@@ -48,5 +48,6 @@ exports.tools = __importStar(require("./tools"));
|
|
|
48
48
|
exports.sources = __importStar(require("./sources"));
|
|
49
49
|
exports.coreMemory = __importStar(require("./coreMemory"));
|
|
50
50
|
exports.archivalMemory = __importStar(require("./archivalMemory"));
|
|
51
|
+
__exportStar(require("./archivalMemory/client/requests"), exports);
|
|
51
52
|
__exportStar(require("./messages/client/requests"), exports);
|
|
52
53
|
__exportStar(require("./templates/client/requests"), exports);
|
|
@@ -76,9 +76,9 @@ class MemoryVariables {
|
|
|
76
76
|
return __awaiter(this, void 0, void 0, function* () {
|
|
77
77
|
var _a, _b, _c;
|
|
78
78
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
79
|
-
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/
|
|
79
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/core-memory/variables`),
|
|
80
80
|
method: "GET",
|
|
81
|
-
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.
|
|
81
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.15", "User-Agent": "@letta-ai/letta-client/0.1.15", "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),
|
|
82
82
|
contentType: "application/json",
|
|
83
83
|
requestType: "json",
|
|
84
84
|
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
@@ -112,7 +112,7 @@ class MemoryVariables {
|
|
|
112
112
|
body: _response.error.rawBody,
|
|
113
113
|
});
|
|
114
114
|
case "timeout":
|
|
115
|
-
throw new errors.LettaTimeoutError("Timeout exceeded when calling GET /v1/agents/{agent_id}/
|
|
115
|
+
throw new errors.LettaTimeoutError("Timeout exceeded when calling GET /v1/agents/{agent_id}/core-memory/variables.");
|
|
116
116
|
case "unknown":
|
|
117
117
|
throw new errors.LettaError({
|
|
118
118
|
message: _response.error.errorMessage,
|
|
@@ -53,7 +53,7 @@ export declare class Messages {
|
|
|
53
53
|
* await client.agents.messages.create("agent_id", {
|
|
54
54
|
* messages: [{
|
|
55
55
|
* role: "user",
|
|
56
|
-
*
|
|
56
|
+
* content: "content"
|
|
57
57
|
* }]
|
|
58
58
|
* })
|
|
59
59
|
*/
|
|
@@ -92,7 +92,7 @@ export declare class Messages {
|
|
|
92
92
|
* await client.agents.messages.createAsync("agent_id", {
|
|
93
93
|
* messages: [{
|
|
94
94
|
* role: "user",
|
|
95
|
-
*
|
|
95
|
+
* content: "content"
|
|
96
96
|
* }]
|
|
97
97
|
* })
|
|
98
98
|
*/
|
|
@@ -94,7 +94,7 @@ class Messages {
|
|
|
94
94
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
95
95
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/messages`),
|
|
96
96
|
method: "GET",
|
|
97
|
-
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.
|
|
97
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.15", "User-Agent": "@letta-ai/letta-client/0.1.15", "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),
|
|
98
98
|
contentType: "application/json",
|
|
99
99
|
queryParameters: _queryParams,
|
|
100
100
|
requestType: "json",
|
|
@@ -157,7 +157,7 @@ class Messages {
|
|
|
157
157
|
* await client.agents.messages.create("agent_id", {
|
|
158
158
|
* messages: [{
|
|
159
159
|
* role: "user",
|
|
160
|
-
*
|
|
160
|
+
* content: "content"
|
|
161
161
|
* }]
|
|
162
162
|
* })
|
|
163
163
|
*/
|
|
@@ -167,7 +167,7 @@ class Messages {
|
|
|
167
167
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
168
168
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/messages`),
|
|
169
169
|
method: "POST",
|
|
170
|
-
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.
|
|
170
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.15", "User-Agent": "@letta-ai/letta-client/0.1.15", "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),
|
|
171
171
|
contentType: "application/json",
|
|
172
172
|
requestType: "json",
|
|
173
173
|
body: serializers.LettaRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -235,7 +235,7 @@ class Messages {
|
|
|
235
235
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
236
236
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/messages/${encodeURIComponent(messageId)}`),
|
|
237
237
|
method: "PATCH",
|
|
238
|
-
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.
|
|
238
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.15", "User-Agent": "@letta-ai/letta-client/0.1.15", "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),
|
|
239
239
|
contentType: "application/json",
|
|
240
240
|
requestType: "json",
|
|
241
241
|
body: serializers.agents.MessageUpdate.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -295,7 +295,7 @@ class Messages {
|
|
|
295
295
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
296
296
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/messages/stream`),
|
|
297
297
|
method: "POST",
|
|
298
|
-
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.
|
|
298
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.15", "User-Agent": "@letta-ai/letta-client/0.1.15", "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),
|
|
299
299
|
contentType: "application/json",
|
|
300
300
|
requestType: "json",
|
|
301
301
|
body: serializers.agents.LettaStreamingRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -369,7 +369,7 @@ class Messages {
|
|
|
369
369
|
* await client.agents.messages.createAsync("agent_id", {
|
|
370
370
|
* messages: [{
|
|
371
371
|
* role: "user",
|
|
372
|
-
*
|
|
372
|
+
* content: "content"
|
|
373
373
|
* }]
|
|
374
374
|
* })
|
|
375
375
|
*/
|
|
@@ -379,7 +379,7 @@ class Messages {
|
|
|
379
379
|
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
380
380
|
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.LettaEnvironment.LettaCloud, `v1/agents/${encodeURIComponent(agentId)}/messages/async`),
|
|
381
381
|
method: "POST",
|
|
382
|
-
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.
|
|
382
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@letta-ai/letta-client", "X-Fern-SDK-Version": "0.1.15", "User-Agent": "@letta-ai/letta-client/0.1.15", "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),
|
|
383
383
|
contentType: "application/json",
|
|
384
384
|
requestType: "json",
|
|
385
385
|
body: serializers.LettaRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
|
|
@@ -9,8 +9,8 @@ import * as Letta from "../../../../../../index";
|
|
|
9
9
|
export interface MessageUpdate {
|
|
10
10
|
/** The role of the participant. */
|
|
11
11
|
role?: Letta.MessageRole;
|
|
12
|
-
/** The
|
|
13
|
-
|
|
12
|
+
/** The content of the message. */
|
|
13
|
+
content?: Letta.agents.MessageUpdateContent;
|
|
14
14
|
/** The name of the participant. */
|
|
15
15
|
name?: string;
|
|
16
16
|
/** The list of tool calls requested. */
|