Skip to content

Commit

Permalink
api_like_OAI.py : compat with Microsoft Guidance (ggerganov#2746)
Browse files Browse the repository at this point in the history
Check for None in addition to empty string check in all request params

Co-authored-by: Georgi Gerganov <[email protected]>
  • Loading branch information
ryderwishart and ggerganov authored Oct 8, 2023
1 parent 9c38d18 commit 8e6716a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion examples/server/api_like_OAI.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@
args = parser.parse_args()

def is_present(json, key):
return key in json
try:
buf = json[key]
except KeyError:
return False
if json[key] == None:
return False
return True

#convert chat to prompt
def convert_chat(messages):
Expand Down

0 comments on commit 8e6716a

Please sign in to comment.