Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc fix #166

Merged
merged 7 commits into from
Nov 13, 2024
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: 4 additions & 0 deletions core/embedjs-interfaces/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.18 (2024-11-13)

This was a version bump only for embedjs-interfaces to align it with other projects, there were no code changes.

## 0.1.17 (2024-11-05)

### 🚀 Features
Expand Down
2 changes: 1 addition & 1 deletion core/embedjs-interfaces/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@llm-tools/embedjs-interfaces",
"version": "0.1.17",
"version": "0.1.18",
"description": "Interfaces for extending the embedjs ecosystem",
"dependencies": {
"@langchain/core": "^0.3.17",
Expand Down
4 changes: 4 additions & 0 deletions core/embedjs-utils/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.18 (2024-11-13)

This was a version bump only for embedjs-utils to align it with other projects, there were no code changes.

## 0.1.17 (2024-11-05)

### 🚀 Features
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.17",
"version": "0.1.18",
"description": "Useful util functions when extending the embedjs ecosystem",
"dependencies": {
"@llm-tools/embedjs-interfaces": "0.1.17"
"@llm-tools/embedjs-interfaces": "0.1.18"
},
"type": "module",
"main": "./src/index.js",
Expand Down
4 changes: 4 additions & 0 deletions core/embedjs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.18 (2024-11-13)

This was a version bump only for embedjs to align it with other projects, there were no code changes.

## 0.1.17 (2024-11-05)

### 🚀 Features
Expand Down
6 changes: 3 additions & 3 deletions core/embedjs/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"type": "module",
"name": "@llm-tools/embedjs",
"version": "0.1.17",
"version": "0.1.18",
"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.17",
"@llm-tools/embedjs-utils": "0.1.17",
"@llm-tools/embedjs-interfaces": "0.1.18",
"@llm-tools/embedjs-utils": "0.1.18",
"debug": "^4.3.7",
"langchain": "^0.3.5",
"md5": "^2.3.0",
Expand Down
7 changes: 4 additions & 3 deletions core/embedjs/src/core/rag-application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ export class RAGApplication {
await loader.init();
const chunks = await loader.getChunks();

this.debug('Chunks generator received', uniqueId);
const { newInserts } = await this.batchLoadChunks(uniqueId, chunks);
this.debug(`Add loader completed with ${newInserts} new entries for`, uniqueId);

Expand Down Expand Up @@ -226,20 +227,20 @@ export class RAGApplication {
* The function `batchLoadChunks` processes chunks of data in batches and formats them for insertion.
* @param {string} uniqueId - The `uniqueId` parameter is a string that represents a unique
* identifier for loader being processed.
* @param incrementalGenerator - The `incrementalGenerator` parameter in the `batchLoadChunks`
* @param generator - The `incrementalGenerator` parameter in the `batchLoadChunks`
* function is an asynchronous generator that yields `LoaderChunk` objects.
* @returns The `batchLoadChunks` function returns an object with two properties:
* 1. `newInserts`: The total number of new inserts made during the batch loading process.
* 2. `formattedChunks`: An array containing the formatted chunks that were processed during the
* batch loading process.
*/
private async batchLoadChunks(uniqueId: string, incrementalGenerator: AsyncGenerator<LoaderChunk, void, void>) {
private async batchLoadChunks(uniqueId: string, generator: AsyncGenerator<LoaderChunk, void, void>) {
let i = 0,
batchSize = 0,
newInserts = 0,
formattedChunks: Chunk[] = [];

for await (const chunk of incrementalGenerator) {
for await (const chunk of generator) {
batchSize++;

const formattedChunk = {
Expand Down
4 changes: 4 additions & 0 deletions databases/embedjs-astra/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.18 (2024-11-13)

This was a version bump only for embedjs-astra to align it with other projects, there were no code changes.

## 0.1.17 (2024-11-05)

### 🚀 Features
Expand Down
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.17",
"version": "0.1.18",
"description": "Add AstraDB support to embedjs",
"dependencies": {
"@datastax/astra-db-ts": "^1.5.0",
"@llm-tools/embedjs-interfaces": "0.1.17",
"@llm-tools/embedjs-interfaces": "0.1.18",
"debug": "^4.3.7"
},
"type": "module",
Expand Down
4 changes: 4 additions & 0 deletions databases/embedjs-cosmos/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.18 (2024-11-13)

This was a version bump only for embedjs-cosmos to align it with other projects, there were no code changes.

## 0.1.17 (2024-11-05)

### 🚀 Features
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.17",
"version": "0.1.18",
"description": "Add CosmosDB support to embedjs",
"dependencies": {
"@azure/cosmos": "^4.1.1",
"@llm-tools/embedjs-interfaces": "0.1.17",
"@llm-tools/embedjs-interfaces": "0.1.18",
"debug": "^4.3.7"
},
"type": "module",
Expand Down
4 changes: 4 additions & 0 deletions databases/embedjs-hnswlib/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.18 (2024-11-13)

This was a version bump only for embedjs-hnswlib to align it with other projects, there were no code changes.

## 0.1.17 (2024-11-05)

### 🚀 Features
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.17",
"version": "0.1.18",
"description": "Add HNSWLib support to embedjs",
"dependencies": {
"@llm-tools/embedjs-interfaces": "0.1.17",
"@llm-tools/embedjs-interfaces": "0.1.18",
"debug": "^4.3.7",
"hnswlib-node": "^3.0.0"
},
Expand Down
4 changes: 4 additions & 0 deletions databases/embedjs-lancedb/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.18 (2024-11-13)

This was a version bump only for embedjs-lancedb to align it with other projects, there were no code changes.

## 0.1.17 (2024-11-05)

### 🚀 Features
Expand Down
4 changes: 2 additions & 2 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.17",
"version": "0.1.18",
"description": "Add LanceDb support to embedjs",
"dependencies": {
"@lancedb/lancedb": "^0.12.0",
"@llm-tools/embedjs-interfaces": "0.1.17",
"@llm-tools/embedjs-interfaces": "0.1.18",
"compute-cosine-similarity": "^1.1.0"
},
"type": "module",
Expand Down
4 changes: 4 additions & 0 deletions databases/embedjs-lmdb/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.18 (2024-11-13)

This was a version bump only for embedjs-lmdb to align it with other projects, there were no code changes.

## 0.1.17 (2024-11-05)

### 🚀 Features
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.17",
"version": "0.1.18",
"description": "Add LMDB support to embedjs",
"dependencies": {
"@llm-tools/embedjs-interfaces": "0.1.17",
"@llm-tools/embedjs-interfaces": "0.1.18",
"lmdb": "^3.1.4"
},
"type": "module",
Expand Down
4 changes: 4 additions & 0 deletions databases/embedjs-mongodb/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.18 (2024-11-13)

This was a version bump only for embedjs-mongodb to align it with other projects, there were no code changes.

## 0.1.17 (2024-11-05)

### 🚀 Features
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.17",
"version": "0.1.18",
"description": "Add MongoDB support to embedjs",
"dependencies": {
"@llm-tools/embedjs-interfaces": "0.1.17",
"@llm-tools/embedjs-interfaces": "0.1.18",
"debug": "^4.3.7",
"mongodb": "^6.10.0"
},
Expand Down
4 changes: 4 additions & 0 deletions databases/embedjs-pinecone/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.18 (2024-11-13)

This was a version bump only for embedjs-pinecone to align it with other projects, there were no code changes.

## 0.1.17 (2024-11-05)

### 🚀 Features
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.17",
"version": "0.1.18",
"description": "Add Pinecone support to embedjs",
"dependencies": {
"@llm-tools/embedjs-interfaces": "0.1.17",
"@llm-tools/embedjs-interfaces": "0.1.18",
"@pinecone-database/pinecone": "^4.0.0",
"debug": "^4.3.7"
},
Expand Down
4 changes: 4 additions & 0 deletions databases/embedjs-qdrant/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.18 (2024-11-13)

This was a version bump only for embedjs-qdrant to align it with other projects, there were no code changes.

## 0.1.17 (2024-11-05)

### 🚀 Features
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.17",
"version": "0.1.18",
"description": "Add Qdrant support to embedjs",
"dependencies": {
"@llm-tools/embedjs-interfaces": "0.1.17",
"@llm-tools/embedjs-interfaces": "0.1.18",
"@qdrant/js-client-rest": "^1.12.0",
"debug": "^4.3.7",
"uuid": "^11.0.2"
Expand Down
4 changes: 4 additions & 0 deletions databases/embedjs-redis/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.18 (2024-11-13)

This was a version bump only for embedjs-redis to align it with other projects, there were no code changes.

## 0.1.17 (2024-11-05)

### 🚀 Features
Expand Down
4 changes: 2 additions & 2 deletions databases/embedjs-redis/package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "@llm-tools/embedjs-redis",
"version": "0.1.17",
"version": "0.1.18",
"description": "Add Redis support to embedjs",
"dependencies": {
"@llm-tools/embedjs-interfaces": "0.1.17",
"@llm-tools/embedjs-interfaces": "0.1.18",
"ioredis": "^5.4.1"
},
"type": "module",
Expand Down
4 changes: 4 additions & 0 deletions databases/embedjs-weaviate/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.18 (2024-11-13)

This was a version bump only for embedjs-weaviate to align it with other projects, there were no code changes.

## 0.1.17 (2024-11-05)

### 🚀 Features
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.17",
"version": "0.1.18",
"description": "Add Weaviate support to embedjs",
"dependencies": {
"@llm-tools/embedjs-interfaces": "0.1.17",
"@llm-tools/embedjs-interfaces": "0.1.18",
"compute-cosine-similarity": "^1.1.0",
"debug": "^4.3.7",
"weaviate-ts-client": "^2.2.0"
Expand Down
4 changes: 2 additions & 2 deletions docs/get-started/faq.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ const ragApplication = await new RAGApplicationBuilder()
.setEmbeddingModel(new OllamaEmbeddings({ model: 'nomic-embed-text', baseUrl: 'http://localhost:11434' }))
.build();

ragApplication.addLoader({ urlOrContent: 'https://www.forbes.com/profile/elon-musk' })
ragApplication.addLoader({ urlOrContent: 'https://en.wikipedia.org/wiki/Elon_Musk' })
await ragApplication.addLoader({ urlOrContent: 'https://www.forbes.com/profile/elon-musk' })
await ragApplication.addLoader({ urlOrContent: 'https://en.wikipedia.org/wiki/Elon_Musk' })

await ragApplication.query('What is the net worth of Elon Musk today?')
```
Expand Down
10 changes: 5 additions & 5 deletions docs/get-started/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ const ragApplication = await new RAGApplicationBuilder()
.setVectorDatabase(new HNSWDb())
.build();

ragApplication.addLoader({ urlOrContent: 'https://www.forbes.com/profile/elon-musk' })
ragApplication.addLoader({ urlOrContent: 'https://en.wikipedia.org/wiki/Elon_Musk' })
await ragApplication.addLoader({ urlOrContent: 'https://www.forbes.com/profile/elon-musk' })
await ragApplication.addLoader({ urlOrContent: 'https://en.wikipedia.org/wiki/Elon_Musk' })

await ragApplication.query('What is the net worth of Elon Musk today?')
//Answer: The net worth of Elon Musk today is $258.7 billion.
Expand All @@ -63,7 +63,7 @@ In this section, we will use both an LLM and embedding model from OpenAI.

<CodeGroup>
```ts openai_demo.ts
import { RAGApplicationBuilder } from '@llm-tools/embedjs';
import { RAGApplicationBuilder, SIMPLE_MODELS } from '@llm-tools/embedjs';
import { OpenAiEmbeddings } from '@llm-tools/embedjs-openai';
import { WebLoader } from '@llm-tools/embedjs-loader-web';
import { HNSWDb } from '@llm-tools/embedjs-hnswlib';
Expand All @@ -77,8 +77,8 @@ const ragApplication = await new RAGApplicationBuilder()
.setVectorDatabase(new HNSWDb())
.build();

ragApplication.addLoader(new WebLoader({ urlOrContent: 'https://www.forbes.com/profile/elon-musk' }));
ragApplication.addLoader(new WebLoader({ urlOrContent: 'https://en.wikipedia.org/wiki/Elon_Musk' }));
await ragApplication.addLoader(new WebLoader({ urlOrContent: 'https://www.forbes.com/profile/elon-musk' }));
await ragApplication.addLoader(new WebLoader({ urlOrContent: 'https://en.wikipedia.org/wiki/Elon_Musk' }));

await ragApplication.query('What is the net worth of Elon Musk today?')
//Answer: The net worth of Elon Musk today is $258.7 billion.
Expand Down
13 changes: 7 additions & 6 deletions examples/simple/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import 'dotenv/config';
import { RAGApplicationBuilder } from '@llm-tools/embedjs';
import { OpenAi, OpenAiEmbeddings } from '@llm-tools/embedjs-openai';
import { RAGApplicationBuilder, SIMPLE_MODELS } from '@llm-tools/embedjs';
import { OpenAiEmbeddings } from '@llm-tools/embedjs-openai';
import { WebLoader } from '@llm-tools/embedjs-loader-web';
import { HNSWDb } from '@llm-tools/embedjs-hnswlib';

const llmApplication = await new RAGApplicationBuilder()
.setModel(new OpenAi({ modelName: 'gpt-4o' }))
const ragApplication = await new RAGApplicationBuilder()
.setModel(SIMPLE_MODELS.OPENAI_GPT4_O)
.setEmbeddingModel(new OpenAiEmbeddings())
.setVectorDatabase(new HNSWDb())
.build();

await llmApplication.addLoader(new WebLoader({ urlOrContent: 'https://en.wikipedia.org/wiki/Tesla,_Inc.' }));
await ragApplication.addLoader(new WebLoader({ urlOrContent: 'https://www.forbes.com/profile/elon-musk' }));
await ragApplication.addLoader(new WebLoader({ urlOrContent: 'https://en.wikipedia.org/wiki/Elon_Musk' }));

console.log(await llmApplication.query('Who founded Tesla?'));
await ragApplication.query('What is the net worth of Elon Musk today?');
4 changes: 4 additions & 0 deletions loaders/embedjs-loader-confluence/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.18 (2024-11-13)

This was a version bump only for embedjs-loader-confluence to align it with other projects, there were no code changes.

## 0.1.17 (2024-11-05)

### 🚀 Features
Expand Down
6 changes: 3 additions & 3 deletions loaders/embedjs-loader-confluence/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "@llm-tools/embedjs-loader-confluence",
"version": "0.1.17",
"version": "0.1.18",
"description": "Confluence loader for embedjs",
"dependencies": {
"@llm-tools/embedjs-interfaces": "0.1.17",
"@llm-tools/embedjs-loader-web": "0.1.17",
"@llm-tools/embedjs-interfaces": "0.1.18",
"@llm-tools/embedjs-loader-web": "0.1.18",
"confluence.js": "^1.7.4",
"debug": "^4.3.7",
"md5": "^2.3.0"
Expand Down
4 changes: 4 additions & 0 deletions loaders/embedjs-loader-csv/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.18 (2024-11-13)

This was a version bump only for embedjs-loader-csv to align it with other projects, there were no code changes.

## 0.1.17 (2024-11-05)

### 🚀 Features
Expand Down
Loading
Loading