From b337f74d24d38b4b8e12e1af87fa99ccccda4528 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Ho=CC=88nicke?= Date: Thu, 11 May 2023 21:53:21 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=8F=83=20fix:=20run=20function?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dev_gpt/apis/gpt.py | 2 +- .../options/generate/static_files/microservice/jina_wrapper.py | 2 +- dev_gpt/options/generate/templates_user.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dev_gpt/apis/gpt.py b/dev_gpt/apis/gpt.py index 949fb4a..44d329f 100644 --- a/dev_gpt/apis/gpt.py +++ b/dev_gpt/apis/gpt.py @@ -77,7 +77,7 @@ class GPTSession: }] ) break - except RateLimitError: + except (RateLimitError, openai.error.APIError): sleep(1) continue return True diff --git a/dev_gpt/options/generate/static_files/microservice/jina_wrapper.py b/dev_gpt/options/generate/static_files/microservice/jina_wrapper.py index bfc4553..5cd7191 100644 --- a/dev_gpt/options/generate/static_files/microservice/jina_wrapper.py +++ b/dev_gpt/options/generate/static_files/microservice/jina_wrapper.py @@ -11,5 +11,5 @@ class DevGPTExecutor(Executor): @jina_requests() def endpoint(self, docs: DocumentArray, **kwargs) -> DocumentArray: for d in docs: - d.text = json.dumps(func(json.loads(d.text))) + d.text = func(d.text) return docs diff --git a/dev_gpt/options/generate/templates_user.py b/dev_gpt/options/generate/templates_user.py index 8eea63f..a7a373e 100644 --- a/dev_gpt/options/generate/templates_user.py +++ b/dev_gpt/options/generate/templates_user.py @@ -105,7 +105,7 @@ generated_string = gpt(prompt) # fill-in the prompt (str); the output is a stri template_generate_function = PromptTemplate.from_template( general_guidelines_string + ''' -Write a python function which receives as input a dictionary and outputs a dictionary. The function is called 'func'. +Write a python function which receives as input json string (that can be parsed with the python function json.loads) and outputs a json string (that can be parsed with the python function json.loads). The function is called 'func'. The function must full-fill: '{microservice_description}'. It will be tested with the following scenario: '{test_description}'. For the implementation use the following package(s): '{packages}'.