You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I searched existing ideas and did not find a similar one
I added a very descriptive title
I've clearly described the feature request and motivation for it
Feature request
Alongside the recent work on token usage for chat completions, it would be great if the library supported returning token usage when making embedding requests, currently the type only supports the actual embedding.
Motivation
Having the ability to understand all token usage being incurred when working with LLMs will really help with appropriate logging, and potentially user rate limiting from the app side.
Proposal (If applicable)
The core langchainjs package has types that prevent returning metadata around the embedding response, and ideally from my point of view it would allow exposing the token usage if the integration supported it. I think altering the types in the core langchainjs package to allow for optional metadata to be returned alongside the embedding, would allow work to begin on adding support for token usage to be returned by integrations. Be happy to put in some effort here on the integration side.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Checked
Feature request
Alongside the recent work on token usage for chat completions, it would be great if the library supported returning token usage when making embedding requests, currently the type only supports the actual embedding.
Motivation
Having the ability to understand all token usage being incurred when working with LLMs will really help with appropriate logging, and potentially user rate limiting from the app side.
Proposal (If applicable)
The core langchainjs package has types that prevent returning metadata around the embedding response, and ideally from my point of view it would allow exposing the token usage if the integration supported it. I think altering the types in the core langchainjs package to allow for optional metadata to be returned alongside the embedding, would allow work to begin on adding support for token usage to be returned by integrations. Be happy to put in some effort here on the integration side.
Beta Was this translation helpful? Give feedback.
All reactions