Skip to content

Commit 1efd12e

Browse files
authored
Merge pull request #178 from llm-tools/sqlite
LibSQL
2 parents 1bb273e + 2140431 commit 1efd12e

62 files changed

Lines changed: 688 additions & 189 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ acme.json
6464
temp/
6565
storage/
6666
lmdb/
67+
data.db
6768

6869
#env
6970
.env

core/embedjs-interfaces/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@llm-tools/embedjs-interfaces",
3-
"version": "0.1.21",
3+
"version": "0.1.22",
44
"description": "Interfaces for extending the embedjs ecosystem",
55
"dependencies": {
66
"@langchain/core": "^0.3.19",

core/embedjs-utils/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"name": "@llm-tools/embedjs-utils",
3-
"version": "0.1.21",
3+
"version": "0.1.22",
44
"description": "Useful util functions when extending the embedjs ecosystem",
55
"dependencies": {
6-
"@llm-tools/embedjs-interfaces": "0.1.21"
6+
"@llm-tools/embedjs-interfaces": "0.1.22"
77
},
88
"type": "module",
99
"main": "./src/index.js",

core/embedjs/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"type": "module",
33
"name": "@llm-tools/embedjs",
4-
"version": "0.1.21",
4+
"version": "0.1.22",
55
"description": "A NodeJS RAG framework to easily work with LLMs and custom datasets",
66
"dependencies": {
77
"@langchain/textsplitters": "^0.1.0",
8-
"@llm-tools/embedjs-interfaces": "0.1.21",
9-
"@llm-tools/embedjs-utils": "0.1.21",
8+
"@llm-tools/embedjs-interfaces": "0.1.22",
9+
"@llm-tools/embedjs-utils": "0.1.22",
1010
"debug": "^4.3.7",
1111
"langchain": "^0.3.6",
1212
"md5": "^2.3.0",

core/embedjs/src/core/rag-application.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,17 @@ export class RAGApplication {
306306
return this.vectorDatabase.getVectorCount();
307307
}
308308

309+
/**
310+
* The function `deleteConversation` deletes all entries related to a particular conversation from the database
311+
* @param {string} conversationId - The `conversationId` that you want to delete. Pass 'default' to delete
312+
* the default conversation thread that is created and maintained automatically
313+
*/
314+
public async deleteConversation(conversationId: string) {
315+
if (this.store) {
316+
await this.store.deleteConversation(conversationId);
317+
}
318+
}
319+
309320
/**
310321
* The function `deleteLoader` deletes embeddings from a loader after confirming the action.
311322
* @param {string} uniqueLoaderId - The `uniqueLoaderId` parameter is a string that represents the

core/embedjs/src/store/memory-store.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,22 @@ export class MemoryStore implements BaseStore {
5050
const loaderId = <string>this.loaderCustomValues[key].loaderId;
5151

5252
delete this.loaderList[key];
53-
this.loaderCustomValuesMap.set(
54-
loaderId,
55-
this.loaderCustomValuesMap.get(loaderId).filter((k) => k !== key),
56-
);
53+
54+
if (this.loaderCustomValuesMap.has(loaderId)) {
55+
this.loaderCustomValuesMap.set(
56+
loaderId,
57+
this.loaderCustomValuesMap.get(loaderId).filter((k) => k !== key),
58+
);
59+
}
5760
}
5861

5962
async deleteLoaderMetadataAndCustomValues(loaderId: string): Promise<void> {
60-
this.loaderCustomValuesMap.get(loaderId).forEach((key) => {
61-
delete this.loaderCustomValues[key];
62-
});
63+
if (this.loaderCustomValuesMap.has(loaderId)) {
64+
this.loaderCustomValuesMap.get(loaderId).forEach((key) => {
65+
delete this.loaderCustomValues[key];
66+
});
67+
}
68+
6369
this.loaderCustomValuesMap.delete(loaderId);
6470
delete this.loaderList[loaderId];
6571
}

databases/embedjs-astra/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "@llm-tools/embedjs-astradb",
3-
"version": "0.1.21",
3+
"version": "0.1.22",
44
"description": "Add AstraDB support to embedjs",
55
"dependencies": {
66
"@datastax/astra-db-ts": "^1.5.0",
7-
"@llm-tools/embedjs-interfaces": "0.1.21",
7+
"@llm-tools/embedjs-interfaces": "0.1.22",
88
"debug": "^4.3.7"
99
},
1010
"type": "module",

databases/embedjs-cosmos/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "@llm-tools/embedjs-cosmos",
3-
"version": "0.1.21",
3+
"version": "0.1.22",
44
"description": "Add CosmosDB support to embedjs",
55
"dependencies": {
66
"@azure/cosmos": "^4.2.0",
7-
"@llm-tools/embedjs-interfaces": "0.1.21",
7+
"@llm-tools/embedjs-interfaces": "0.1.22",
88
"debug": "^4.3.7"
99
},
1010
"type": "module",

databases/embedjs-hnswlib/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"name": "@llm-tools/embedjs-hnswlib",
3-
"version": "0.1.21",
3+
"version": "0.1.22",
44
"description": "Add HNSWLib support to embedjs",
55
"dependencies": {
6-
"@llm-tools/embedjs-interfaces": "0.1.21",
6+
"@llm-tools/embedjs-interfaces": "0.1.22",
77
"debug": "^4.3.7",
88
"hnswlib-node": "^3.0.0"
99
},

databases/embedjs-lancedb/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "@llm-tools/embedjs-lancedb",
3-
"version": "0.1.21",
3+
"version": "0.1.22",
44
"description": "Add LanceDb support to embedjs",
55
"dependencies": {
66
"@lancedb/lancedb": "^0.13.0",
7-
"@llm-tools/embedjs-interfaces": "0.1.21",
7+
"@llm-tools/embedjs-interfaces": "0.1.22",
88
"compute-cosine-similarity": "^1.1.0",
99
"debug": "^4.3.7"
1010
},

0 commit comments

Comments
 (0)