Needle makes it easy to create your RAG pipelines with minimal effort. For more details, refer to our API documentationDocumentation Index
Fetch the complete documentation index at: https://docs.langchain.com/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The Needle Document Loader is a utility for integrating Needle collections with LangChain. It enables seamless storage, retrieval, and utilization of documents for Retrieval-Augmented Generation (RAG) workflows. This example demonstrates:- Storing documents into a Needle collection.
- Setting up a retriever to fetch documents.
- Building a Retrieval-Augmented Generation (RAG) pipeline.
Setup
Before starting, ensure you have the following environment variables set:- NEEDLE_API_KEY: Your API key for authenticating with Needle.
- OPENAI_API_KEY: Your OpenAI API key for language model operations.
Initialization
To initialize the NeedleLoader, you need the following parameters:- needle_api_key: Your Needle API key (or set it as an environment variable).
- collection_id: The ID of the Needle collection to work with.
Instantiation
Load
To add files to the Needle collection:Lazy load
The lazy_load method allows you to iteratively load documents from the Needle collection, yielding each document as it is fetched:Usage
Use within a chain
Below is a complete example of setting up a RAG pipeline with Needle within a chain:API reference
For detailed documentation of allNeedle features and configurations head to the API reference: docs.needle-ai.com
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

