Skip to main content
For the complete documentation index for agents and LLMs, see llms.txt.

JinaReaderConnector

Fetch and parse web content, search the web, or check facts using the Jina Reader API.

Key Features​

  • Supports three operation modes: read (fetch a URL and return its text content), search (search the web and return top results), and ground (perform fact checking).
  • Returns results as Document objects with rich metadata when json_response is True.
  • Accepts optional request headers for fine-grained control over the Jina Reader API (for example, specifying the target language or output format).
  • Supports both synchronous and asynchronous execution.

Configuration​

  1. Drag the JinaReaderConnector component onto the canvas from the Component Library.
  2. Click on the component to open the configuration panel.
  3. On the General tab:
    1. Create a secret with your Jina API key. Use JINA_API_KEY as the secret key. For instructions, see Create Secrets. Get your API key from Jina AI.
    2. Set mode to the operation you want: read, search, or ground.
    3. Set json_response to true to get rich structured metadata or false to get a single document with minimal metadata.

Connections​

JinaReaderConnector receives a query string:

  • In read mode, the query is a URL to fetch.
  • In search mode, the query is a search term to look up on the web.
  • In ground mode, the query is a statement to fact-check.

It outputs a list of Document objects. In search mode, multiple documents are returned (one per result). In read and ground modes, a single document is returned.

Source Code​

To check this component's source code, open reader.py in the Haystack Core Integrations repository.

Usage Examples​

Basic Configuration​

JinaReaderConnector:
type: haystack_integrations.components.connectors.jina.reader.JinaReaderConnector
init_parameters:
mode: read
api_key:
type: env_var
env_vars:
- JINA_API_KEY
strict: false
json_response: true

Using the Component in a Pipeline​

This is an example of a query pipeline that uses JinaReaderConnector in search mode to retrieve web documents for a given query and then generates an answer using an LLM.

# haystack-pipeline
components:
JinaReaderConnector:
type: haystack_integrations.components.connectors.jina.reader.JinaReaderConnector
init_parameters:
mode: search
api_key:
type: env_var
env_vars:
- JINA_API_KEY
strict: false
json_response: true

prompt_builder:
type: haystack.components.builders.prompt_builder.PromptBuilder
init_parameters:
required_variables: "*"
template: |-
Answer the question based on the provided web search results.

Search results:
{% for document in documents %}
{{ document.content }}
{% endfor %}

Question: {{ question }}
Answer:

llm:
type: haystack.components.generators.chat.openai.OpenAIChatGenerator
init_parameters:
api_key:
type: env_var
env_vars:
- OPENAI_API_KEY
strict: false
model: gpt-4o-mini

connections:
- sender: JinaReaderConnector.documents
receiver: prompt_builder.documents
- sender: prompt_builder.prompt
receiver: llm.messages

max_runs_per_component: 100

metadata: {}

inputs:
query:
- JinaReaderConnector.query
- prompt_builder.question

outputs:
replies: llm.replies

Parameters​

Inputs​

ParameterTypeDescription
querystrThe URL to fetch (in read mode), the search term (in search mode), or the statement to fact-check (in ground mode).
headersOptional[Dict[str, str]]Optional headers to include in the request. See the Jina Reader documentation for available options.

Outputs​

ParameterTypeDescription
documentsList[Document]The fetched or searched content as Document objects. In read and ground modes, one document is returned. In search mode, multiple documents are returned (one per result).

Init Parameters​

These are the parameters you can configure in Pipeline Builder:

ParameterTypeDefaultDescription
modeJinaReaderMode | strThe operation mode for the reader. Use read to process a URL and return its text content, search to search the web, or ground to perform fact checking.
api_keySecretSecret.from_env_var('JINA_API_KEY')The Jina API key.
json_responseboolTrueIf True, requests a JSON response from Jina, resulting in Document objects with rich structured metadata. If False, requests a raw text response, resulting in one Document with minimal metadata.

Run Method Parameters​

These are the parameters you can configure for the component's run() method. This means you can pass these parameters at query time through the API, in Playground, or when running a job. For details, see Modify Pipeline Parameters at Query Time.

ParameterTypeDefaultDescription
querystrThe URL, search term, or statement to process.
headersOptional[Dict[str, str]]NoneOptional headers to include in the request to the Jina Reader API.