Code Monkey home page Code Monkey logo

bedrock-streamlit-example's Introduction

Bedrock Streamlit Example

Bedrock を利用したアプリケーションのプロトタイピングを行うための最低限の実装です。 Streamlit 単体でもセッション(履歴)管理することは可能ですが、本実装する際のことを考慮しデフォルトで DynamoDB を利用するようにしています。

ローカルでの開発

devcontainer を利用することで DynamoDB Local をバックグラウンドで自動起動することができます。

devcontainer を利用しない場合

devcontainer を利用しないが DynamoDB Local を利用したい場合は、下記コマンドで手動で DynamoDB Local を起動してください。

※ この場合、endpoint_urlhttp://localhost:8000 になります。(devcontainer 利用時は http://dynamodb-local:8000

docker-compose -f .devcontainer/docker-compose.yml up dynamodb-local

AWS Credentials

Bedrock API を利用するため、ローカル開発時も AWS の認証情報が必要です。

IAM Identity Center (AWS SSO) を利用する場合

下記コマンドで IAM Identity Center から認証情報を取得してください。

aws configure sso --profile default
aws sso login  # 初回以降

IAM User を利用する場合

下記コマンドで Access Key 等を設定してください。

aws configure --profile default

Run dev server

サンプルコードは AWS SDK (boto3) を利用したものと、Langchain を利用したものの2つを用意しています。

どちらもチャットの一時記憶領域に DynamoDB を使用しています。

streamlit run main.py # use AWS SDK (boto3)

streamlit run chain.py # use Langchain

bedrock-streamlit-example's People

Contributors

mats16 avatar

Watchers

 avatar

Forkers

wildgeece96

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.