You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
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>
5 months ago
..
adapters docs: added `community` modules descriptions (#17827) 7 months ago
agent_toolkits multiple: langchain 0.2 in master (#21191) 5 months ago
callbacks community: `callbacks` guard_imports (#21173) 5 months ago
chains multiple: langchain 0.2 in master (#21191) 5 months ago
chat_loaders (all): update removal in deprecation warnings from 0.2 to 0.3 (#21265) 5 months ago
chat_message_histories community[patch]: chat message history mypy fixes #17048 (#20114) 5 months ago
chat_models community: add `bind_tools` and `with_structured_output` support to `QianfanChatEndpoint` (#21412) 5 months ago
cross_encoders multiple: langchain 0.2 in master (#21191) 5 months ago
docstore multiple: Remove unnecessary Ruff suppression comments (#21050) 5 months ago
document_compressors multiple: Remove unnecessary Ruff suppression comments (#21050) 5 months ago
document_loaders community: Add arguments to whisper parser (#20378) 5 months ago
document_transformers community: Add MarkdownifyTransformer to langchain_community.document_transformers (#21247) 5 months ago
embeddings [community][fix](DeepInfraEmbeddings): Implement chunking for large batches (#21189) 5 months ago
example_selectors docs: added `community` modules descriptions (#17827) 7 months ago
graphs Add indexed properties to neo4j enhanced schema (#21335) 5 months ago
indexes community[patch]: Make sql record manager fully compatible with async (#20735) 5 months ago
llms community: minor changes sambanova integration (#21231) 5 months ago
memory langchain[patch],community[minor]: Migrate memory implementations to community (#20845) 5 months ago
output_parsers langchain[patch], community[minor]: move `output_parsers.ernie_functions` (#16057) 8 months ago
query_constructors multiple: langchain 0.2 in master (#21191) 5 months ago
retrievers Add source metadata to bedrock retriever response (#21349) 5 months ago
storage (all): update removal in deprecation warnings from 0.2 to 0.3 (#21265) 5 months ago
tools bugfix(community): fix Playwright import paths. (#21395) 5 months ago
utilities [Community][Minor]: Fetch loader_source of GoogleDriveLoader in PebbloSafeLoader. (#21314) 5 months ago
utils community[patch]: docstrings update (#20301) 5 months ago
vectorstores Ndb enterprise (#21233) 5 months ago
__init__.py community[major], core[patch], langchain[patch], experimental[patch]: Create langchain-community (#14463) 10 months ago
cache.py (all): update removal in deprecation warnings from 0.2 to 0.3 (#21265) 5 months ago
py.typed community[major], core[patch], langchain[patch], experimental[patch]: Create langchain-community (#14463) 10 months ago