-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Prompt token consumption grows until /reset #34
Comments
Hi @k3it, good catch. Yeah, I think it's showing the sum of the prompt tokens used within a conversation. I would say that's the expected behavior, since I'm not doing any calculations myself, just printing the |
I did some more checking and it looks like "Token used" is an individual counter for each prompt/response transaction. it is not a cumulative for the current conversation. So each new question within the same conversation becomes more expensive to ask. After a long session without a /reset it may be cheaper to buy and weight the banana yourself instead of asking the bot about it :) edit: i see now that message query and answer history is added to each completion. that explains the growth I think chatgpt-telegram-bot/openai_helper.py Lines 32 to 37 in 71209d6
chatgpt-telegram-bot/openai_helper.py Line 56 in 71209d6
edit2: here is what the bot thinks about this (might not be accurate?) When you create a new completion request using the GPT API, you can include some context that the endpoint can use to better understand the request. This context can come from the last few messages in the conversation, as well as any additional information you provide. The GPT model can then use this context to generate a more accurate and relevant response. |
Indeed it looks like sending history also cosumes tokens. Here's what the docs say:
So I agree that history needs to be truncated or summarized somehow. I commented on your PR for possible solutions |
Hello and thanks a lot for the updates and fixes |
Hi @em108 I'm not familiar with embeddings or how they can be implemented in python. What are the advantages? |
From what I've gathered from multiple sources including the article below, embeddings can aid in long term memory / a way to store conversation data. Based on the cost and application, they can cost up to 5 - ~9 times less than sending chat history. Article: Also an example of a notebook utilizing embeddings: |
Very interesting, thanks @em108. Would be great, although I currently don't have the time to implement this |
Hi.
Thank you for the updates and support of the turbo model!
I noticed that each subsequent query within a conversation uses up more prompt tokens. this continues until I reset the session. Does this sound like the correct behavior?
here is an example of the same prompt, with each iteration increasing token usage:
The text was updated successfully, but these errors were encountered: