From 5bf3f522340637b8e50fec683336366a1b70458d Mon Sep 17 00:00:00 2001 From: Joschka Braun Date: Fri, 14 Apr 2023 12:29:00 +0200 Subject: [PATCH] fix: fix formatting of system message --- src/gpt.py | 4 ++-- src/prompt_system.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/gpt.py b/src/gpt.py index b073496..9df28e7 100644 --- a/src/gpt.py +++ b/src/gpt.py @@ -93,9 +93,9 @@ class _GPTConversation: if 'executor' in system_definition_examples: system_message += f'\n{executor_example}' if 'docarray' in system_definition_examples: - system_message += f'{docarray_example}' + system_message += f'\n{docarray_example}' if 'client' in system_definition_examples: - system_message += f'{client_example}' + system_message += f'\n{client_example}' self.prompt_list[0] = ('system', system_message) def get_response_from_stream(self, response_generator): diff --git a/src/prompt_system.py b/src/prompt_system.py index 6d6a939..f08325d 100644 --- a/src/prompt_system.py +++ b/src/prompt_system.py @@ -27,14 +27,16 @@ An Executor gets a DocumentArray as input and returns a DocumentArray as output. docarray_example = f'''A DocumentArray is a python class that can be seen as a list of Documents. A Document is a python class that represents a single document. Here is the protobuf definition of a Document: - +``` message DocumentProto {{ // used to store json data the executor gets and returns string text = 1; }} +``` Here are examples of how a DocumentArray can be defined: +``` from jina import DocumentArray, Document import json @@ -52,6 +54,7 @@ array_list = array.tolist() d3 = Document(text=json.dumps(array_list)) d4 = Document() d4.text = '{{"uri": "https://.../logo.png"}}' +``` '''