Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Serverless-observability

Demo - MusicQA: AI-Powered Music Question Answering System

MusicQA is an AI-powered system that answers questions about music using AWS services and the CDK (Cloud Development Kit) for infrastructure deployment.

This project implements a serverless architecture to process user queries about music, leveraging natural language processing and a knowledge base to provide accurate and informative responses. The system is designed to scale automatically and handle a wide range of music-related questions efficiently.

Repository Structure

The repository is organized as follows:

  • app.py: The main entry point for the CDK application.
  • cdk.json: Configuration file for the CDK project.
  • requirements.txt: Python dependencies for the project.
  • musicqa/: Directory containing the main application code.
    • musicqa_stack.py: Defines the AWS resources using CDK constructs.
  • aws_xray_sdk/: Directory containing the AWS X-Ray SDK for Python.
  • botocore/: Directory containing the Botocore library, which is a low-level interface to AWS services.
  • bin/: Directory containing utility scripts.
    • jp.py: A command-line interface for the JMESPath library.
  • source.bat: Windows batch script for activating the Python virtual environment.

Usage Instructions

Installation

  1. Ensure you have Python 3.7 or later installed.
  2. Install the AWS CDK CLI:
    npm install -g aws-cdk
    
  3. Clone this repository:
    git clone https://github.com/your-repo/musicqa.git
    cd musicqa
    
  4. Create and activate a virtual environment:
    python -m venv .venv
    source .venv/bin/activate  # On Windows, use `.venv\Scripts\activate`
    
  5. Install the required dependencies:
    pip install -r requirements.txt
    

Deployment

  1. Configure your AWS credentials:
    aws configure
    
  2. Synthesize the CloudFormation template:
    cdk synth
    
  3. Deploy the stack:
    cdk deploy
    

Using the MusicQA System

After deployment, you can interact with the MusicQA system through the provided API Gateway endpoint. Send POST requests to the endpoint with your music-related questions in the request body.

Example:

curl -X POST https://your-api-gateway-url/prod/ask -d '{"question": "Who wrote Bohemian Rhapsody?"}'

Data Flow

  1. User submits a question through the API Gateway.
  2. The request is routed to a Lambda function.
  3. The Lambda function processes the question using natural language processing.
  4. The processed question is used to query a knowledge base (e.g., DynamoDB or Amazon Kendra).
  5. The retrieved information is formatted into a response.
  6. The response is sent back through the API Gateway to the user.
[User] -> [API Gateway] -> [Lambda] -> [NLP Processing]
                                   -> [Knowledge Base Query]
                                   -> [Response Formatting]
         [API Gateway] <- [Lambda] <- [Final Response]
[User] <-

Infrastructure

The project uses AWS CDK to define and deploy the following resources:

  • Lambda: Processes questions and generates responses.
  • API Gateway: Provides the HTTP endpoint for user interactions.
  • DynamoDB: Stores the music knowledge base (optional, depending on implementation).
  • Amazon Kendra: Provides intelligent search capabilities (optional, depending on implementation).
  • CloudWatch: Monitors and logs system activities.
  • IAM: Manages permissions for the various components.

The exact resources and their configurations are defined in the musicqa_stack.py file.

About

Serveless API with AWS Observability using Amazon Bedrock Models

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages