Skip to content

Commit

Permalink
Merge branch 'main' into amazonbedrock-chatgenerator-docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
agnieszka-m authored Aug 6, 2024
2 parents 9e8de8f + 5be0bf7 commit 0826c2f
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 16 deletions.
27 changes: 27 additions & 0 deletions integrations/amazon_sagemaker/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Changelog

## [unreleased]

### 🚀 Features

- Sagemaker integration: `SagemakerGenerator` (#276)

### 🐛 Bug Fixes

- Fix order of API docs (#447)

This PR will also push the docs to Readme

### 📚 Documentation

- Update category slug (#442)
- Small consistency improvements (#536)
- Review integrations sagemaker (#544)
- Disable-class-def (#556)

### ⚙️ Miscellaneous Tasks

- Retry tests to reduce flakyness (#836)
- Update ruff invocation to include check parameter (#853)

<!-- generated by git-cliff -->
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
@component
class OpenSearchEmbeddingRetriever:
"""
Uses a vector similarity metric to retrieve documents from the OpenSearchDocumentStore.
Retrieves documents from the OpenSearchDocumentStore using a vector similarity metric.
Needs to be connected to the OpenSearchDocumentStore to run.
Must be connected to the OpenSearchDocumentStore to run.
"""

def __init__(
Expand All @@ -34,12 +34,16 @@ def __init__(
"""
Create the OpenSearchEmbeddingRetriever component.
:param document_store: An instance of OpenSearchDocumentStore.
:param filters: Filters applied to the retrieved Documents. Defaults to None.
Filters are applied during the approximate kNN search to ensure that top_k matching documents are returned.
:param top_k: Maximum number of Documents to return, defaults to 10
:param filter_policy: Policy to determine how filters are applied.
:param custom_query: The query containing a mandatory `$query_embedding` and an optional `$filters` placeholder
:param document_store: An instance of OpenSearchDocumentStore to use with the Retriever.
:param filters: Filters applied when fetching documents from the Document Store.
Filters are applied during the approximate kNN search to ensure the Retriever returns
`top_k` matching documents.
:param top_k: Maximum number of documents to return.
:param filter_policy: Policy to determine how filters are applied. Possible options:
- `merge`: Runtime filters are merged with initialization filters.
- `replace`: Runtime filters replace initialization filters. Use this policy to change the filtering scope.
:param custom_query: The custom OpenSearch query containing a mandatory `$query_embedding` and
an optional `$filters` placeholder.
**An example custom_query:**
Expand All @@ -63,14 +67,15 @@ def __init__(
}
```
**For this custom_query, a sample `run()` could be:**
For this `custom_query`, an example `run()` could be:
```python
retriever.run(query_embedding=embedding,
filters={"years": ["2019"], "quarters": ["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.
If `True`, raises an exception if the API call fails.
If `False`, logs a warning and returns an empty list.
:raises ValueError: If `document_store` is not an instance of OpenSearchDocumentStore.
"""
Expand Down Expand Up @@ -137,11 +142,13 @@ def run(
Retrieve documents using a vector similarity metric.
:param query_embedding: Embedding of the query.
:param filters: Filters applied to the retrieved Documents. The way runtime filters are applied depends on
the `filter_policy` chosen at retriever initialization. See init method docstring for more
details.
:param top_k: Maximum number of Documents to return.
:param custom_query: The query containing a mandatory `$query_embedding` and an optional `$filters` placeholder
:param filters: Filters applied when fetching documents from the Document Store.
Filters are applied during the approximate kNN search to ensure the Retriever
returns `top_k` matching documents.
The way runtime filters are applied depends on the `filter_policy` selected when initializing the Retriever.
:param top_k: Maximum number of documents to return.
:param custom_query: A custom OpenSearch query containing a mandatory `$query_embedding` and an
optional `$filters` placeholder.
**An example custom_query:**
Expand All @@ -165,7 +172,7 @@ def run(
}
```
**For this custom_query, a sample `run()` could be:**
For this `custom_query`, an example `run()` could be:
```python
retriever.run(query_embedding=embedding,
Expand Down

0 comments on commit 0826c2f

Please sign in to comment.