Skip to content

Commit

Permalink
attending PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsbatista committed Mar 4, 2024
1 parent 4e3b8f1 commit 56f302e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,24 @@ class GradientDocumentEmbedder:
Usage example:
```python
from haystack_integrations.components.embedders.gradient import GradientDocumentEmbedder
from haystack.components.retrievers.in_memory import InMemoryEmbeddingRetriever
from haystack import Pipeline
embedder = GradientDocumentEmbedder(model="bge_large")
documents = [
Document(content="My name is Jean and I live in Paris."),
Document(content="My name is Mark and I live in Berlin."),
Document(content="My name is Giorgio and I live in Rome."),
]
p = Pipeline()
p.add_component(embedder, name="document_embedder")
p.add_component(instance=GradientDocumentEmbedder(
p.add_component(instance=GradientDocumentEmbedder(), name="document_embedder")
p.add_component(instance=DocumentWriter(document_store=InMemoryDocumentStore()), name="document_writer")
p.connect("document_embedder", "document_writer")
p.run({"document_embedder": {"documents": documents}})
p.run(data={"document_embedder": {"documents": documents}})
```
"""

Expand Down Expand Up @@ -141,7 +152,7 @@ def run(self, documents: List[Document]):
:param documents: A list of Documents to embed.
:returns:
A dictionary with the following keys:
- documents: The embedded Documents.
- `documents`: The embedded Documents.
"""
if not isinstance(documents, list) or documents and any(not isinstance(doc, Document) for doc in documents):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ class GradientTextEmbedder:
Usage example:
```python
from haystack_integrations.components.embedders.gradient import GradientTextEmbedder
from haystack.components.retrievers.in_memory import InMemoryEmbeddingRetriever
from haystack import Pipeline
embedder = GradientTextEmbedder(model="bge_large")
p = Pipeline()
p.add_component(instance=embedder, name="text_embedder")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class GradientGenerator:
Usage example:
```python
from haystack_integrations.components.generators.gradient import GradientGenerator
llm = GradientGenerator(base_model_slug="llama2-7b-chat")
llm.warm_up()
print(llm.run(prompt="What is the meaning of life?"))
Expand Down

0 comments on commit 56f302e

Please sign in to comment.