From 404f7f8089190d04c05957dc653baff44f342dc7 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Tue, 10 Oct 2023 09:35:11 -0700 Subject: [PATCH] feat: :necktie: allow timeout param for OpenAI LLM class --- server/continuedev/libs/llm/openai.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/continuedev/libs/llm/openai.py b/server/continuedev/libs/llm/openai.py index ba29279bc..2276c1c99 100644 --- a/server/continuedev/libs/llm/openai.py +++ b/server/continuedev/libs/llm/openai.py @@ -1,4 +1,5 @@ from typing import Callable, List, Literal, Optional +import aiohttp import certifi import openai @@ -100,6 +101,10 @@ class OpenAI(LLM): openai.ca_bundle_path = self.ca_bundle_path or certifi.where() + if self.headers is not None or self.ca_bundle_path is not None or self.timeout != 300: + session = self.create_client_session() + openai.aiosession.set(session) + def collect_args(self, options): args = super().collect_args(options) if self.engine is not None: