From 30e0b8cf1e136420835467a4d2585c9ea88c4f06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Ho=CC=88nicke?= Date: Mon, 1 May 2023 02:06:09 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=AA=20test:=20level=202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/options/generate/generator.py | 7 +++++++ src/options/generate/templates_system.py | 8 ++++---- src/options/generate/templates_user.py | 4 ++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/options/generate/generator.py b/src/options/generate/generator.py index a5eeb40..04541cb 100644 --- a/src/options/generate/generator.py +++ b/src/options/generate/generator.py @@ -380,6 +380,8 @@ metas: description=self.microservice_specification.task )['strategies.json'] packages_list = [[pkg.strip().lower() for pkg in packages] for packages in json.loads(packages_json_string)] + packages_list = [[self.replace_with_gpt_3_5_turbo_if_possible(pkg) for pkg in packages] for packages in packages_list] + packages_list = [ packages for packages in packages_list if len(set(packages).intersection(set(PROBLEMATIC_PACKAGES))) == 0 ] @@ -512,3 +514,8 @@ Test scenario: while not val: val = input('you: ') return val + + @staticmethod + def replace_with_gpt_3_5_turbo_if_possible(pkg): + if pkg in ['nltk', 'textblob', 'spacy', 'transformers']: + return 'gpt_3_5_turbo_api' diff --git a/src/options/generate/templates_system.py b/src/options/generate/templates_system.py index a0a1dfc..7dabc54 100644 --- a/src/options/generate/templates_system.py +++ b/src/options/generate/templates_system.py @@ -120,7 +120,7 @@ contains example: yes () **final.txt** ```text input: "" -assertion: "" +assertion: the output is of type ``` If you did b, you must not do a. @@ -132,7 +132,7 @@ contains example: yes (Berlin) **final.txt** ```text input: "Berlin" -assertion: "contains weather report for the next 5 days" +assertion: the output is of type string ``` Example for "The user inserts a png and gets an svg as response.": @@ -151,7 +151,7 @@ contains example: yes (https://aquasecurity.github.io/kube-bench/v0.6.5/images/k **final.txt** ```text input: "https://aquasecurity.github.io/kube-bench/v0.6.5/images/kube-bench-logo-only.png" -assertion: "is an svg" +assertion: the output is of type svg ``` Example for "The microservice takes nothing as input and returns the current time.": @@ -160,6 +160,6 @@ contains example: n/a **final.txt** ```text input: "nothing" -assertion: "is a string" +assertion: the output is of type string ``` ''' diff --git a/src/options/generate/templates_user.py b/src/options/generate/templates_user.py index 6978eff..f3bd32a 100644 --- a/src/options/generate/templates_user.py +++ b/src/options/generate/templates_user.py @@ -405,8 +405,8 @@ Note that you must not ask for an example input in case the example input is alr Example for the case where the example is already mentioned in the refined description or the original description: **final.txt** ```text -input: "" -assertion: "the output must be of type " +input: +assertion: the output is of type ``` Note that your response must be either prompt.txt or final.txt. You must not write both. Note that you must obey the double asterisk and tripple backtick syntax from above.