Source: Titan Image Generator G1 - 'illustration of different weather and outfits'
Note: The demo relies on you having an account with OpenWeatherMap, and an API key to access the Weather service. This service is available on the OpenWeatherMap free plan. Please review any license terms applicable to the service with your legal team and confirm that your use case complies with the terms before proceeding.
This repo contains code for a demo of Amazon Bedrock Agents.
In this demo, you will deploy an agent that is able to assist you in selecting the ideal outfit to where given your location.
In a standard deployment, a Large Language Model (LLM) can only reference 'knowledge' that it obtained during training. As such, when prompted to generate up-to-date information such as the current date and time, or getting the weather conditions, the model is left with no alternative other than to hallucinate.
In this demo, you will use Amazon Bedrock Agents to create a solution that enables an LLM to leverage realtime information including the date, time, and weather information. The solution will use this information to make suggestions for what outfit to wear.
This architecture could be easily extended to work with any number of APIs or data sources. If you are able to connect to your data from an Amazon Lambda function, then it can be used with Amazon Bedrock Agents.
This is a SAM project. To get started with SAM see here.
Deploy this project using the SAM CLI:
> sam build
> sam deploy --guided
You will be prompted for information as the project is deployed:
anthropic.claude-v2:1
Please ensure you have enabled access to this model in the region you are deploying to.)Agents
in the left hand menu.OutfitAssistantAgent
agent.If you are happy with the performance of the agent, you can deploy it, and access it via your own application.
Create Alias
, enter a name and description so it's clear at what point in its development it was deployed, and select Create Alias
.Agent overview
section of the console, and the alias ID which is shown in the Aliases
section towards the bottom of the agent console page. Note that these IDs are generated by the service, and are not the same as the names you used../test/agent_test.ipynb
. For more information on the Agents for Amazon Bedrock API see here: (https://docs.aws.amazon.com/bedrock/latest/userguide/agents-api.html) and for the AWS Python SDK - Boto3 - see here: (https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/bedrock-agent-runtime.html)To test the Lambda function without having to invoke the agent, I have provided you with three test event JSON files that can be pasted into the test event configuration page within the Lambda function. Each test event is formatted as the event will be sent from the agent:
./tests/lambda_event_location.json
./tests/lambda_event_time.json
./tests/lambda__event_weather.json
See CONTRIBUTING for more information.
This library is licensed under the MIT-0 License. See the LICENSE file.