Update api/routes.py
Browse files- api/routes.py +12 -1
api/routes.py
CHANGED
@@ -49,6 +49,11 @@ async def chat_completions(
|
|
49 |
logger.info("Non-streaming response")
|
50 |
return await process_non_streaming_response(request)
|
51 |
|
|
|
|
|
|
|
|
|
|
|
52 |
@router.route('/us/')
|
53 |
@router.route('/us/healthz')
|
54 |
@router.route('/us/ready')
|
@@ -63,4 +68,10 @@ def health_check(request: Request):
|
|
63 |
}),
|
64 |
media_type="application/json",
|
65 |
status_code=421 # Changing the status code to 421
|
66 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
logger.info("Non-streaming response")
|
50 |
return await process_non_streaming_response(request)
|
51 |
|
52 |
+
# New function calling logic
|
53 |
+
if request.function_call:
|
54 |
+
logger.info("Handling function call")
|
55 |
+
return await handle_function_call(request)
|
56 |
+
|
57 |
@router.route('/us/')
|
58 |
@router.route('/us/healthz')
|
59 |
@router.route('/us/ready')
|
|
|
68 |
}),
|
69 |
media_type="application/json",
|
70 |
status_code=421 # Changing the status code to 421
|
71 |
+
)
|
72 |
+
|
73 |
+
async def handle_function_call(request: ChatRequest):
|
74 |
+
# Placeholder for function calling logic
|
75 |
+
logger.info("Handling function call for model: {}".format(request.model))
|
76 |
+
logger.info("Function call details: {}".format(request.function_call_details))
|
77 |
+
return {"message": "Function call handled successfully", "details": request.function_call_details}
|