Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add source metadata from API response to Document metadata #40

Merged
merged 2 commits into from
May 8, 2024

Conversation

rozerarenu
Copy link
Contributor

Corresponding PR in langchain: langchain-ai/langchain#21349

  • PR title: "community: Add source metadata to bedrock retriever response"

  • 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
  • Add tests and docs:

    1. Added unit tests
    2. Notebook already exists and does not need any change
    3. Updated and ran integration tests
    4. 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}})]
  • 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/

@3coins 3coins merged commit 4b2761e into langchain-ai:main May 8, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants