Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/embedjs-interfaces/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "@llm-tools/embedjs-interfaces",
"version": "0.1.25",
"version": "0.1.26",
"description": "Interfaces for extending the embedjs ecosystem",
"dependencies": {
"@langchain/core": "^0.3.25",
"@langchain/core": "^0.3.26",
"debug": "^4.4.0",
"md5": "^2.3.0",
"uuid": "^11.0.3"
Expand Down
4 changes: 2 additions & 2 deletions core/embedjs-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "@llm-tools/embedjs-utils",
"version": "0.1.25",
"version": "0.1.26",
"description": "Useful util functions when extending the embedjs ecosystem",
"dependencies": {
"@llm-tools/embedjs-interfaces": "0.1.25"
"@llm-tools/embedjs-interfaces": "0.1.26"
},
"type": "module",
"main": "./src/index.js",
Expand Down
6 changes: 3 additions & 3 deletions core/embedjs-utils/src/util/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ export function toTitleCase(str: string) {
});
}

export function isValidURL(url: string) {
export function isValidURL(candidateUrl: string) {
try {
new URL(url);
return true;
const url = new URL(candidateUrl);
return url.protocol === 'http:' || url.protocol === 'https:';
} catch {
return false;
}
Expand Down
8 changes: 4 additions & 4 deletions core/embedjs/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"type": "module",
"name": "@llm-tools/embedjs",
"version": "0.1.25",
"version": "0.1.26",
"description": "A NodeJS RAG framework to easily work with LLMs and custom datasets",
"dependencies": {
"@langchain/textsplitters": "^0.1.0",
"@llm-tools/embedjs-interfaces": "0.1.25",
"@llm-tools/embedjs-utils": "0.1.25",
"@llm-tools/embedjs-interfaces": "0.1.26",
"@llm-tools/embedjs-utils": "0.1.26",
"debug": "^4.4.0",
"langchain": "^0.3.7",
"langchain": "^0.3.8",
"md5": "^2.3.0",
"mime": "^4.0.6",
"stream-mime-type": "^2.0.0"
Expand Down
12 changes: 7 additions & 5 deletions core/embedjs/src/core/rag-application.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import createDebugMessages from 'debug';

import { RAGEmbedding } from './rag-embedding.js';
import { RAGApplicationBuilder } from './rag-application-builder.js';
import {
AddLoaderReturn,
Expand All @@ -14,6 +13,7 @@ import {
QueryResponse,
SIMPLE_MODELS,
DEFAULT_INSERT_BATCH_SIZE,
BaseEmbeddings,
} from '@llm-tools/embedjs-interfaces';
import { cleanString, getUnique } from '@llm-tools/embedjs-utils';

Expand All @@ -24,12 +24,14 @@ export class RAGApplication {
private readonly searchResultCount: number;
private readonly systemMessage: string;
private readonly vectorDatabase: BaseVectorDatabase;
private readonly embeddingModel: BaseEmbeddings;
private readonly store: BaseStore;
private loaders: BaseLoader[];
private model: BaseModel;

constructor(llmBuilder: RAGApplicationBuilder) {
if (!llmBuilder.getEmbeddingModel()) throw new Error('Embedding model must be set!');
this.embeddingModel = llmBuilder.getEmbeddingModel();

this.storeConversationsToDefaultThread = llmBuilder.getParamStoreConversationsToDefaultThread();
this.store = llmBuilder.getStore();
Expand All @@ -55,7 +57,7 @@ export class RAGApplication {
* LLM based on the configuration provided
*/
public async init(llmBuilder: RAGApplicationBuilder) {
await RAGEmbedding.init(llmBuilder.getEmbeddingModel());
await this.embeddingModel.init();

this.model = await this.getModel(llmBuilder.getModel());
if (!this.model) this.debug('No base model set; query function unavailable!');
Expand All @@ -68,7 +70,7 @@ export class RAGApplication {
this.debug('Initialized LLM class');
}

await this.vectorDatabase.init({ dimensions: await RAGEmbedding.getEmbedding().getDimensions() });
await this.vectorDatabase.init({ dimensions: await this.embeddingModel.getDimensions() });
this.debug('Initialized vector database');

if (this.store) {
Expand Down Expand Up @@ -117,7 +119,7 @@ export class RAGApplication {
*/
private async embedChunks(chunks: Pick<Chunk, 'pageContent'>[]) {
const texts = chunks.map(({ pageContent }) => pageContent);
return RAGEmbedding.getEmbedding().embedDocuments(texts);
return this.embeddingModel.embedDocuments(texts);
}

/**
Expand Down Expand Up @@ -352,7 +354,7 @@ export class RAGApplication {
* only the number of results specified by the `searchResultCount` property.
*/
public async getEmbeddings(cleanQuery: string) {
const queryEmbedded = await RAGEmbedding.getEmbedding().embedQuery(cleanQuery);
const queryEmbedded = await this.embeddingModel.embedQuery(cleanQuery);
const unfilteredResultSet = await this.vectorDatabase.similaritySearch(
queryEmbedded,
this.searchResultCount + 10,
Expand Down
36 changes: 0 additions & 36 deletions core/embedjs/src/core/rag-embedding.ts

This file was deleted.

4 changes: 2 additions & 2 deletions databases/embedjs-astra/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "@llm-tools/embedjs-astradb",
"version": "0.1.25",
"version": "0.1.26",
"description": "Add AstraDB support to embedjs",
"dependencies": {
"@datastax/astra-db-ts": "^1.5.0",
"@llm-tools/embedjs-interfaces": "0.1.25",
"@llm-tools/embedjs-interfaces": "0.1.26",
"debug": "^4.4.0"
},
"type": "module",
Expand Down
4 changes: 2 additions & 2 deletions databases/embedjs-cosmos/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "@llm-tools/embedjs-cosmos",
"version": "0.1.25",
"version": "0.1.26",
"description": "Add CosmosDB support to embedjs",
"dependencies": {
"@azure/cosmos": "^4.2.0",
"@llm-tools/embedjs-interfaces": "0.1.25",
"@llm-tools/embedjs-interfaces": "0.1.26",
"debug": "^4.4.0"
},
"type": "module",
Expand Down
4 changes: 2 additions & 2 deletions databases/embedjs-hnswlib/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "@llm-tools/embedjs-hnswlib",
"version": "0.1.25",
"version": "0.1.26",
"description": "Add HNSWLib support to embedjs",
"dependencies": {
"@llm-tools/embedjs-interfaces": "0.1.25",
"@llm-tools/embedjs-interfaces": "0.1.26",
"debug": "^4.4.0",
"hnswlib-node": "^3.0.0"
},
Expand Down
6 changes: 3 additions & 3 deletions databases/embedjs-lancedb/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "@llm-tools/embedjs-lancedb",
"version": "0.1.25",
"version": "0.1.26",
"description": "Add LanceDb support to embedjs",
"dependencies": {
"@lancedb/lancedb": "^0.14.0",
"@llm-tools/embedjs-interfaces": "0.1.25",
"@lancedb/lancedb": "^0.14.1",
"@llm-tools/embedjs-interfaces": "0.1.26",
"compute-cosine-similarity": "^1.1.0",
"debug": "^4.4.0"
},
Expand Down
6 changes: 3 additions & 3 deletions databases/embedjs-libsql/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "@llm-tools/embedjs-libsql",
"version": "0.1.25",
"version": "0.1.26",
"description": "Add LibSQL support to embedjs",
"dependencies": {
"@libsql/client": "^0.14.0",
"@llm-tools/embedjs-interfaces": "0.1.25",
"@llm-tools/embedjs-utils": "0.1.25",
"@llm-tools/embedjs-interfaces": "0.1.26",
"@llm-tools/embedjs-utils": "0.1.26",
"debug": "^4.4.0"
},
"type": "module",
Expand Down
4 changes: 2 additions & 2 deletions databases/embedjs-lmdb/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "@llm-tools/embedjs-lmdb",
"version": "0.1.25",
"version": "0.1.26",
"description": "Add LMDB support to embedjs",
"dependencies": {
"@llm-tools/embedjs-interfaces": "0.1.25",
"@llm-tools/embedjs-interfaces": "0.1.26",
"debug": "^4.4.0",
"lmdb": "^3.2.0"
},
Expand Down
4 changes: 2 additions & 2 deletions databases/embedjs-mongodb/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "@llm-tools/embedjs-mongodb",
"version": "0.1.25",
"version": "0.1.26",
"description": "Add MongoDB support to embedjs",
"dependencies": {
"@llm-tools/embedjs-interfaces": "0.1.25",
"@llm-tools/embedjs-interfaces": "0.1.26",
"debug": "^4.4.0",
"mongodb": "^6.12.0"
},
Expand Down
4 changes: 2 additions & 2 deletions databases/embedjs-pinecone/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "@llm-tools/embedjs-pinecone",
"version": "0.1.25",
"version": "0.1.26",
"description": "Add Pinecone support to embedjs",
"dependencies": {
"@llm-tools/embedjs-interfaces": "0.1.25",
"@llm-tools/embedjs-interfaces": "0.1.26",
"@pinecone-database/pinecone": "^4.0.0",
"debug": "^4.4.0"
},
Expand Down
4 changes: 2 additions & 2 deletions databases/embedjs-qdrant/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "@llm-tools/embedjs-qdrant",
"version": "0.1.25",
"version": "0.1.26",
"description": "Add Qdrant support to embedjs",
"dependencies": {
"@llm-tools/embedjs-interfaces": "0.1.25",
"@llm-tools/embedjs-interfaces": "0.1.26",
"@qdrant/js-client-rest": "^1.12.0",
"debug": "^4.4.0",
"uuid": "^11.0.3"
Expand Down
6 changes: 3 additions & 3 deletions databases/embedjs-redis/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "@llm-tools/embedjs-redis",
"version": "0.1.25",
"version": "0.1.26",
"description": "Add Redis support to embedjs",
"dependencies": {
"@llm-tools/embedjs-interfaces": "0.1.25",
"ioredis": "^5.4.1"
"@llm-tools/embedjs-interfaces": "0.1.26",
"ioredis": "^5.4.2"
},
"type": "module",
"main": "./src/index.js",
Expand Down
4 changes: 2 additions & 2 deletions databases/embedjs-weaviate/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "@llm-tools/embedjs-weaviate",
"version": "0.1.25",
"version": "0.1.26",
"description": "Add Weaviate support to embedjs",
"dependencies": {
"@llm-tools/embedjs-interfaces": "0.1.25",
"@llm-tools/embedjs-interfaces": "0.1.26",
"compute-cosine-similarity": "^1.1.0",
"debug": "^4.4.0",
"weaviate-ts-client": "^2.2.0"
Expand Down
27 changes: 0 additions & 27 deletions examples/dynamic/package-lock.json

This file was deleted.

27 changes: 0 additions & 27 deletions examples/markdown/package-lock.json

This file was deleted.

27 changes: 0 additions & 27 deletions examples/pinecone/package-lock.json

This file was deleted.

Loading
Loading