Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AI does not support receiving input and output tokens used #2355

Open
rpostulart opened this issue Dec 18, 2024 · 2 comments
Open

AI does not support receiving input and output tokens used #2355

rpostulart opened this issue Dec 18, 2024 · 2 comments
Labels
ai-kit Issues related to Amplify AI Kit feature-request New feature or request

Comments

@rpostulart
Copy link

rpostulart commented Dec 18, 2024

Is your feature request related to a problem? Please describe.
I would like to track and limit the token usage per person. Therefor I need to receive the used tokens per input and output

Describe the solution you'd like
I want meta data to be returned:

"usage": {
"inputTokens": number,
"outputTokens": number,
"totalTokens": number
}

in the docs: https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html#API_runtime_ConverseStream_ResponseElements

@atierian
Copy link
Member

Thanks for opening this feature request @rpostulart.
I'm transferring it over to the amplify-backend repo.

Providing access to the Bedrock request metadata and allowing per user token based throttling is something we're thinking about.

A few questions to help us better understand your use case:

  • Is this for conversation routes, generation routes, or both?
  • What criteria are you expecting to use to determine if a user request should be throttled? Is it n tokens within last x time frame? Something else?

@atierian atierian transferred this issue from aws-amplify/docs Dec 19, 2024
@atierian atierian added feature-request New feature or request ai-kit Issues related to Amplify AI Kit labels Dec 19, 2024
@rpostulart
Copy link
Author

  • It is for conversations!
  • I would like to set a max tokens on user level in DynomaDB and for each request if there are sufficient tokens, it not then deny the request, otherwise continue and receive the usedTokens and update the Dynamodb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ai-kit Issues related to Amplify AI Kit feature-request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants