### Install embedjs Source: https://github.com/llm-tools/embedjs/blob/main/docs/get-started/quickstart.mdx Installs the embedjs Node.js package using npm. ```bash npm i @llm-tools/embedjs ``` -------------------------------- ### EmbedJs Vector Database Configuration Examples Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/vector-databases/overview.mdx This section provides examples for configuring EmbedJs with different vector databases. Each example demonstrates the necessary steps to connect and utilize a specific vector database addon. ```javascript import { EmbedJS } from '@embedjs/core'; // Example for MongoDB import { MongoDBVector } from '@embedjs/mongodb'; const embedjs = new EmbedJS({ vectorDb: new MongoDBVector({ // MongoDB connection details url: 'mongodb://localhost:27017', dbName: 'embedjs', collectionName: 'vectors' }) }); // Example for HNSWLib import { HNSWLibVector } from '@embedjs/hnswlib'; const embedjsHNSW = new EmbedJS({ vectorDb: new HNSWLibVector({ // HNSWLib configuration path: './hnswlib_index' }) }); // Add examples for LibSQL, LanceDB, AstraDB, Pinecone, QDrant, Weaviate here... ``` -------------------------------- ### Install Sitemap addon Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/data-sources/sitemap.mdx Installs the Sitemap addon for embedjs using npm. ```bash npm install @llm-tools/embedjs-loader-sitemap ``` -------------------------------- ### Install Qdrant Addon Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/vector-databases/qdrant.mdx Installs the Qdrant addon for LLM Tools using npm. ```bash npm install @llm-tools/embedjs-pinecone ``` -------------------------------- ### Install Youtube Addon Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/data-sources/youtube-search.mdx Installs the necessary YouTube addon for embedjs using npm. ```bash npm install @llm-tools/embedjs-loader-youtube ``` -------------------------------- ### Install MongoDB Addon Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/stores/mongodb.mdx Installs the MongoDB addon for embedjs using npm. ```bash npm install @llm-tools/embedjs-mongodb ``` -------------------------------- ### Install Dependencies Source: https://github.com/llm-tools/embedjs/blob/main/docs/README.md Installs or re-installs project dependencies, often used to resolve issues with the development server not running. ```bash mintlify install ``` -------------------------------- ### Install Dependencies Source: https://github.com/llm-tools/embedjs/blob/main/docs/contribution/dev.mdx Installs the necessary dependencies for the EmbedJs project using npm. ```bash npm install ``` -------------------------------- ### Install Web Addon Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/data-sources/web-page.mdx Installs the necessary npm package for the web loader functionality. ```bash npm install @llm-tools/embedjs-loader-web ``` -------------------------------- ### Get Help Snippet Source: https://github.com/llm-tools/embedjs/blob/main/docs/get-started/introduction.mdx This snippet provides information on how to get help and contribute to the EmbedJs project, including links to GitHub and contribution documentation. ```mdx Feel free to reach out to us if you have ideas, feedback or questions that we can help out with. - [GitHub](https://github.com/llm-tools/embedjs) - [Contribution docs](/contribution/dev) ``` -------------------------------- ### Install MSOffice Addon Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/data-sources/ppt.mdx Installs the MSOffice addon for embedjs, which is required for loading PPT files. ```bash npm install @llm-tools/embedjs-loader-msoffice ``` -------------------------------- ### Install Weaviate Addon Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/vector-databases/weaviate.mdx Installs the Weaviate addon for LLM Tools EmbedJS using npm. ```bash npm install @llm-tools/embedjs-weaviate ``` -------------------------------- ### Install XML Addon Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/data-sources/xml.mdx Installs the XML loader addon for embedjs using npm. ```bash npm install @llm-tools/embedjs-loader-xml ``` -------------------------------- ### Install Markdown Addon Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/data-sources/markdown.mdx Installs the necessary npm package for the Markdown loader. ```bash npm install @llm-tools/embedjs-loader-markdown ``` -------------------------------- ### Run Mintlify Development Server Source: https://github.com/llm-tools/embedjs/blob/main/docs/contribution/docs.mdx Starts the Mintlify development server to preview documentation changes. Assumes you are in the `docs/` directory. ```bash npx mintlify dev ``` -------------------------------- ### Paid Models Quickstart (OpenAI) Source: https://github.com/llm-tools/embedjs/blob/main/docs/get-started/quickstart.mdx Demonstrates building a RAG application using OpenAI's GPT-4o model and OpenAI embeddings, with data loaded from web URLs. It uses HNSWDb for vector storage. Ensure your OPENAI_API_KEY is set. ```ts 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'; //Replace this with your OpenAI key process.env.OPENAI_API_KEY = "sk-xxxx" const ragApplication = await new RAGApplicationBuilder() .setModel(SIMPLE_MODELS.OPENAI_GPT4_O) .setEmbeddingModel(new OpenAiEmbeddings()) .setVectorDatabase(new HNSWDb()) .build(); 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. ``` -------------------------------- ### Install Youtube Addon Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/data-sources/youtube-channel.mdx Installs the necessary npm package for the YouTube loader functionality. ```bash npm install @llm-tools/embedjs-loader-youtube ``` -------------------------------- ### Install MSOffice Addon Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/data-sources/docx.mdx Installs the necessary MSOffice addon for embedjs to handle DOCX files. ```bash npm install @llm-tools/embedjs-loader-msoffice ``` -------------------------------- ### Open Source Models Quickstart (Ollama) Source: https://github.com/llm-tools/embedjs/blob/main/docs/get-started/quickstart.mdx Demonstrates building a RAG application using Ollama for both the language model and embeddings, with data loaded from web URLs. It uses HNSWDb for vector storage. ```ts import { RAGApplicationBuilder } from '@llm-tools/embedjs'; import { OllamaEmbeddings, Ollama } from '@llm-tools/embedjs-ollama'; import { WebLoader } from '@llm-tools/embedjs-loader-web'; import { HNSWDb } from '@llm-tools/embedjs-hnswlib'; const ragApplication = await new RAGApplicationBuilder() .setModel(new Ollama({ modelName: "llama3.2", baseUrl: 'http://localhost:11434' })) .setEmbeddingModel(new OllamaEmbeddings({ model: 'nomic-embed-text', baseUrl: 'http://localhost:11434' })) .setVectorDatabase(new HNSWDb()) .build(); 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. ``` -------------------------------- ### Install LlamaCpp Addon Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/embeddings/llama-cpp.mdx Installs the LlamaCpp addon for EmbedJs using npm. ```bash npm install @llm-tools/embedjs-llama-cpp ``` -------------------------------- ### Install PDF Addon Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/data-sources/pdf.mdx Installs the PDF loader addon for embedjs using npm. ```bash npm install @llm-tools/embedjs-loader-pdf ``` -------------------------------- ### Install LlamaCpp Addon Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/llms/llama-cpp.mdx Installs the necessary npm package for LlamaCpp integration with embedjs. ```bash npm install @llm-tools/embedjs-llama-cpp ``` -------------------------------- ### Install Youtube Addon Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/data-sources/youtube-video.mdx Installs the necessary npm package for the YouTube loader functionality. ```bash npm install @llm-tools/embedjs-loader-youtube ``` -------------------------------- ### Install LMDB Addon Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/stores/lmdb.mdx Installs the LMDB addon for embedjs using npm. This is the first step to enable LMDB storage. ```bash npm install @llm-tools/embedjs-lmdb ``` -------------------------------- ### Install Ollama Addon Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/embeddings/ollama.mdx Installs the necessary npm package for Ollama integration with EmbedJs. ```bash npm install @llm-tools/embedjs-ollama ``` -------------------------------- ### Install LibSQL Addon Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/stores/libsql.mdx Installs the LibSQL addon for LLM Tools EmbedJS using npm. This command is essential for enabling LibSQL storage capabilities. ```bash npm install @llm-tools/embedjs-libsql ``` -------------------------------- ### Install Vertex AI Addon Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/embeddings/vertexai.mdx Installs the necessary npm package for integrating Vertex AI embeddings with embedjs. ```bash npm install @llm-tools/embedjs-vertexai ``` -------------------------------- ### Install HNSWLib Addon Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/vector-databases/hnswlib.mdx Installs the HNSWLib addon for embedjs using npm. This command is used to add the necessary package to your project. ```bash npm install @llm-tools/embedjs-hnswlib ``` -------------------------------- ### Install Vertex AI Addon Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/llms/vertexai.mdx Shows the command to install the embedJs Vertex AI addon package using npm. ```bash npm install @llm-tools/embedjs-vertexai ``` -------------------------------- ### Install Redis Addon Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/stores/redis.mdx Installs the Redis addon for embedjs using npm. This command is essential for enabling Redis data storage capabilities. ```bash npm install @llm-tools/embedjs-redis ``` -------------------------------- ### Install Image Addon Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/data-sources/image.mdx Installs the necessary Image addon for EmbedJS using npm. This is a prerequisite for using the ImageLoader. ```bash npm install @llm-tools/embedjs-loader-image ``` -------------------------------- ### Install MSOffice Addon Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/data-sources/excel.mdx Installs the necessary npm package for MSOffice integration, specifically for loading Excel files. ```bash npm install @llm-tools/embedjs-loader-msoffice ``` -------------------------------- ### Install OpenAI Embeddings Package Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/embeddings/openai.mdx Shows the npm command to install the @llm-tools/embedjs-openai package, which provides the necessary bindings for OpenAI embeddings. ```bash npm install @llm-tools/embedjs-openai ``` -------------------------------- ### Install LibSQL Addon Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/vector-databases/libsql.mdx Installs the necessary LibSQL addon for EmbedJS using npm. This package provides the LibSqlDb class for integrating LibSQL databases. ```bash npm install @llm-tools/embedjs-libsql ``` -------------------------------- ### Ask Bot Command Source: https://github.com/llm-tools/embedjs/blob/main/docs/examples/slack_bot.mdx Command to query the Slack bot. Tag the bot with '@botname' followed by your question. ```text @botname ``` -------------------------------- ### Start Development Server Source: https://github.com/llm-tools/embedjs/blob/main/docs/README.md Runs the Mintlify development server to preview documentation changes. Ensure you are in the 'docs' folder where 'mint.json' is located. ```bash npx mintlify dev ``` -------------------------------- ### Usage Example: Adding YouTube Video to RAG Application Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/data-sources/youtube-video.mdx Demonstrates how to import and use the YoutubeLoader within a RAG application. It shows the setup of the RAG application with specific models and databases, and then adds a YouTube video using its ID or URL. ```typescript import { RAGApplicationBuilder } from '@llm-tools/embedjs'; import { OpenAiEmbeddings } from '@llm-tools/embedjs-openai'; import { HNSWDb } from '@llm-tools/embedjs-hnswlib'; import { YoutubeLoader } from '@llm-tools/embedjs-loader-youtube'; const app = await new RAGApplicationBuilder() .setModel(SIMPLE_MODELS.OPENAI_GPT4_O) .setEmbeddingModel(new OpenAiEmbeddings()) .setVectorDatabase(new HNSWDb()) .build(); app.addLoader(new YoutubeLoader({ videoIdOrUrl: '...' })) ``` -------------------------------- ### Install AstraDB Addon Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/vector-databases/astradb.mdx Installs the AstraDB addon for embedjs using npm. ```bash npm install @llm-tools/embedjs-astradb ``` -------------------------------- ### Install Mistral Addon Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/llms/mistral.mdx Installs the Mistral addon for embedjs using npm. ```bash npm install @llm-tools/embedjs-mistral ``` -------------------------------- ### Install Confluence Addon Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/data-sources/confluence.mdx Installs the necessary npm package for the Confluence loader. ```bash npm install @llm-tools/embedjs-loader-confluence ``` -------------------------------- ### Build a RAG Pipeline with EmbedJs Source: https://github.com/llm-tools/embedjs/blob/main/docs/use-cases/question-answering.mdx Initializes a RAG pipeline using EmbedJs, setting the language model, embedding model, and vector database. Requires @llm-tools/embedjs, @llm-tools/embedjs-openai, and @llm-tools/embedjs-hnswlib. ```ts import { RAGApplicationBuilder } from '@llm-tools/embedjs'; import { OpenAi } from '@llm-tools/embedjs-openai'; import { HNSWDb } from '@llm-tools/embedjs-hnswlib'; const app = await new RAGApplicationBuilder() .setModel(SIMPLE_MODELS.OPENAI_GPT4_O) .setEmbeddingModel(new OpenAiEmbeddings()) .setVectorDatabase(new HNSWDb()) .build(); ``` -------------------------------- ### Install Ollama Addon Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/llms/ollama.mdx Installs the necessary npm package for Ollama integration with embedjs. ```bash npm install @llm-tools/embedjs-ollama ``` -------------------------------- ### Usage Example Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/data-sources/sitemap.mdx Demonstrates how to use the SitemapLoader within the RAGApplicationBuilder to load web pages from a sitemap. It shows the necessary imports and the builder pattern for setting up the application. ```typescript import { RAGApplicationBuilder } from '@llm-tools/embedjs'; import { OpenAiEmbeddings } from '@llm-tools/embedjs-openai'; import { HNSWDb } from '@llm-tools/embedjs-hnswlib'; import { SitemapLoader } from '@llm-tools/embedjs-loader-sitemap'; const app = await new RAGApplicationBuilder() .setModel(SIMPLE_MODELS.OPENAI_GPT4_O) .setEmbeddingModel(new OpenAiEmbeddings()) .setVectorDatabase(new HNSWDb()) .build(); app.addLoader(new SitemapLoader({ url: '...' })) ``` -------------------------------- ### Usage Example Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/data-sources/web-page.mdx Demonstrates how to import and use the WebLoader with RAGApplicationBuilder to add web page content. It shows setting up the application with OpenAI embeddings and HNSWLib vector database, then adding a web page using its URL or content. ```typescript import { RAGApplicationBuilder } from '@llm-tools/embedjs'; import { OpenAiEmbeddings } from '@llm-tools/embedjs-openai'; import { HNSWDb } from '@llm-tools/embedjs-hnswlib'; import { WebLoader } from '@llm-tools/embedjs-loader-web'; const app = await new RAGApplicationBuilder() .setModel(SIMPLE_MODELS.OPENAI_GPT4_O) .setEmbeddingModel(new OpenAiEmbeddings()) .setVectorDatabase(new HNSWDb()) .build(); app.addLoader(new WebLoader({ urlOrContent: '...' })) ``` -------------------------------- ### Initialize LibSQL Store Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/stores/libsql.mdx Demonstrates how to initialize the LibSQL store within the RAGApplicationBuilder. It shows setting the local database path for data persistence. ```typescript import { RAGApplicationBuilder } from '@llm-tools/embedjs'; import { LibSqlStore } from '@llm-tools/embedjs-libsql'; const app = await new RAGApplicationBuilder() .setStore(new LibSqlStore({ path: './data.db' })) ``` -------------------------------- ### Install CSV Addon Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/data-sources/csv.mdx Installs the CSV loader addon for embedjs using npm. ```bash npm install @llm-tools/embedjs-loader-csv ``` -------------------------------- ### Qdrant Integration Example Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/vector-databases/qdrant.mdx Demonstrates how to integrate Qdrant as a vector database within a RAG application using LLM Tools. It shows setting up the embedding model, language model, Qdrant client, adding a data source, and querying the application. Requires OPENAI_API_KEY to be set in the environment. ```typescript import { RAGApplicationBuilder } from '@llm-tools/embedjs'; import { OpenAiEmbeddings } from '@llm-tools/embedjs-openai'; import { QdrantDb } from '@llm-tools/embedjs-qdrant'; import { WebLoader } from '@llm-tools/embedjs-loader-web'; // set OPENAI_API_KEY in your env process.env.OPENAI_API_KEY = "sk-xxx"; const app = await new RAGApplicationBuilder() .setEmbeddingModel(new OpenAiEmbeddings()) .setModel(SIMPLE_MODELS.OPENAI_GPT4_O) .setVectorDatabase(new QdrantDb({ apiKey: '...'; url: '...'; clusterName: '...' })) .build(); //add data source and start query it await app.addLoader(new WebLoader({ urlOrContent: 'https://www.forbes.com/profile/elon-musk' })); await app.query('Tell me about Elon Musk'); ``` -------------------------------- ### Initialize YoutubeSearchLoader Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/data-sources/youtube-search.mdx Demonstrates how to initialize the RAGApplicationBuilder and add the YoutubeSearchLoader to load YouTube videos. It requires setting up the model, embedding model, and vector database before adding the loader with a search string. ```typescript import { RAGApplicationBuilder } from '@llm-tools/embedjs'; import { OpenAiEmbeddings } from '@llm-tools/embedjs-openai'; import { HNSWDb } from '@llm-tools/embedjs-hnswlib'; import { YoutubeSearchLoader } from '@llm-tools/embedjs-loader-youtube'; const app = await new RAGApplicationBuilder() .setModel(SIMPLE_MODELS.OPENAI_GPT4_O) .setEmbeddingModel(new OpenAiEmbeddings()) .setVectorDatabase(new HNSWDb()) .build(); app.addLoader(new YoutubeSearchLoader({ youtubeSearchString: '...' })) ``` -------------------------------- ### Initialize RAGApplication with RedisStore Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/stores/redis.mdx Demonstrates how to initialize the RAGApplicationBuilder and set the RedisStore as the data store. This requires importing necessary classes and configuring the RedisStore with connection details. ```typescript import { RAGApplicationBuilder } from '@llm-tools/embedjs'; import { RedisStore } from '@llm-tools/embedjs-redis'; const app = await new RAGApplicationBuilder() .setStore(new RedisStore({ ... })); ``` -------------------------------- ### Usage Example Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/data-sources/markdown.mdx Demonstrates how to integrate the MarkdownLoader into a RAGApplicationBuilder. It shows setting up the model, embedding model, vector database, and adding the Markdown loader with a file path or URL. ```typescript import { RAGApplicationBuilder } from '@llm-tools/embedjs'; import { OpenAiEmbeddings } from '@llm-tools/embedjs-openai'; import { HNSWDb } from '@llm-tools/embedjs-hnswlib'; import { MarkdownLoader } from '@llm-tools/embedjs-loader-markdown'; const app = await new RAGApplicationBuilder() .setModel(SIMPLE_MODELS.OPENAI_GPT4_O) .setEmbeddingModel(new OpenAiEmbeddings()) .setVectorDatabase(new HNSWDb()) .build(); app.addLoader(new MarkdownLoader({ filePathOrUrl: '...' })) ``` -------------------------------- ### Install EmbedJS Anthropic Addon Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/llms/anthropic.mdx This command installs the specific EmbedJS addon for Anthropic, enabling the use of Claude models. ```bash npm install @llm-tools/embedjs-anthropic ``` -------------------------------- ### RAGApplicationBuilder API Documentation Source: https://github.com/llm-tools/embedjs/blob/main/docs/api-reference/overview.mdx API documentation for the RAGApplicationBuilder, detailing its configuration methods for LLM, embedding models, vector databases, stores, temperature, relevance cutoff, and system messages. ```APIDOC RAGApplicationBuilder: setModel(model: 'NO_MODEL' | SIMPLE_MODELS | BaseModel) Configures the LLM for the RAG application. Setting `NO_MODEL` disables LLM features. `SIMPLE_MODELS` are predefined models. Custom models extending `BaseModel` are also supported. Refer to [LLMs](/components/llms) for a list of predefined LLMs. setEmbeddingModel(embeddingModel: BaseEmbeddings) Configures the embedding model used for converting text into vectors. Refer to [embedding models](/components/embedding-models) for a list of predefined embedding models. setVectorDatabase(vectorDatabase: BaseVectorDatabase) Configures the vector database for the RAG application. Refer to [vector databases](/components/vector-databases) for a list of available vector databases. setStore(store: BaseStore) Configures an internal store to track processed data, preventing reprocessing. If not provided, data is stored in memory and lost on restart. Refer to [stores](/components/stores) for a list of built-in stores. setTemperature(temperature: number) Configures the temperature for the LLM, controlling output randomness. Defaults to 0.1. setEmbeddingRelevanceCutOff(cutoff: number) Controls the relevance threshold for retrieving documents from the vector database. EmbedJs uses default values, but customization is possible. setSystemMessage(message: string) Allows customization of the system message included with every LLM query. ``` -------------------------------- ### Install Cohere Addon Source: https://github.com/llm-tools/embedjs/blob/main/docs/components/embeddings/cohere.mdx Install the embedjs-cohere package using npm. This package provides the necessary bindings for Cohere embeddings. ```bash npm install @llm-tools/embedjs-cohere ```