openai-java icon indicating copy to clipboard operation
openai-java copied to clipboard

Continue completion response

Open ffritsche opened this issue 3 years ago • 4 comments

Is there a way to continue a completion response if the reason is length? I get a

 java.net.SocketTimeoutException: timeout
	at io.reactivex.internal.util.ExceptionHelper.wrapOrThrow(ExceptionHelper.java:45)
	at io.reactivex.internal.observers.BlockingMultiObserver.blockingGet(BlockingMultiObserver.java:90)
	at io.reactivex.Single.blockingGet(Single.java:2002)
	at com.theokanning.openai.OpenAiService.createCompletion(OpenAiService.java:91)

when I set maxTokens>500

ffritsche avatar Dec 20 '22 10:12 ffritsche

Have you tried to provide a timeout parameter when creating the service?

var service = new OpenAiService(apiToken, API_SOCKET_TIMEOUT);

ferreirarod avatar Dec 20 '22 13:12 ferreirarod

@ffritsche I think ferreirarod has the right solution here, have you tried increasing the timeout to 30 seconds?

TheoKanning avatar Jan 02 '23 23:01 TheoKanning

Hey thanks that helps. But is there a way to continue the results like in the playground?

ffritsche avatar Jan 04 '23 14:01 ffritsche

It does allow two arguments token and timeout

On Mon, Jan 16, 2023, 4:05 PM kazihar Cannei @.***> wrote:

Have you tried to provide a timeout parameter when creating the service?

var service = new OpenAiService(apiToken, API_SOCKET_TIMEOUT);

OpenAiService constructor doesn't allow two arguments, it allows apiToken only, how can i tweak it?

— Reply to this email directly, view it on GitHub https://github.com/TheoKanning/openai-java/issues/49#issuecomment-1383874149, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5FTG32FHGHHGVVVDQBAZ7DWSUTPRANCNFSM6AAAAAATEKSLBY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

shanali10 avatar Jan 19 '23 21:01 shanali10

Moving this to https://github.com/TheoKanning/openai-java/issues/75

TheoKanning avatar Apr 01 '23 20:04 TheoKanning