From 380f441a34fe85275556b7acc97148f26419e3f0 Mon Sep 17 00:00:00 2001 From: jlonge4 <91354480+jlonge4@users.noreply.github.com> Date: Mon, 25 Nov 2024 05:45:42 -0500 Subject: [PATCH] add reader connector mention to readme (#288) * add reader connector mention * small improvements --------- Co-authored-by: anakin87 --- integrations/jina.md | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/integrations/jina.md b/integrations/jina.md index cf29e208..890314c4 100644 --- a/integrations/jina.md +++ b/integrations/jina.md @@ -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: @@ -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 @@ -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) @@ -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). \ No newline at end of file