cheshirecat-typescript-client 1.0.1 → 1.0.3
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.
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { AbstractEndpoint } from "./abstract";
|
|
2
2
|
import { CollectionPointsDestroyOutput, CollectionsOutput, ConversationHistoryDeleteOutput, ConversationHistoryOutput, MemoryPointDeleteOutput, MemoryPointOutput } from "../models/api/memories";
|
|
3
|
-
import { Collection } from "../enums";
|
|
3
|
+
import { Collection, Role } from "../enums";
|
|
4
4
|
import { MemoryPointsDeleteByMetadataOutput, MemoryPointsOutput, MemoryRecallOutput } from "../models/api/nested/memories";
|
|
5
|
+
import { Why } from "../models/dtos";
|
|
5
6
|
export declare class MemoryEndpoint extends AbstractEndpoint {
|
|
6
7
|
protected prefix: string;
|
|
7
8
|
/**
|
|
@@ -69,7 +70,7 @@ export declare class MemoryEndpoint extends AbstractEndpoint {
|
|
|
69
70
|
*
|
|
70
71
|
* @returns The conversation history.
|
|
71
72
|
*/
|
|
72
|
-
postConversationHistory(who:
|
|
73
|
+
postConversationHistory(who: Role, text: string, images?: string[] | null, audio?: string[] | null, why?: Why, agentId?: string, userId?: string): Promise<ConversationHistoryOutput>;
|
|
73
74
|
/**
|
|
74
75
|
* This endpoint retrieves memory points based on the input text, either for the agent identified by the agentId
|
|
75
76
|
* parameter (for multi-agent installations) or for the default agent (for single-agent installations). The text
|
package/dist/endpoints/memory.js
CHANGED
|
@@ -37,7 +37,7 @@ class MemoryEndpoint extends abstract_1.AbstractEndpoint {
|
|
|
37
37
|
* @returns The output of the deletion operation.
|
|
38
38
|
*/
|
|
39
39
|
async deleteAllSingleMemoryCollectionPoints(collection, agentId) {
|
|
40
|
-
return this.delete(this.formatUrl("/collections/" + collection), agentId);
|
|
40
|
+
return this.delete(this.formatUrl("/collections/" + collection.toString()), agentId);
|
|
41
41
|
}
|
|
42
42
|
// END Memory Collections API --
|
|
43
43
|
// -- Memory Conversation History API
|
|
@@ -84,11 +84,11 @@ class MemoryEndpoint extends abstract_1.AbstractEndpoint {
|
|
|
84
84
|
*/
|
|
85
85
|
async postConversationHistory(who, text, images, audio, why, agentId, userId) {
|
|
86
86
|
const payload = {
|
|
87
|
-
who,
|
|
87
|
+
who: who.toString(),
|
|
88
88
|
text,
|
|
89
89
|
...(images && { images }),
|
|
90
90
|
...(audio && { audio }),
|
|
91
|
-
...(why && { why }),
|
|
91
|
+
...(why && { why: why.toArray() }),
|
|
92
92
|
};
|
|
93
93
|
return this.postJson(this.formatUrl("/conversation_history"), payload, agentId, userId);
|
|
94
94
|
}
|
|
@@ -133,7 +133,7 @@ class MemoryEndpoint extends abstract_1.AbstractEndpoint {
|
|
|
133
133
|
if (userId && !memoryPoint.metadata["source"]) {
|
|
134
134
|
memoryPoint.metadata["source"] = userId;
|
|
135
135
|
}
|
|
136
|
-
return this.postJson(this.formatUrl("/collections/" + collection + "/points"), memoryPoint, agentId);
|
|
136
|
+
return this.postJson(this.formatUrl("/collections/" + collection.toString() + "/points"), memoryPoint, agentId);
|
|
137
137
|
}
|
|
138
138
|
/**
|
|
139
139
|
* This method puts a memory point, either for the agent identified by the agentId parameter (for multi-agent
|
|
@@ -152,7 +152,7 @@ class MemoryEndpoint extends abstract_1.AbstractEndpoint {
|
|
|
152
152
|
if (userId && !memoryPoint.metadata["source"]) {
|
|
153
153
|
memoryPoint.metadata["source"] = userId;
|
|
154
154
|
}
|
|
155
|
-
return this.put(this.formatUrl("/collections/" + collection + "/points/" + pointId), memoryPoint, agentId);
|
|
155
|
+
return this.put(this.formatUrl("/collections/" + collection.toString() + "/points/" + pointId), memoryPoint, agentId);
|
|
156
156
|
}
|
|
157
157
|
/**
|
|
158
158
|
* This endpoint deletes a memory point, either for the agent identified by the agentId parameter (for multi-agent
|
|
@@ -165,7 +165,7 @@ class MemoryEndpoint extends abstract_1.AbstractEndpoint {
|
|
|
165
165
|
* @returns The memory point output.
|
|
166
166
|
*/
|
|
167
167
|
async deleteMemoryPoint(collection, pointId, agentId) {
|
|
168
|
-
return this.delete(this.formatUrl("/collections/" + collection + "/points/" + pointId), agentId);
|
|
168
|
+
return this.delete(this.formatUrl("/collections/" + collection.toString() + "/points/" + pointId), agentId);
|
|
169
169
|
}
|
|
170
170
|
/**
|
|
171
171
|
* This endpoint deletes memory points based on the metadata, either for the agent identified by the agentId
|
|
@@ -179,7 +179,7 @@ class MemoryEndpoint extends abstract_1.AbstractEndpoint {
|
|
|
179
179
|
* @returns The output of the deletion operation.
|
|
180
180
|
*/
|
|
181
181
|
async deleteMemoryPointsByMetadata(collection, metadata, agentId) {
|
|
182
|
-
return this.delete(this.formatUrl("/collections/" + collection + "/points"), agentId, null, metadata);
|
|
182
|
+
return this.delete(this.formatUrl("/collections/" + collection.toString() + "/points"), agentId, null, metadata);
|
|
183
183
|
}
|
|
184
184
|
/**
|
|
185
185
|
* This endpoint retrieves memory points, either for the agent identified by the agentId parameter (for multi-agent
|
|
@@ -198,7 +198,7 @@ class MemoryEndpoint extends abstract_1.AbstractEndpoint {
|
|
|
198
198
|
...(limit && { limit }),
|
|
199
199
|
...(offset && { offset }),
|
|
200
200
|
};
|
|
201
|
-
return this.get(this.formatUrl("/collections/" + collection + "/points"), agentId, null, query);
|
|
201
|
+
return this.get(this.formatUrl("/collections/" + collection.toString() + "/points"), agentId, null, query);
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
exports.MemoryEndpoint = MemoryEndpoint;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.js","sourceRoot":"","sources":["../../src/endpoints/memory.ts"],"names":[],"mappings":";;;AAAA,yCAA4C;
|
|
1
|
+
{"version":3,"file":"memory.js","sourceRoot":"","sources":["../../src/endpoints/memory.ts"],"names":[],"mappings":";;;AAAA,yCAA4C;AAe5C,MAAa,cAAe,SAAQ,2BAAgB;IACtC,MAAM,GAAG,SAAS,CAAC;IAE7B,4BAA4B;IAE5B;;;;;;;OAOG;I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