Using the chat completion to calculate some number

Hey gents, I’ve passed the API some simple CSV values like:

location, budget, type
miami, $1000, floor
miami, $2000, windows
orlando, $500, floor

And ask in the prompt to give me the total budget for Miami however the math never returns correctly. It’s always off and always returns different numbers.

Of course my example here is using smaller, simple numbers. The real numbers are 7 figures and with decimals.

How have you handled this use case with ChatGPT? I appreciate sharing some tips!

I don’t understand why you’re using the LLM to do the math.

You’re using the API, which means you can process the data and way you want, just use the right tool for the job.

1 Like

LLMs are just probability distribution of words. it will be difficult for it. to do math. Try to use a tool for this. Look at leveraging agents

You can ask the model to create pseudo code to solve the problem step by step and to show it’s work and to solve the problem, GPT-4 is good for this kind of task and should give you the correct answer.

I mean there are much better ways to do simple math. If you really must do this, I’d recommend just asking to take your data and return it in a manner that’s easy to work with programmatically or if thats not your cup of you can use another format like csv, and import the thing into excel and do the maths that way

If you dont wanna do any of that ask for it in like json, and ask it to write you a simple python program to do the math on it. It’d be such a simple program that I dont htink it’d have any trouble with it