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}'.