Lab #1: One Shot Chat with Document with AWS Bedrock
Luis Carlos Osorio Jayk
Staff Software Engineer | Skilled on Node.js, AWS, Rust, HTML+CSS+Js, PostgreSQL and more
Hi team,
this time I'm glad to tell I'm starting a personal project where I will be sharing small experiments on top of AWS services, taking approach of AWS Bedrock capabilities.
Since this is the first experiment, I'm also starting the baselines and initial setup of the repository and folder structure, which could change to adapt it to needs I might find later.
Repository
Statements
First Lab: One Shot Chat with Document with AWS Bedrock
First lab is about to be able to chat effortlessly with documents uploaded to a S3 bucket without having to setup a vector store for embeddings.
More complex solutions usually involve having a vector store with OpenSearch, Redis, PostgreSQL with PgVector, Neo4j, or any other storage solution to save the embeddings generated by an embedding model.
But that could be overkill for simple solutions when users only need to be able to perform questions against a document, perhaps for businesses to make use of their enterprise data.
In the code example, we're asking to the foundational model Claude-3-Sonnet to summarize documents uploaded to a S3 bucket.
The S3 bucket is configured as an event source for a lambda function written in Rust to trigger it whenever a file is uploaded to it.
And using the RetrieveAndGenerate action with S3 configured as an external source.
For example, if we upload the MRKL Systems paper file from the assets/documents folder, the response in logs obtained was:
The paper introduces the concept of Modular Reasoning, Knowledge and Language (MRKL) systems, which combine large language models with external knowledge and reasoning modules to overcome the limitations of language models alone. It describes AI21 Labs' implementation of a MRKL system called Jurassic-X and discusses the technical challenges involved, with a focus on how Jurassic-X was trained to handle basic arithmetic operations reliably.
The prompt used was pretty simple:
Summarize in few sentences the given document.
Infrastructure
Lab Folder
This is the specific directory of the first lab:
Next Steps
I will be adding more labs to the codebase, and please, take this also as a open invitation to join along to experiment together, or to bring ideas of experiments you would like to see, or if you want these to become some talks or workshops to be given within your team.
Just, share your thoughts, I'll appreciate.
-- LuisK