1 Answer
- Newest
- Most votes
- Most comments
1
From what I know, Bedrock doesn't provide direct API to retrieve messages for a given sessionId.
A possibility would be to try and go for manual storage. In your application, store every message exchanged between the user and the LLM agent in an S3 bucket using python. Serialize the messages you collect into JSON format and save them to the S3 with the SessionId as the filename.
import json
import boto3
s3_client = boto3.client('s3')
def save_conversation_to_s3(session_id, conversation):
# Convert conversation to JSON
json_data = json.dumps(conversation)
# Save to S3
s3_client.put_object(
Bucket='your-bucket-name',
Key=f'{session_id}.json',
Body=json_data,
ContentType='application/json'
)
Maybe if enough people post about this, Bedrock will offer a built-in method to retrieve messages for a session directly.
answered 2 years ago
Relevant content
- asked a year ago
- asked a year ago
- asked 9 months ago
- AWS OFFICIALUpdated 10 months ago
