Lab #1: One Shot Chat with Document with AWS Bedrock
One Shot Chat with Document in AWS Bedrock

Lab #1: One Shot Chat with Document with AWS Bedrock

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

https://github.com/luiscarlosjayk/luisk-genai-labs

Statements

  1. Easily reproducible: I will be using AWS CDK to define infrastructure.
  2. Small enough: Shouldn't grow beyond what we want to prove for the experiment.
  3. Friendly: Should have well described guidelines for others to follow.
  4. Fun: Should be fun for others to engage and play around.


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

Infrastructure Diagram

Lab Folder

This is the specific directory of the first lab:

https://github.com/luiscarlosjayk/luisk-genai-labs/tree/main/labs/zero-shot-chat-with-document

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

要查看或添加评论,请登录

Luis Carlos Osorio Jayk的更多文章

  • AI Agents with Function Calling

    AI Agents with Function Calling

    Contributors: Luis Carlos Osorio Jayk Repository: Agent Function Calling Lab Context In this lab we will build an AI…

    3 条评论
  • Oxidizing AWS Lambda Functions with Rust

    Oxidizing AWS Lambda Functions with Rust

    In this article I'm sharing results of benchmarking lambda functions written in most popular programming languages like…

    2 条评论
  • AWS CDK Constructs with Builder Pattern

    AWS CDK Constructs with Builder Pattern

    Github repository https://github.com/luiscarlosjayk/cdk-with-builder-pattern The AWS Cloud Development Kit (CDK) is an…

    4 条评论