🏃 fix: run function

This commit is contained in:
Florian Hönicke
2023-05-11 21:53:21 +02:00
parent 840a19aadf
commit b337f74d24
3 changed files with 3 additions and 3 deletions

View File

@@ -77,7 +77,7 @@ class GPTSession:
}] }]
) )
break break
except RateLimitError: except (RateLimitError, openai.error.APIError):
sleep(1) sleep(1)
continue continue
return True return True

View File

@@ -11,5 +11,5 @@ class DevGPTExecutor(Executor):
@jina_requests() @jina_requests()
def endpoint(self, docs: DocumentArray, **kwargs) -> DocumentArray: def endpoint(self, docs: DocumentArray, **kwargs) -> DocumentArray:
for d in docs: for d in docs:
d.text = json.dumps(func(json.loads(d.text))) d.text = func(d.text)
return docs return docs

View File

@@ -105,7 +105,7 @@ generated_string = gpt(prompt) # fill-in the prompt (str); the output is a stri
template_generate_function = PromptTemplate.from_template( template_generate_function = PromptTemplate.from_template(
general_guidelines_string + ''' 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}'. The function must full-fill: '{microservice_description}'.
It will be tested with the following scenario: '{test_description}'. It will be tested with the following scenario: '{test_description}'.
For the implementation use the following package(s): '{packages}'. For the implementation use the following package(s): '{packages}'.