Closed Torantulino closed 1 year ago
could use this? https://github.com/openai/tiktoken
My thoughts exactly.
If someone wants to tackle this.
If you'd like to work on this (please do!), assign it to yourself so we don't both work on the same thing.
I can pick this, but first, I'll spend a little time on https://github.com/Torantulino/Auto-GPT/issues/4 .
I'm going to start work on this now, @Torantulino . please assign this to me so others don't work on the same issue. I'll start with a fresh fork.
I agree with all @Torantulino's ideas here. In that case, it might be a reason to use a real TUI instead of a simple set of print statements for this application. It could have a top-bar that contains running price for example.
I'd also make a flag in the cli that allows for rate limiting the application: Sleep 10 seconds between requests, for example. Some tasks the AI may be given may not require frequent polling. For example I'm using the bot for research, and notifications of major news events. Major news event searching may only need the bot to check the internet every day. This polling frequency option will be critical for giving some applications amazing speed, and others sort of dumb infrequent inexpensive speed.
hey @0xcha05 are you currently working on this issue?
I went ahead and implemented this in my own fork (branch "running_cost"). I'll submit a pull request later tonight.
Here it is in action, but also an example of it not working quite right.
I think I'll prompt engineer it a bit before submitting the pull request. I find that it works better if I send its remaining budget in the system message context, and yell at it if it goes over budget
create_chat_message(
"system", f"Your remaining budget is ${remaining_budget:.3f}" + (" BUDGET EXCEEDED! SHUT DOWN." if remaining_budget < 0 else "")),
I'll submit a pull request later tonight.
I'm very close, now. Auto-GPT is beginning to behave with the appropriate behavior of hurrying up when the budget is nearly depleted, and shutting itself down when the budget is exceeded.
Too tired to finish this tonight, though. I'll give another update tomorrow night.
Okay! It's working, now. It prints the running cost, the AI is aware of the running cost, and the user can optionally provide a budget (of which the AI is also aware, and behaves appropriately).
Please refer to my pull request. https://github.com/Torantulino/Auto-GPT/pull/762
Woohoo, it's merged in! 🎉
@rob-luke would you be interested in tackling the final task of making the total running cost visible to the user?
See https://github.com/Significant-Gravitas/Auto-GPT/pull/762#issuecomment-1519147325
@Vwing shoot me a DM on the discord :)
Thanks for tackling this issue @Vwing. I would be pleased to add the feature of making the running costs visible to the user, I can get that done this week. But if someone else starts to tackle it first, let me know so we don't duplicate work 🚀
Fixed in #762
@Pwuts The final aspect of the initial problem description is addressed in #3313 which isn't merged yet.
has anybody thought about exposing this in a shell prompt-style manner at runtime, per agent (task/job) ?
Auto-GPT is expensive to run due to GPT-4's API cost.
We could experiment with making it aware of this fact, by tracking tokens as they are used and converting to a dollar cost.
This could also be displayed to the user to help them be more aware of exactly how much they are spending.