Skip to content

Commit

Permalink
replace text with content (#7211)
Browse files Browse the repository at this point in the history
  • Loading branch information
anakin87 committed Feb 28, 2024
1 parent f9db75c commit 380052a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions haystack/components/rankers/meta_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ class MetaFieldRanker:
ranker = MetaFieldRanker(meta_field="rating")
docs = [
Document(text="Paris", meta={"rating": 1.3}),
Document(text="Berlin", meta={"rating": 0.7}),
Document(text="Barcelona", meta={"rating": 2.1}),
Document(content="Paris", meta={"rating": 1.3}),
Document(content="Berlin", meta={"rating": 0.7}),
Document(content="Barcelona", meta={"rating": 2.1}),
]
output = ranker.run(documents=docs)
docs = output["documents"]
assert docs[0].text == "Barcelona"
assert docs[0].content == "Barcelona"
"""

def __init__(
Expand Down
6 changes: 3 additions & 3 deletions haystack/components/samplers/top_p.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ class TopPSampler:
sampler = TopPSampler(top_p=0.95, score_field="similarity_score")
docs = [
Document(text="Berlin", meta={"similarity_score": -10.6}),
Document(text="Belgrade", meta={"similarity_score": -8.9}),
Document(text="Sarajevo", meta={"similarity_score": -4.6}),
Document(content="Berlin", meta={"similarity_score": -10.6}),
Document(content="Belgrade", meta={"similarity_score": -8.9}),
Document(content="Sarajevo", meta={"similarity_score": -4.6}),
]
output = sampler.run(documents=docs)
docs = output["documents"]
Expand Down
4 changes: 2 additions & 2 deletions haystack/testing/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def document_store_class(
Create a DocumentStore class that returns a single document:
```python
doc = Document(id="fake_id", text="Fake content")
doc = Document(id="fake_id", content="Fake content")
MyFakeStore = document_store_class("MyFakeComponent", documents=[doc])
document_store = MyFakeStore()
assert document_store.documents_count() == 1
Expand All @@ -52,7 +52,7 @@ def document_store_class(
Create a DocumentStore class that returns a document and a custom count:
```python
doc = Document(id="fake_id", text="Fake content")
doc = Document(id="fake_id", content="Fake content")
MyFakeStore = document_store_class("MyFakeComponent", documents=[doc], documents_count=100)
document_store = MyFakeStore()
assert document_store.documents_count() == 100
Expand Down

0 comments on commit 380052a

Please sign in to comment.