imbajin commented on code in PR #76:
URL: 
https://github.com/apache/incubator-hugegraph-ai/pull/76#discussion_r1740043293


##########
hugegraph-llm/src/hugegraph_llm/utils/decorators.py:
##########
@@ -76,3 +76,15 @@ def wrapper(*args: Any, **kwargs: Any) -> Any:
             log.debug("Context:\n%s", result)
         return result
     return wrapper
+
+
+def log_llm_qps(func: Callable) -> Callable:
+    @wraps(func)
+    def wrapper(*args: Any, **kwargs: Any) -> Any:
+        start = time.perf_counter()
+        result = func(*args, **kwargs)
+        call_count = result.get("call_count", 0)
+        qps = call_count / (time.perf_counter() - start)
+        log.debug("%s LLM QPS: %.2f", args[0].__class__.__name__, qps)

Review Comment:
   ignore time gap < 0.10



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to