{"id":27017845,"url":"https://github.com/awsdataarchitect/mlflow-bedrock-cdk","last_synced_at":"2026-04-27T22:31:52.951Z","repository":{"id":284984935,"uuid":"956702636","full_name":"awsdataarchitect/mlflow-bedrock-cdk","owner":"awsdataarchitect","description":"MLflow-Powered Generative AI Observability with Amazon Bedrock","archived":false,"fork":false,"pushed_at":"2025-03-28T18:08:42.000Z","size":121,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-04T21:38:23.959Z","etag":null,"topics":["aws","bedrock","cdk","fargate","mlflow"],"latest_commit_sha":null,"homepage":"https://medium.com/@vivek-aws/mlflow-powered-generative-ai-observability-with-amazon-bedrock-e54fa9df895e","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/awsdataarchitect.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-28T17:55:29.000Z","updated_at":"2025-03-28T18:10:23.000Z","dependencies_parsed_at":"2025-03-28T19:35:06.509Z","dependency_job_id":null,"html_url":"https://github.com/awsdataarchitect/mlflow-bedrock-cdk","commit_stats":null,"previous_names":["awsdataarchitect/mlflow-bedrock-cdk"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/awsdataarchitect/mlflow-bedrock-cdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awsdataarchitect%2Fmlflow-bedrock-cdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awsdataarchitect%2Fmlflow-bedrock-cdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awsdataarchitect%2Fmlflow-bedrock-cdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awsdataarchitect%2Fmlflow-bedrock-cdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/awsdataarchitect","download_url":"https://codeload.github.com/awsdataarchitect/mlflow-bedrock-cdk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/awsdataarchitect%2Fmlflow-bedrock-cdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32358509,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-27T20:07:02.737Z","status":"ssl_error","status_checked_at":"2026-04-27T20:07:00.910Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","bedrock","cdk","fargate","mlflow"],"created_at":"2025-04-04T16:33:37.069Z","updated_at":"2026-04-27T22:31:52.946Z","avatar_url":"https://github.com/awsdataarchitect.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MLflow-Powered Generative AI Observability with Amazon Bedrock\n\n## Overview\n\nThis repository implements an **MLflow-powered observability framework** for **generative AI** applications using **Amazon Bedrock**. It enables real-time tracking of model interactions, token usage analysis, and cost estimation for inference requests.\n\nFor more details on how to deploy the infrastructure and the solution details, please refer to the Blog Post:\n* [MLflow-Powered Generative AI Observability with Amazon Bedrock](https://vivek-aws.medium.com/mlflow-powered-generative-ai-observability-with-amazon-bedrock-e54fa9df895e).\n\n![Alt text](./mlflow.jpg?raw=true \"MLflow-Powered Generative AI Observability with Amazon Bedrock\")\n\n## Features\n\n- **MLflow Integration**: Tracks experiment runs, logs parameters, and records token usage and costs.\n- **Amazon Bedrock Integration**: Interacts with `amazon.nova-lite-v1:0` for generating responses.\n- **Token Cost Calculation**: Computes input/output token counts and associated costs using `tiktoken`.\n- **Structured Inference Requests**: Uses a well-defined message format for consistency.\n- **Automated Metrics Logging**: Logs prompt tokens, response tokens, and cost breakdowns to MLflow.\n\n## Prerequisites\n\n- Python 3.8+\n- AWS credentials with access to **Amazon Bedrock**\n- An MLflow tracking server\n- Required Python libraries:\n  ```sh\n  pip install boto3 mlflow tiktoken\n  ```\n\n## Installation\n\n1. Clone the repository:\n   ```sh\n   git clone https://github.com/awsdataarchitect/mlflow-bedrock-cdk.git\n   cd mlflow-bedrock-cdk\n   cdk bootstrap \u0026\u0026 cdk deploy\n   ```\n2. Set up your MLflow tracking URI in the script:\n   ```python\n   mlflow.set_tracking_uri(\"http://your-mlflow-server.com\")\n   ```\n3. Configure AWS credentials for **Amazon Bedrock** access.\n\n## Usage\n\n1. Define the input prompt:\n   ```python\n   prompt = \"Explain machine learning observability in one paragraph\"\n   ```\n2. Run the script:\n   ```sh\n   python scripts/bedrock_tracing.py\n   ```\n3. View logs and metrics in **MLflow UI**.\n\n## Example Output\n\n```\n2025/03/28 12:35:42 INFO mlflow.bedrock: Enabled auto-tracing for Bedrock. Note that MLflow can only trace boto3 service clients that are created after this call. If you have already created one, please recreate the client by calling `boto3.client`.\n2025/03/28 12:35:44 INFO mlflow.tracking.fluent: Experiment with name 'Bedrock-Token-Cost-Demo' does not exist. Creating a new experiment.\nResponse: Machine learning observability refers to the ability to monitor, diagnose, and understand the behavior and performance of machine learning models in real-time and throughout their lifecycle. It involves collecting and analyzing various metrics, logs, and traces to gain insights into model performance, data quality, and operational health. Observability helps in identifying issues such as data drift, model drift, and performance degradation, enabling data scientists and engineers to make informed decisions, ensure model reliability, and maintain the overall health of machine learning systems. This practice is crucial for maintaining model accuracy, ensuring compliance, and facilitating continuous improvement in machine learning deployments.\nCost: $0.02934000\n🏃 View run rambunctious-koi-880 at: http://Mlflow-MLflo-cXfL3g06yBhj-966380976.us-east-1.elb.amazonaws.com/#/experiments/1/runs/cabc0132b4164555bab2e6e7d0e5fb04\n🧪 View experiment at: http://Mlflow-MLflo-cXfL3g06yBhj-966380976.us-east-1.elb.amazonaws.com/#/experiments/1\n```\n\n## License\n\nThis project is licensed under the MIT License.\n\nThe `cdk.json` file tells the CDK Toolkit how to execute your app.\n\n## Useful commands\n\n* `npm run build`   compile typescript to js\n* `npm run watch`   watch for changes and compile\n* `npm run test`    perform the jest unit tests\n* `npx cdk deploy`  deploy this stack to your default AWS account/region\n* `npx cdk diff`    compare deployed stack with current state\n* `npx cdk synth`   emits the synthesized CloudFormation template\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawsdataarchitect%2Fmlflow-bedrock-cdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fawsdataarchitect%2Fmlflow-bedrock-cdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fawsdataarchitect%2Fmlflow-bedrock-cdk/lists"}