Skip to content

Counting Tokens on Agent Calls. #17433

Closed Answered by eyurtsev
Leoccleao asked this question in Q&A
Feb 12, 2024 · 6 comments · 9 replies
Discussion options

You must be logged in to vote

Follow these instructions:

https://python.langchain.com/v0.2/docs/how_to/chat_token_usage_tracking/

llm = ChatOpenAI(
    model="gpt-3.5-turbo-0125",
    temperature=0,
    stream_usage=True,  <--- You must specify this to ask open ai to return token counts
)

Replies: 6 comments 9 replies

Comment options

You must be logged in to vote
1 reply
@kn-cbre
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
3 replies
@CrasCris
Comment options

@kn-cbre
Comment options

@CrasCris
Comment options

Comment options

You must be logged in to vote
5 replies
@Leoccleao
Comment options

@CerenSurmeli
Comment options

@rasgharpuredata
Comment options

@CerenSurmeli
Comment options

@Leoccleao
Comment options

Answer selected by eyurtsev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
6 participants