From 1f8e675fc12c533e1509bd75ee02264297a11ac2 Mon Sep 17 00:00:00 2001 From: Anas Fikhi Date: Wed, 22 Nov 2023 04:20:15 +0100 Subject: [PATCH] [ Remove ] reverted back the impl for stream timeout appliance --- lib/src/core/networking/client.dart | 12 ++++++++++-- lib/src/instance/chat/chat.dart | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/src/core/networking/client.dart b/lib/src/core/networking/client.dart index a5ee0c8e..9ba1d426 100644 --- a/lib/src/core/networking/client.dart +++ b/lib/src/core/networking/client.dart @@ -161,7 +161,7 @@ abstract class OpenAINetworkingClient { clientForUse .send(request) - .timeout(OpenAIConfig.requestsTimeOut) + // .timeout(OpenAIConfig.requestsTimeOut) .then((streamedResponse) { streamedResponse.stream.listen( (value) { @@ -366,7 +366,15 @@ abstract class OpenAINetworkingClient { OpenAILogger.logStartRequest(to); - clientForUse.send(request).timeout(OpenAIConfig.requestsTimeOut).then( + clientForUse + .send(request) + // .timeout( + // OpenAIConfig.requestsTimeOut, + // onTimeout: () { + // throw TimeoutException("Request timed out"); + // }, + // ) + .then( (respond) { OpenAILogger.startReadStreamResponse(); diff --git a/lib/src/instance/chat/chat.dart b/lib/src/instance/chat/chat.dart index 1d874965..7a564cd4 100644 --- a/lib/src/instance/chat/chat.dart +++ b/lib/src/instance/chat/chat.dart @@ -185,7 +185,7 @@ interface class OpenAIChat implements OpenAIChatBase { "messages": messages.map((message) => message.toMap()).toList(), if (tools != null) "tools": tools.map((tool) => tool.toMap()).toList(growable: false), - if (toolChoice != null) "tool_choice": toolChoice.value, + if (toolChoice != null) "tool_choice": toolChoice, if (temperature != null) "temperature": temperature, if (topP != null) "top_p": topP, if (n != null) "n": n,