Skip to content

Commit

Permalink
update jina page - new secrets management (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
anakin87 authored Feb 14, 2024
1 parent 9192266 commit 5cf4069
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion integrations/jina.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,14 @@ set the environment variable JINA_API_KEY instead of passing the api key as an a
Below is the example indexing pipeline with `InMemoryDocumentStore`, `JinaDocumentEmbedder` and `DocumentWriter`:

```python
import os
from haystack import Document, Pipeline
from haystack.document_stores.in_memory import InMemoryDocumentStore
from haystack.components.writers import DocumentWriter
from haystack_integrations.components.embedders.jina import JinaDocumentEmbedder

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

document_store = InMemoryDocumentStore(embedding_similarity_function="cosine")

documents = [Document(content="I enjoy programming in Python"),
Expand All @@ -66,7 +69,7 @@ documents = [Document(content="I enjoy programming in Python"),
Document(content="Thomas is injured and can't play sports")]

indexing_pipeline = Pipeline()
indexing_pipeline.add_component("embedder", JinaDocumentEmbedder(api_key="JINA_API_KEY", model="jina-embeddings-v2-base-en"))
indexing_pipeline.add_component("embedder", JinaDocumentEmbedder(model="jina-embeddings-v2-base-en"))
indexing_pipeline.add_component("writer", DocumentWriter(document_store=document_store))
indexing_pipeline.connect("embedder", "writer")

Expand Down

0 comments on commit 5cf4069

Please sign in to comment.