From 435a350e46d4f81796da959fb26acc37b4b5f7a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Ho=CC=88nicke?= Date: Wed, 12 Apr 2023 15:11:31 +0200 Subject: [PATCH] refactor: for the playground we need jina requirements should be not so strict --- README.md | 6 +++++- requirements.txt | 13 +++++++------ src/executor_factory.py | 5 +++-- src/gpt.py | 2 +- src/prompt_system.py | 4 ++-- src/prompt_tasks.py | 2 +- 6 files changed, 19 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 9ac1810..f609693 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ We are working on a way to use gpt-3.5-turbo as well. ### Create Microservice ```bash -gptdeploy create --description "Given a PDF, return it's text" --test "https://www.africau.edu/images/default/sample.pdf" +gptdeploy create --description "Given a PDF, return its text" --test "https://www.africau.edu/images/default/sample.pdf" ``` To create your personal microservice two things are required: - A `description` of the task you want to accomplish. @@ -445,6 +445,10 @@ Make sure it is only printed twice in case it changed. - [ ] section for microservices built by the community - [ ] test feedback for playground generation (could be part of the debugging) - [ ] should we send everything via json in the text attribute for simplicity? +- [ ] fix release workflow +- Proposal: - [ ] just generate the non-jina related code and insert it into an executor template +- [ ] think about strategies after the first approach failed? +- [ ] smooth rendering animation of the responses \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index ee79c62..bc0630d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,7 @@ -click==8.1.3 -streamlit==1.21.0 -openai==0.27.4 -psutil==5.9.4 -jcloud==0.2.6 -jina-hubble-sdk==0.35.0 \ No newline at end of file +click +streamlit +openai +psutil +jina +jcloud +jina-hubble-sdk \ No newline at end of file diff --git a/src/executor_factory.py b/src/executor_factory.py index bd43b08..a8dadf7 100644 --- a/src/executor_factory.py +++ b/src/executor_factory.py @@ -292,14 +292,15 @@ package2,package3,... host = jina_cloud.deploy_flow(executor_name, executor_path) self.create_playground(executor_name, executor_path, host) except self.MaxDebugTimeReachedException: - print('Could not debug the executor.') + print('Could not debug the Executor.') continue print(f''' Executor name: {executor_name} Executor path: {executor_path} Host: {host} -Playground: streamlit run {os.path.join(executor_path, "app.py")} +Run the following command to start the playground: +streamlit run {os.path.join(executor_path, "app.py")} ''' ) break diff --git a/src/gpt.py b/src/gpt.py index a8811b6..ca5c26c 100644 --- a/src/gpt.py +++ b/src/gpt.py @@ -89,7 +89,7 @@ class _GPTConversation: delta = chunk['choices'][0]['delta'] if 'content' in delta: content = delta['content'] - print_colored('' if complete_string else 'assistent', content, 'green', end='') + print_colored('' if complete_string else 'assistant', content, 'green', end='') complete_string += content return complete_string diff --git a/src/prompt_system.py b/src/prompt_system.py index a44b1e7..255c264 100644 --- a/src/prompt_system.py +++ b/src/prompt_system.py @@ -13,7 +13,7 @@ class MyInfoExecutor(Executor): def __init__(self, **kwargs): super().__init__() - @requests() # each executor must have exactly this decorator without parameters + @requests() # each Executor must have exactly this decorator without parameters def foo(self, docs: DocumentArray, **kwargs) => DocumentArray: for d in docs: content = json.loads(d.text) @@ -22,7 +22,7 @@ class MyInfoExecutor(Executor): return docs ``` -An executor gets a DocumentArray as input and returns a DocumentArray as output. +An Executor gets a DocumentArray as input and returns a DocumentArray as output. ''' docarray_example = f''' diff --git a/src/prompt_tasks.py b/src/prompt_tasks.py index bc80b62..5929901 100644 --- a/src/prompt_tasks.py +++ b/src/prompt_tasks.py @@ -9,7 +9,7 @@ def general_guidelines(): "Every file starts with comments describing what the code is doing before the first import. " "Comments can only be written within code blocks. " "Then all imports are listed. " - "It is important to import all modules that could be needed in the executor code. " + "It is important to import all modules that could be needed in the Executor code. " "Always import: " "from jina import Executor, DocumentArray, Document, requests " "Start from top-level and then fully implement all methods. "