langchain/libs/community/langchain_community/retrievers
Renu Rozera 4035a1d234
Add source metadata to bedrock retriever response (#21349)
Thank you for contributing to LangChain!

- [X] **PR title**: "community: Add source metadata to bedrock retriever
response"

- [X] **PR message**: 
- **Description:** Bedrock retrieve API returns extra metadata in the
response which is currently not returned in the retriever response
- **Issue:** The change adds the metadata from bedrock retrieve API
response to the bedrock retriever in a backward compatible way. Renamed
metadata to sourceMetadata as metadata term is being used in the
Document already. This is in sync with what we are doing in llama-index
as well.
    - **Dependencies:** No


- [X] **Add tests and docs**:
  1. Added unit tests
  2. Notebook already exists and does not need any change
3. Response from end to end testing, just to ensure backward
compatibility: `[Document(page_content='Exoplanets.',
metadata={'location': {'s3Location': {'uri':
's3://bucket/file_name.txt'}, 'type': 'S3'}, 'score': 0.46886647,
'source_metadata': {'x-amz-bedrock-kb-source-uri':
's3://bucket/file_name.txt', 'tag': 'space', 'team': 'Nasa', 'year':
1946.0}})]`


- [X] **Lint and test**: Run `make format`, `make lint` and `make test`
from the root of the package(s) you've modified. See contribution
guidelines for more: https://python.langchain.com/docs/contributing/

Additional guidelines:
- Make sure optional dependencies are imported within a function.
- Please do not add dependencies to pyproject.toml files (even optional
ones) unless they are required for unit tests.
- Most PRs should not touch more than one package.
- Changes should be backwards compatible.
- If you are adding something to community, do not re-import it in
langchain.

If no one reviews your PR within a few days, please @-mention one of
baskaryan, efriis, eyurtsev, hwchase17.

---------

Co-authored-by: Piyush Jain <piyushjain@duck.com>
2024-05-09 11:06:22 -04:00
..
__init__.py multiple: langchain 0.2 in master (#21191) 2024-05-08 16:46:52 -04:00
arcee.py patch: deprecate (a)get_relevant_documents (#20477) 2024-04-22 11:14:53 -04:00
arxiv.py
azure_ai_search.py Community: Updating Azure Retriever and Docs to be Azure AI Search instead of Azure Cognitive Search (#19925) 2024-04-08 11:12:41 -04:00
bedrock.py Add source metadata to bedrock retriever response (#21349) 2024-05-09 11:06:22 -04:00
bm25.py
breebs.py
chaindesk.py
chatgpt_plugin_retriever.py
cohere_rag_retriever.py (all): update removal in deprecation warnings from 0.2 to 0.3 (#21265) 2024-05-03 14:29:36 -04:00
databerry.py
docarray.py
dria_index.py community[minor]: Add Dria retriever (#17098) 2024-04-01 12:04:19 -07:00
elastic_search_bm25.py community[minor]: import fix (#20995) 2024-04-29 10:32:50 -04:00
embedchain.py
google_cloud_documentai_warehouse.py (all): update removal in deprecation warnings from 0.2 to 0.3 (#21265) 2024-05-03 14:29:36 -04:00
google_vertex_ai_search.py (all): update removal in deprecation warnings from 0.2 to 0.3 (#21265) 2024-05-03 14:29:36 -04:00
kay.py
kendra.py community: add Kendra DocumentRelevanceOverrideConfigurations request parameter (#20695) 2024-05-06 14:26:36 -07:00
knn.py community[patch]: Added missing from_documents method to KNNRetriever. (#18411) 2024-03-28 23:18:50 +00:00
llama_index.py
metal.py
milvus.py patch: deprecate (a)get_relevant_documents (#20477) 2024-04-22 11:14:53 -04:00
outline.py
pinecone_hybrid_search.py community[major], core[patch], langchain[patch], experimental[patch]: Create langchain-community (#14463) 2023-12-11 13:53:30 -08:00
pubmed.py
pupmed.py
qdrant_sparse_vector_retriever.py
rememberizer.py community[minor]: Rememberizer retriever (#20052) 2024-05-01 10:41:44 -04:00
remote_retriever.py
svm.py
tavily_search_api.py
tfidf.py docs: remove repetitive words (#21058) 2024-05-01 01:10:42 +00:00
thirdai_neuraldb.py community[minor]: import fix (#20995) 2024-04-29 10:32:50 -04:00
vespa_retriever.py
weaviate_hybrid_search.py
web_research.py multiple: langchain 0.2 in master (#21191) 2024-05-08 16:46:52 -04:00
wikipedia.py
you.py community[patch]: docstrings update (#20301) 2024-04-11 16:23:27 -04:00
zep.py
zilliz.py patch: deprecate (a)get_relevant_documents (#20477) 2024-04-22 11:14:53 -04:00