From 6bbd3c75bcf2dc932b41763cc0b18bbfee3bd33d Mon Sep 17 00:00:00 2001 From: Arsenii Shatokhin Date: Mon, 29 Jan 2024 06:37:21 +0400 Subject: [PATCH] Reset client on setting api key --- agency_swarm/util/oai.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/agency_swarm/util/oai.py b/agency_swarm/util/oai.py index 6b85864c..88f9bf68 100644 --- a/agency_swarm/util/oai.py +++ b/agency_swarm/util/oai.py @@ -34,3 +34,6 @@ def set_openai_key(key): if not key: raise ValueError("Invalid API key. The API key cannot be empty.") openai.api_key = key + global client + with client_lock: + client = None