From: arcrank Date: Sun, 8 Oct 2023 10:52:57 +0000 (-0400) Subject: api_like_OAI.py : simplify function (#2796) X-Git-Tag: upstream/0.0.4488~3136 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=9c38d181d40b9d27f8f42152c18e7c70bfffcf37;p=pkg%2Fggml%2Fsources%2Fllama.cpp api_like_OAI.py : simplify function (#2796) Simplify function --- diff --git a/examples/server/api_like_OAI.py b/examples/server/api_like_OAI.py index ed19237b..1b0bf575 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):