Is it possible to give a answer for each line?

Hello, im currently trying to make chatgpt to classify some texts based on my input. Im currently doing for loops passing it my input plus the text and making it classify.
This is quite slow and expensive since the instructions are long and the text is short

Is there anyway of passing them just one time or less times my instructions and make the API work on all or more than one text at the same time?

I got a column of texts to classify, im looping on them.

Welcome to the community!

Sure! just number them, and ask for a json output or something.

Know though, that some of the newer models are lazy and will only give you a limited response.

If this works well, it’s also possible that fine tuning might work for you if you want to explore that at some point.

3 Likes

You can also send your requests to the Batch API and retrieve one complete set of results within one day which will save you 50% of the costs.

Then you could check if β€˜batching’ is an option for you. (I know the naming is confusing). The other option when performing standard API calls is parallelization.

There should also be some examples in the OpenAI cookbook to get you started.

2 Likes

Thanks everybody! Its working well.

Im going to try Batch Api too, thanks for the suggestion

1 Like