Skip to content

feat(appsync-modelgen-plugin): add metrics and usage fields to conversation message model#1008

Draft
pjkroker wants to merge 2 commits intoaws-amplify:mainfrom
pjkroker:feature/bedrock-model-usage
Draft

feat(appsync-modelgen-plugin): add metrics and usage fields to conversation message model#1008
pjkroker wants to merge 2 commits intoaws-amplify:mainfrom
pjkroker:feature/bedrock-model-usage

Conversation

@pjkroker
Copy link
Copy Markdown

Description of changes

Adds metrics and usage fields to the generated conversation message model in processConversationRoute.

This enables clients to receive token usage metadata (input/output/total tokens) and metrics from Bedrock AI conversation responses, supporting the ability to track and limit token usage per user.

The fields are typed as:

  • metrics: AmplifyAIMetrics (nonModel)
  • usage: AmplifyAIUsage (nonModel)

Codegen Paramaters Changed or Added

Issue #, if available

aws-amplify/amplify-backend#2355

Description of how you validated changes

  • Ran yarn build and yarn test in packages/appsync-modelgen-plugin — all tests pass
  • Updated snapshot for appsync-model-introspection-visitor to include the new fields
  • graphql-generator test failures are pre-existing on main and unrelated to this change

Checklist

  • [ x] PR description included
  • [ x] yarn test passes
  • E2E test run linked
  • [ x] Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)
  • Breaking changes to existing customers are released behind a feature flag or major version update
  • Changes are tested using sample applications for all relevant platforms (iOS/android/flutter/Javascript) that use the feature added/modified
  • Changes are tested on windows. Some Node functions (such as path) behave differently on windows.
  • Changes adhere to the GraphQL Spec and supports the GraphQL types type, input, enum, interface, union and scalar types.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant