summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorarcrank <arcrank@gmail.com>2023-10-08 06:52:57 -0400
committerGitHub <noreply@github.com>2023-10-08 13:52:57 +0300
commit9c38d181d40b9d27f8f42152c18e7c70bfffcf37 (patch)
treec3e766f409c03093d47a826f7d8c123e3fa9cc48
parenta1202a31ed8c35705bd09fe91c3e7410c619bd70 (diff)
api_like_OAI.py : simplify function (#2796)
Simplify function
-rwxr-xr-xexamples/server/api_like_OAI.py8
1 files changed, 1 insertions, 7 deletions
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):