Skip to content

Commit

Permalink
add reader connector mention to readme (#288)
Browse files Browse the repository at this point in the history
* add reader connector mention

* small improvements

---------

Co-authored-by: anakin87 <[email protected]>
  • Loading branch information
jlonge4 and anakin87 authored Nov 25, 2024
1 parent 7f4526f commit 380f441
Showing 1 changed file with 37 additions and 2 deletions.
39 changes: 37 additions & 2 deletions integrations/jina.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ version: Haystack 2.0
toc: true
---

This integration allows users of Haystack to seamlessly use Jina AI's`jina-embeddings`and [reranking models](https://jina.ai/reranker/) in their pipelines. [Jina AI](https://jina.ai/embeddings/) is a multimodal AI company, with a vision to revolutionize the way we interpret and interact with information with its prompt and model technologies.
This integration allows users of Haystack to seamlessly use Jina AI's`jina-embeddings`and [reranking models](https://jina.ai/reranker/) in their pipelines. Haystack also integrates the [Jina Reader API](https://jina.ai/reader/).

[Jina AI](https://jina.ai/embeddings/) is a multimodal AI company, with a vision to revolutionize the way we interpret and interact with information with its prompt and model technologies.

Jina AI offers several models so people can use and chose whatever fits best to their needs:

Expand Down Expand Up @@ -64,10 +66,12 @@ You can reference the table below for hints on dimension vs. performance:
- [Haystack 2.0](#haystack-20)
- [Installation](#installation)
- [Usage](#usage)
- [Embedding Models](#embedding-models)
- [Jina Reader API](#jina-reader-api)

## Haystack 2.0

You can use [Jina embedding Models](https://jina.ai/embeddings) and [Jina Rerankers](https://jina.ai/reranker/) in your Haystack 2.0 pipelines with the Jina [Embedders](https://docs.haystack.deepset.ai/docs/embedders) and Jina [Rankers](https://docs.haystack.deepset.ai/docs/rankers)
You can use [Jina embedding Models](https://jina.ai/embeddings) and [Jina Rerankers](https://jina.ai/reranker/) in your Haystack 2.0 pipelines with the Jina [Embedders](https://docs.haystack.deepset.ai/docs/embedders) and Jina [Ranker](https://docs.haystack.deepset.ai/docs/jinaranker)

### Installation

Expand All @@ -77,6 +81,8 @@ pip install jina-haystack

### Usage

#### Embedding Models

You can use Jina Embedding models with two components: [`JinaTextEmbedder`](https://docs.haystack.deepset.ai/docs/jinatextembedder) and [`JinaDocumentEmbedder`](https://docs.haystack.deepset.ai/docs/jinadocumentembedder).

You can use the Jina Reranker models with one component: [`JinaRanker`](https://docs.haystack.deepset.ai/docs/jinaranker)
Expand Down Expand Up @@ -118,3 +124,32 @@ indexing_pipeline.connect("embedder", "writer")

indexing_pipeline.run({"embedder": {"documents": documents}})
```

#### Jina Reader API

The Jina Reader API converts a URL/query into a LLM-friendly format.
It supports three modes of operation:
- `read`: process a URL and return the textual content of the page.
- `search`: search the web and return textual content of the most relevant pages.
- `ground`: call the grounding engine to perform fact checking.

In Haystack, you can use the Jina Reader API with the [`JinaReaderConnector`](https://docs.haystack.deepset.ai/reference/integrations-jina#jinareaderconnector) component.

Below is an example of using the `JinaReaderConnector` in `read` mode:

```python
import os
from haystack_integrations.components.connectors.jina import JinaReaderConnector

os.environ["JINA_API_KEY"]="your-jina-api-key"

reader = JinaReaderConnector(mode="read")
query = "https://example.com"
result = reader.run(query=query)
document = result["documents"][0]
print(document.content)

>>> "This domain is for use in illustrative examples..."
```

You can find more examples [here](https://github.com/deepset-ai/haystack-core-integrations/blob/main/integrations/jina/examples/jina_reader_connector.py).

0 comments on commit 380f441

Please sign in to comment.