Skip to content

Commit

Permalink
docs: Update opensearch retriever docstrings (#1035)
Browse files Browse the repository at this point in the history
* docs: Update OpenSearchBM25Retriever metadata filter syntax

* docs: Update OpenSearchEmbeddingRetriever metadata filter syntax
  • Loading branch information
kanenorman authored and Amnah199 committed Oct 2, 2024
1 parent 950505e commit b991acc
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,16 @@ def __init__(
An example `run()` method for this `custom_query`:
```python
retriever.run(query="Why did the revenue increase?",
filters={"years": ["2019"], "quarters": ["Q1", "Q2"]})
retriever.run(
query="Why did the revenue increase?",
filters={
"operator": "AND",
"conditions": [
{"field": "meta.years", "operator": "==", "value": "2019"},
{"field": "meta.quarters", "operator": "in", "value": ["Q1", "Q2"]},
],
},
)
```
:param raise_on_failure:
Whether to raise an exception if the API call fails. Otherwise log a warning and return an empty list.
Expand Down Expand Up @@ -184,8 +192,16 @@ def run(
**For this custom_query, a sample `run()` could be:**
```python
retriever.run(query="Why did the revenue increase?",
filters={"years": ["2019"], "quarters": ["Q1", "Q2"]})
retriever.run(
query="Why did the revenue increase?",
filters={
"operator": "AND",
"conditions": [
{"field": "meta.years", "operator": "==", "value": "2019"},
{"field": "meta.quarters", "operator": "in", "value": ["Q1", "Q2"]},
],
},
)
```
:returns:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,16 @@ def __init__(
For this `custom_query`, an example `run()` could be:
```python
retriever.run(query_embedding=embedding,
filters={"years": ["2019"], "quarters": ["Q1", "Q2"]})
retriever.run(
query_embedding=embedding,
filters={
"operator": "AND",
"conditions": [
{"field": "meta.years", "operator": "==", "value": "2019"},
{"field": "meta.quarters", "operator": "in", "value": ["Q1", "Q2"]},
],
},
)
```
:param raise_on_failure:
If `True`, raises an exception if the API call fails.
Expand Down Expand Up @@ -176,8 +184,16 @@ def run(
For this `custom_query`, an example `run()` could be:
```python
retriever.run(query_embedding=embedding,
filters={"years": ["2019"], "quarters": ["Q1", "Q2"]})
retriever.run(
query_embedding=embedding,
filters={
"operator": "AND",
"conditions": [
{"field": "meta.years", "operator": "==", "value": "2019"},
{"field": "meta.quarters", "operator": "in", "value": ["Q1", "Q2"]},
],
},
)
```
:returns:
Expand Down

0 comments on commit b991acc

Please sign in to comment.