From 9c38d181d40b9d27f8f42152c18e7c70bfffcf37 Mon Sep 17 00:00:00 2001 From: arcrank Date: Sun, 8 Oct 2023 06:52:57 -0400 Subject: [PATCH] api_like_OAI.py : simplify function (#2796) Simplify function --- examples/server/api_like_OAI.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/examples/server/api_like_OAI.py b/examples/server/api_like_OAI.py index ed19237b0..1b0bf5757 100755 --- a/examples/server/api_like_OAI.py +++ b/examples/server/api_like_OAI.py @@ -23,13 +23,7 @@ parser.add_argument("--port", type=int, help="Set the port to listen.(default: 8 args = parser.parse_args() def is_present(json, key): - try: - buf = json[key] - except KeyError: - return False - return True - - + return key in json #convert chat to prompt def convert_chat(messages):