quiltdata / quilt

Quilt is a data mesh for connecting people with actionable data
https://quiltdata.com
Apache License 2.0
1.32k stars 91 forks source link

Qurator AI Assistant for summarizing file contents using Bedrock API #3989

Closed fiskus closed 2 months ago

fiskus commented 3 months ago

simplescreenrecorder-2024-05-30_19.12.19.webm

New section on the File page that utilizes Bedrock#invokeModel with pre-filled first prompt a la "summarize content of this file." Users can then ask additional questions, with the entire history, except the first prompt, visible to them.

The component uses lazy loading, becoming available only after the JavaScript, content and Bedrock response are fully loaded. I use content indexed by ElasticSearch as a content, so we can work with binary data

To facilitate testing, I refactored the Bedrock hook into multiple files: the hook in one file, Message and History in other files accompanied by .spec.ts files.

Recommended starting points for reading code: Bucket/File.tsx, PackageTree.tsx.

codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 20.83333% with 209 lines in your changes missing coverage. Please review.

Project coverage is 37.21%. Comparing base (15fcd5a) to head (f0708eb).

Files Patch % Lines
catalog/app/containers/Bucket/Qurator/Summary.tsx 0.00% 71 Missing :warning:
catalog/app/utils/AWS/Bedrock/Bedrock.ts 0.00% 32 Missing :warning:
catalog/app/components/Chat/Chat.tsx 0.00% 27 Missing :warning:
catalog/app/components/Chat/History.tsx 0.00% 25 Missing :warning:
catalog/app/components/Chat/Input.tsx 0.00% 16 Missing :warning:
catalog/app/components/Chat/Message.tsx 0.00% 16 Missing :warning:
catalog/app/containers/Bucket/Qurator/Section.tsx 0.00% 9 Missing :warning:
catalog/app/components/Chat/index.ts 0.00% 3 Missing :warning:
catalog/app/containers/Bucket/File.js 0.00% 3 Missing :warning:
.../app/containers/Bucket/PackageTree/PackageTree.tsx 0.00% 3 Missing :warning:
... and 2 more
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #3989 +/- ## ========================================== - Coverage 37.33% 37.21% -0.13% ========================================== Files 758 769 +11 Lines 33321 33585 +264 Branches 4731 4780 +49 ========================================== + Hits 12442 12497 +55 - Misses 20235 20444 +209 Partials 644 644 ``` | [Flag](https://app.codecov.io/gh/quiltdata/quilt/pull/3989/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=quiltdata) | Coverage Δ | | |---|---|---| | [api-python](https://app.codecov.io/gh/quiltdata/quilt/pull/3989/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=quiltdata) | `90.75% <ø> (ø)` | | | [catalog](https://app.codecov.io/gh/quiltdata/quilt/pull/3989/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=quiltdata) | `11.12% <20.83%> (+0.11%)` | :arrow_up: | | [lambda](https://app.codecov.io/gh/quiltdata/quilt/pull/3989/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=quiltdata) | `88.18% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=quiltdata#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.