Skip to content

Commit

Permalink
Merge pull request #18 from dribia/release/0.2.2
Browse files Browse the repository at this point in the history
Release/0.2.2
  • Loading branch information
airibarne authored Jul 29, 2024
2 parents d82bfbe + 772166a commit 2f6d483
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 63 deletions.
14 changes: 4 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,9 @@ print("\n".join([f"{doc.content}, {doc.meta}" for doc in translated_documents]))

### Haystack Pipeline Integration

> [!TIP]
> To run this example, you'll need to have the `MarkdownToDocument` requirements installed:
> ```shell
> pip install markdown-it-py, mdit-plain
> ```
```python
from haystack import Pipeline
from haystack.components.converters import MarkdownToDocument
from haystack.components.converters import TextFileToDocument
from haystack.components.writers import DocumentWriter
from haystack.dataclasses.byte_stream import ByteStream
from haystack.document_stores.in_memory import InMemoryDocumentStore
Expand All @@ -86,10 +80,10 @@ from deepl_haystack import DeepLDocumentTranslator
document_store = InMemoryDocumentStore()

pipeline = Pipeline()
pipeline.add_component(instance=MarkdownToDocument(), name="converter")
pipeline.add_component(instance=TextFileToDocument(), name="converter")
pipeline.add_component(
instance=DeepLDocumentTranslator(
api_key=Secret.from_token("f9b24fba-2267-463a-97b1-6f211ad6197a:fx"),
api_key=Secret.from_token("your_api_key_here"),
target_lang="ES",
),
name="translator",
Expand All @@ -99,7 +93,7 @@ pipeline.add_component(
)
pipeline.connect("converter", "translator")
pipeline.connect("translator", "document_store")
pipeline.run({"converter": {"sources": [ByteStream.from_string("# Hello world!")]}})
pipeline.run({"converter": {"sources": [ByteStream.from_string("Hello world!")]}})
print(document_store.filter_documents())
# [Document(id=..., content: '¡Hola, mundo!', meta: {'source_lang': 'EN', 'language': 'ES'})]
```
Expand Down
51 changes: 1 addition & 50 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "deepl-haystack"
version = "0.2.1"
version = "0.2.2"
description = "Haystack integration with DeepL translation services provider."
authors = ["Albert Iribarne <iribarne@dribia.com>"]
maintainers = ["Albert Iribarne <iribarne@dribia.com>", "Dribia Data Research <code@dribia.com>"]
Expand Down Expand Up @@ -36,8 +36,6 @@ mypy = "1.11.0"

[tool.poetry.group.dev.dependencies]
pre-commit = "^3.7.1"
markdown-it-py = "^3.0.0"
mdit-plain = "^1.0.1"

[tool.ruff]

Expand Down

0 comments on commit 2f6d483

Please sign in to comment.