Skip to content
Discussion options

You must be logged in to vote

@jannikmaierhoefer I wasn’t able to see token usage in Langfuse initially, since I didn’t know how to pass the token usage data to Langfuse via the langchain-langfuse callback handler.

I modified the _generate method of my custom model class and made it return token usage inside the llm_output parameter of the ChatResult object.
After doing this, Langfuse was able to pick up the usage correctly, based on the model definition I had already set up in the Langfuse UI with proper usage name mapping.

Replies: 8 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@kshitijbisen
Comment options

Comment options

You must be logged in to vote
1 reply
@kshitijbisen
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@kshitijbisen
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@kshitijbisen
Comment options

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