8000 Merge branch 'main' of github.com:abetlen/llama_cpp_python into main · AB1Dev/llama-cpp-python@cf8ae5a · GitHub
[go: up one dir, main page]

Skip to content

Commit cf8ae5a

Browse files
committed
Merge branch 'main' of github.com:abetlen/llama_cpp_python into main
2 parents 5da5773 + 3d5e5b1 commit cf8ae5a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

llama_cpp/server/app.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import json
22
import multiprocessing
3+
import time
34
from re import compile, Match, Pattern
45
from threading import Lock
56
from functools import partial
@@ -271,7 +272,11 @@ def get_route_handler(
271272

272273
async def custom_route_handler(request: Request) -> Response:
273274
try:
274-
return await original_route_handler(request)
275+
start_sec = time.perf_counter()
276+
response = await original_route_handler(request)
277+
elapsed_time_ms = int((time.perf_counter() - start_sec) * 1000)
278+
response.headers["openai-processing-ms"] = f"{elapsed_time_ms}"
279+
return response
275280
except Exception as exc:
276281
json_body = await request.json()
277282
try:

0 commit comments

Comments
 (0)
0