Skip to content

Commit 8e6716a

Browse files
api_like_OAI.py : compat with Microsoft Guidance (#2746)
Check for None in addition to empty string check in all request params Co-authored-by: Georgi Gerganov <[email protected]>
1 parent 9c38d18 commit 8e6716a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

examples/server/api_like_OAI.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,13 @@
2323
args = parser.parse_args()
2424

2525
def is_present(json, key):
26-
return key in json
26+
try:
27+
buf = json[key]
28+
except KeyError:
29+
return False
30+
if json[key] == None:
31+
return False
32+
return True
2733

2834
#convert chat to prompt
2935
def convert_chat(messages):

0 commit comments

Comments
 (0)