https://github.com/awslabs/genai-labs-energy-pricing-assistant

This demonstration showcases an AI assistant designed for gas station pricing analysts.

https://github.com/awslabs/genai-labs-energy-pricing-assistant

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.5%) to scientific vocabulary

Keywords

amazon-bedrock amazon-nova claude genai-labs
Last synced: 9 months ago · JSON representation

Repository

This demonstration showcases an AI assistant designed for gas station pricing analysts.

Basic Info
  • Host: GitHub
  • Owner: awslabs
  • License: apache-2.0
  • Language: TypeScript
  • Default Branch: main
  • Homepage:
  • Size: 3.23 MB
Statistics
  • Stars: 5
  • Watchers: 6
  • Forks: 1
  • Open Issues: 1
  • Releases: 0
Topics
amazon-bedrock amazon-nova claude genai-labs
Created over 1 year ago · Last pushed about 1 year ago
Metadata Files
Readme Contributing License Code of conduct

README.md

Energy Pricing Assistant

Overview

This demonstration showcases an AI assistant designed for gas station pricing analysts. The assistant can gather and analyze data from diverse sources, such as weather patterns, traffic conditions, historical pricing strategies, and competitor actions. By leveraging this information, analysts can significantly accelerate the process of estimating pricing updates and uncover valuable insights that may inform decision-making.

1. Bedrock Flows

Near realtime data sources are queried on demand through Bedrock Flows. Bedrock Flows enables analysts to ask for fuel price estimates using several data sources from dynamodb or potentially other sources or vendor APIs like weather and traffic. With context gathered through this flow, a prompt is constructed for Amazon Nova Lite v1 via Bedrock to provide a fuel price estimate and supporting evidence. Anthropic Claude Haiku v3 is also utilized in generating a response to results retrieved from the Bedrock Knowledge Base.

bedrock flows

2. RAG Knowledge Base

The RAG knowledge base leverages the Knowledge Bases for Amazon Bedrock and its metadata filter feature, allowing for more granular search on pricing data based on metadata like location and other relevant attributes. This knowledge base stores and organizes the ingested strategy data in a way that supports efficient retrieval and generation of information based on the RAG model, while enabling users to slice and dice the data according to their specific needs.

3. Runtime Chatbot

The runtime chatbot is a React-based website that uses a WebSocket API and a Lambda function architecture. The conversation history is stored in DynamoDB. The Lambda function uses the Amazon Bedrock Converse API to reason and retrieve relevant documents from the knowledge base, providing the final answer to users in training scenarios for fuel pricing analysts.

End-to-end Architecture

e2e architecture

Demo Script

The demo script, use case, and persona is provided here: Demo Script

Setup

Pre-requisites

  1. The solution is only available in us-east-1. Please choose either of them to proceed.
  2. Enable models in Amazon Bedrock: for this use case, you need to enable Amazon Nova Lite v1, Anthropic Claude Haiku v3, Titan Text G1 - Premier, and Titan Embeddings G1 - Text
  3. Get started with CDK.
  4. Install Docker. Because we are bundling Lambda functions when running CDK so we need to install Docker. Please see the blog post about Building, bundling and deploying applications with the AWS CDK

Run CDK

  1. Clone this repository.
  2. Export AWS_DEFAULT_REGION to us-east-1 region following the CDK cli guide. export AWS_DEFAULT_REGION=us-east-1
  3. Install npm modules cd cdk-stacks npm install
  4. CDK bootstrap cdk bootstrap
  5. At this point you can now synthesize the CloudFormation template for this code. aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws cdk synth
  6. Deploy the application cdk deploy --all --require-approval never --parameters EnergyPricingAssistantAgentStack ### Trigger the data simulation
  7. Sync Bedrock Knowledgebase

a. Open AWS Bedrock console. Knowledge base -> EnergyPricingAssistant.

b. Click sync KB data souce sync

  1. Trigger the data simulation for initial use:

a. Open AWS Lambda console. Find the Lambda function that looks like this EnergyPricingAssistantAge-StationDataGenerator27AA-KtrEwaUxCFzT

b. Click on Test to trigger the data generation. This takes 3-5 minutes. You will need to do this twice data downloading

Cleanup

Run the following commands to destroy all Stacks. cdk destroy --all Enter y upon the prompt to destroy each Stack.

Security

See CONTRIBUTING for more information.

License

This project is licensed under the Apache-2.0 License.

Owner

  • Name: Amazon Web Services - Labs
  • Login: awslabs
  • Kind: organization
  • Location: Seattle, WA

AWS Labs

GitHub Events

Total
  • Watch event: 4
  • Delete event: 2
  • Issue comment event: 2
  • Push event: 6
  • Public event: 1
  • Pull request event: 2
  • Fork event: 1
  • Create event: 2
Last Year
  • Watch event: 4
  • Delete event: 2
  • Issue comment event: 2
  • Push event: 6
  • Public event: 1
  • Pull request event: 2
  • Fork event: 1
  • Create event: 2

Dependencies

cdk-stacks/lambdas/websocket/package-lock.json npm
  • @aws-crypto/sha256-browser 5.2.0
  • @aws-crypto/sha256-js 5.2.0
  • @aws-crypto/supports-web-crypto 5.2.0
  • @aws-crypto/util 5.2.0
  • @aws-sdk/client-apigatewaymanagementapi 3.614.0
  • @aws-sdk/client-sso 3.614.0
  • @aws-sdk/client-sso-oidc 3.614.0
  • @aws-sdk/client-sts 3.614.0
  • @aws-sdk/core 3.614.0
  • @aws-sdk/credential-provider-env 3.609.0
  • @aws-sdk/credential-provider-http 3.614.0
  • @aws-sdk/credential-provider-ini 3.614.0
  • @aws-sdk/credential-provider-node 3.614.0
  • @aws-sdk/credential-provider-process 3.614.0
  • @aws-sdk/credential-provider-sso 3.614.0
  • @aws-sdk/credential-provider-web-identity 3.609.0
  • @aws-sdk/middleware-host-header 3.609.0
  • @aws-sdk/middleware-logger 3.609.0
  • @aws-sdk/middleware-recursion-detection 3.609.0
  • @aws-sdk/middleware-user-agent 3.614.0
  • @aws-sdk/region-config-resolver 3.614.0
  • @aws-sdk/token-providers 3.614.0
  • @aws-sdk/types 3.609.0
  • @aws-sdk/util-endpoints 3.614.0
  • @aws-sdk/util-locate-window 3.568.0
  • @aws-sdk/util-user-agent-browser 3.609.0
  • @aws-sdk/util-user-agent-node 3.614.0
  • @smithy/abort-controller 3.1.1
  • @smithy/config-resolver 3.0.5
  • @smithy/core 2.2.6
  • @smithy/credential-provider-imds 3.1.4
  • @smithy/fetch-http-handler 3.2.1
  • @smithy/hash-node 3.0.3
  • @smithy/invalid-dependency 3.0.3
  • @smithy/is-array-buffer 2.2.0
  • @smithy/is-array-buffer 3.0.0
  • @smithy/middleware-content-length 3.0.3
  • @smithy/middleware-endpoint 3.0.5
  • @smithy/middleware-retry 3.0.9
  • @smithy/middleware-serde 3.0.3
  • @smithy/middleware-stack 3.0.3
  • @smithy/node-config-provider 3.1.4
  • @smithy/node-http-handler 3.1.2
  • @smithy/property-provider 3.1.3
  • @smithy/protocol-http 4.0.3
  • @smithy/querystring-builder 3.0.3
  • @smithy/querystring-parser 3.0.3
  • @smithy/service-error-classification 3.0.3
  • @smithy/shared-ini-file-loader 3.1.4
  • @smithy/signature-v4 3.1.2
  • @smithy/smithy-client 3.1.7
  • @smithy/types 3.3.0
  • @smithy/url-parser 3.0.3
  • @smithy/util-base64 3.0.0
  • @smithy/util-body-length-browser 3.0.0
  • @smithy/util-body-length-node 3.0.0
  • @smithy/util-buffer-from 2.2.0
  • @smithy/util-buffer-from 3.0.0
  • @smithy/util-config-provider 3.0.0
  • @smithy/util-defaults-mode-browser 3.0.9
  • @smithy/util-defaults-mode-node 3.0.9
  • @smithy/util-endpoints 2.0.5
  • @smithy/util-hex-encoding 3.0.0
  • @smithy/util-middleware 3.0.3
  • @smithy/util-retry 3.0.3
  • @smithy/util-stream 3.0.6
  • @smithy/util-uri-escape 3.0.0
  • @smithy/util-utf8 2.3.0
  • @smithy/util-utf8 3.0.0
  • aws-jwt-verify 4.0.1
  • bowser 2.11.0
  • fast-xml-parser 4.2.5
  • strnum 1.0.5
  • tslib 2.6.3
  • uuid 9.0.1
cdk-stacks/lambdas/websocket/package.json npm
  • @aws-sdk/client-apigatewaymanagementapi ^3.614.0
  • aws-jwt-verify ^4.0.1
cdk-stacks/package-lock.json npm
  • 579 dependencies
cdk-stacks/package.json npm
  • @types/aws-lambda ^8.10.141 development
  • @types/fs-extra ^11.0.4 development
  • @types/jest ^29.5.12 development
  • @types/node ^20.12.7 development
  • aws-cdk ^2.148.1 development
  • cdk-nag ^2.28.107 development
  • esbuild 0.25.0 development
  • jest ^29.7.0 development
  • ts-jest ^29.1.2 development
  • ts-node ^10.9.2 development
  • typescript ~5.4.5 development
  • @aws-cdk/aws-events ^1.204.0
  • @aws-cdk/aws-events-targets ^1.204.0
  • @aws-cdk/aws-lambda-python-alpha ^2.148.0-alpha.0
  • @aws-sdk/client-cognito-identity-provider ^3.587.0
  • @aws-sdk/client-ssm ^3.45.0
  • @aws-solutions-constructs/aws-cloudfront-s3 ^2.61.0
  • @aws-solutions-constructs/aws-lambda-sqs ^2.61.0
  • @aws-solutions-constructs/aws-sqs-lambda ^2.61.0
  • @cdklabs/generative-ai-cdk-constructs ^v0.1.289
  • aws-cdk-lib ^2.139.1
  • aws-lambda ^1.0.7
  • aws-sdk ^2.1651.0
  • constructs ^10.0.0
  • fs-extra ^11.2.0
  • source-map-support ^0.5.21
webapp/package-lock.json npm
  • 682 dependencies
webapp/package.json npm
  • @types/dompurify ^3.0.5 development
  • @types/papaparse ^5.3.14 development
  • @types/react ^18.2.55 development
  • @types/react-dom ^18.2.19 development
  • @typescript-eslint/eslint-plugin ^6.21.0 development
  • @typescript-eslint/parser ^6.21.0 development
  • @vitejs/plugin-react ^4.2.1 development
  • autoprefixer ^10.4.17 development
  • esbuild 0.22.0 development
  • eslint ^8.56.0 development
  • eslint-plugin-react-hooks ^4.6.0 development
  • eslint-plugin-react-refresh ^0.4.5 development
  • postcss ^8.4.35 development
  • sass ^1.70.0 development
  • typescript ^5.2.2 development
  • vite ^5.4.14 development
  • @aws-amplify/auth ^6.3.8
  • @aws-amplify/ui-react ^6.1.12
  • @cloudscape-design/chat-components ^1.0.6
  • @cloudscape-design/components ^3.0.611
  • @cloudscape-design/design-tokens ^3.0.42
  • @cloudscape-design/global-styles ^1.0.27
  • @fortawesome/free-solid-svg-icons ^6.6.0
  • @fortawesome/react-fontawesome ^0.2.2
  • aws-amplify ^6.3.8
  • cross-spawn 7.0.5
  • dompurify ^3.1.5
  • fast-xml-parser 4.4.1
  • papaparse ^5.4.1
  • react ^18.2.0
  • react-dom ^18.2.0
  • react-markdown ^9.0.1
  • react-router-dom ^6.22.0
  • react-textarea-autosize ^8.5.3
  • react-use-websocket ^4.8.1
  • rehype-raw ^7.0.0
  • remark-gfm ^4.0.0
  • rollup 4.22.4
  • semver 7.5.2
cdk-stacks/lambdas/layers/boto3/requirements.txt pypi
  • PyJWT ==2.8.0
  • boto3 ==1.34.162
  • strip-markdown ==1.3