Giter Site home page Giter Site logo

Comments (15)

Torantulino avatar Torantulino commented on May 31, 2024 7

My thoughts exactly.

If someone wants to tackle this.

Suggested Implementation:

  • ALL API calls should be centralised through a single method that counts tokens and adds to a dollar amount based on the model used.
  • Store this in its own file and remove openai imports from everywhere else so that the API can't be called accidentally.

Displaying

  • Total dollar amount spent should be constantly displayed to the user.
  • Total dollar amount spent could be displayed to the AI. Perhaps it could even be given a budget, and the dollar amount would count down as it spends money. This could create a sense of urgency in a HustleGPT style task.

If you'd like to work on this (please do!), assign it to yourself so we don't both work on the same thing.

from auto-gpt.

0xcha05 avatar 0xcha05 commented on May 31, 2024 5

could use this?
https://github.com/openai/tiktoken

from auto-gpt.

0xcha05 avatar 0xcha05 commented on May 31, 2024 5

I can pick this, but first, I'll spend a little time on #4 .

from auto-gpt.

Vwing avatar Vwing commented on May 31, 2024 5

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.

from auto-gpt.

Vwing avatar Vwing commented on May 31, 2024 3

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 #762 (comment)

from auto-gpt.

ryanpeach avatar ryanpeach commented on May 31, 2024 2

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.

from auto-gpt.

0xcha05 avatar 0xcha05 commented on May 31, 2024 1

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.

from auto-gpt.

ntindle avatar ntindle commented on May 31, 2024 1

@Vwing shoot me a DM on the discord :)

from auto-gpt.

rob-luke avatar rob-luke commented on May 31, 2024 1

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 🚀

from auto-gpt.

masterismail avatar masterismail commented on May 31, 2024

hey @0xcha05 are you currently working on this issue?

from auto-gpt.

Vwing avatar Vwing commented on May 31, 2024

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.

running-cost-failure

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 "")),

from auto-gpt.

Vwing avatar Vwing commented on May 31, 2024

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. #762

from auto-gpt.

Pwuts avatar Pwuts commented on May 31, 2024

Fixed in #762

from auto-gpt.

rob-luke avatar rob-luke commented on May 31, 2024

@Pwuts The final aspect of the initial problem description is addressed in #3313 which isn't merged yet.

from auto-gpt.

Boostrix avatar Boostrix commented on May 31, 2024

has anybody thought about exposing this in a shell prompt-style manner at runtime, per agent (task/job) ?

from auto-gpt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.