
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
@forge-ml/rag
Advanced tools
This package provides a flexible and efficient implementation of Retrieval-Augmented Generation (RAG) for Node.js applications. It offers tools for document chunking, embedding generation, vector storage, and similarity search, enabling developers to build powerful RAG systems.
npm install @forge-ml/rag
import { createRagger, OpenAIEmbedder, RedisVectorStore } from "@forge-ml/rag";
const embedder = new OpenAIEmbedder({ apiKey: "your-openai-api-key" });
const vectorStore = new RedisVectorStore("redis://localhost:6379");
const ragger = createRagger(embedder, vectorStore);
// Initialize a document
const chunks = await ragger.initializeDocument("Your document text here");
// Query the document
const results = await ragger.query("Your query here");
The package supports two embedding providers:
const embedder = new OpenAIEmbedder({
type: "openai",
apiKey: process.env.OPENAI_API_KEY,
});
const embedder = new NomicEmbedder({
type: "nomic",
apiKey: process.env.NOMIC_API_KEY,
});
The package uses Redis as the vector store:
const vectorStore = new RedisVectorStore(process.env.REDIS_URL);
createRagger(embedder: Embedder, vectorStore: VectorStore)
Creates a new RAG instance with the specified embedder and vector store.
ragger.initializeDocument(text: string, options?: InitializeDocumentOptions)
Chunks the input text and stores the embeddings in the vector store.
ragger.query(query: string)
Performs a similarity search based on the input query and returns relevant chunks.
To set up the Redis vector store, use the provided Docker Compose file:
version: '3.8'
services:
redis:
image: redis/redis-stack:latest
container_name: redis
ports:
- "6379:6379"
volumes:
- redis_data:/data
command: >
redis-server
--appendonly yes
--protected-mode no
--loadmodule /opt/redis-stack/lib/redisearch.so
--loadmodule /opt/redis-stack/lib/rejson.so
restart: always
volumes:
redis_data:
driver: local
Run the following script to start the Redis container:
#!/bin/bash
# Function to check if Docker is running
check_docker() {
if ! docker info > /dev/null 2>&1; then
echo "Docker is not running. Please start Docker and try again."
exit 1
fi
}
# Function to spin up the vector store
spin_up_vector_store() {
echo "Spinning up the vector store..."
docker compose -f docker/redis.yml up -d
if [ $? -eq 0 ]; then
echo "Vector store is now running."
else
echo "Failed to start the vector store. Please check the Docker logs for more information."
exit 1
fi
}
# Main execution
check_docker
spin_up_vector_store
Contributions are welcome! Please refer to the CONTRIBUTING.md file for guidelines.
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
A RAG (Retrieval-Augmented Generation) package for Forge ML
The npm package @forge-ml/rag receives a total of 0 weekly downloads. As such, @forge-ml/rag popularity was classified as not popular.
We found that @forge-ml/rag demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.