langchain/libs/community/langchain_community
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
..
adapters docs: added community modules descriptions (#17827) 2024-02-21 16:18:36 -08:00
agent_toolkits multiple: langchain 0.2 in master (#21191) 2024-05-08 16:46:52 -04:00
callbacks community: callbacks guard_imports (#21173) 2024-05-07 15:04:54 -07:00
chains multiple: langchain 0.2 in master (#21191) 2024-05-08 16:46:52 -04:00
chat_loaders (all): update removal in deprecation warnings from 0.2 to 0.3 (#21265) 2024-05-03 14:29:36 -04:00
chat_message_histories community[patch]: chat message history mypy fixes #17048 (#20114) 2024-05-06 22:17:45 +00:00
chat_models community: add bind_tools and with_structured_output support to QianfanChatEndpoint (#21412) 2024-05-08 11:35:10 -04:00
cross_encoders multiple: langchain 0.2 in master (#21191) 2024-05-08 16:46:52 -04:00
docstore multiple: Remove unnecessary Ruff suppression comments (#21050) 2024-04-30 17:13:48 +00:00
document_compressors multiple: Remove unnecessary Ruff suppression comments (#21050) 2024-04-30 17:13:48 +00:00
document_loaders community: Add arguments to whisper parser (#20378) 2024-05-08 17:53:13 -07:00
document_transformers community: Add MarkdownifyTransformer to langchain_community.document_transformers (#21247) 2024-05-08 14:45:13 -07:00
embeddings [community][fix](DeepInfraEmbeddings): Implement chunking for large batches (#21189) 2024-05-08 14:45:42 -07:00
example_selectors docs: added community modules descriptions (#17827) 2024-02-21 16:18:36 -08:00
graphs Add indexed properties to neo4j enhanced schema (#21335) 2024-05-06 14:28:34 -07:00
indexes community[patch]: Make sql record manager fully compatible with async (#20735) 2024-05-08 17:31:11 -04:00
llms community: minor changes sambanova integration (#21231) 2024-05-06 13:28:35 -07:00
memory langchain[patch],community[minor]: Migrate memory implementations to community (#20845) 2024-05-02 10:46:50 -04:00
output_parsers langchain[patch], community[minor]: move output_parsers.ernie_functions (#16057) 2024-01-17 10:06:18 -08:00
query_constructors multiple: langchain 0.2 in master (#21191) 2024-05-08 16:46:52 -04:00
retrievers Add source metadata to bedrock retriever response (#21349) 2024-05-09 11:06:22 -04:00
storage (all): update removal in deprecation warnings from 0.2 to 0.3 (#21265) 2024-05-03 14:29:36 -04:00
tools bugfix(community): fix Playwright import paths. (#21395) 2024-05-08 14:20:25 -07:00
utilities [Community][Minor]: Fetch loader_source of GoogleDriveLoader in PebbloSafeLoader. (#21314) 2024-05-07 14:45:58 -07:00
utils community[patch]: docstrings update (#20301) 2024-04-11 16:23:27 -04:00
vectorstores Ndb enterprise (#21233) 2024-05-08 16:30:58 -07:00
__init__.py community[major], core[patch], langchain[patch], experimental[patch]: Create langchain-community (#14463) 2023-12-11 13:53:30 -08:00
cache.py (all): update removal in deprecation warnings from 0.2 to 0.3 (#21265) 2024-05-03 14:29:36 -04:00
py.typed community[major], core[patch], langchain[patch], experimental[patch]: Create langchain-community (#14463) 2023-12-11 13:53:30 -08:00