← back to Exo
consistent remove _secs / -secs suffix
56c1bf9a956aff1b97789b16a9184033f3979a62 · 2024-09-04 16:54:00 +0100 · Alex Cheema
Files touched
M exo/api/chatgpt_api.pyM main.py
Diff
commit 56c1bf9a956aff1b97789b16a9184033f3979a62
Author: Alex Cheema <alexcheema123@gmail.com>
Date: Wed Sep 4 16:54:00 2024 +0100
consistent remove _secs / -secs suffix
---
exo/api/chatgpt_api.py | 10 +++++-----
main.py | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/exo/api/chatgpt_api.py b/exo/api/chatgpt_api.py
index b34589d2..d97bd0ca 100644
--- a/exo/api/chatgpt_api.py
+++ b/exo/api/chatgpt_api.py
@@ -153,10 +153,10 @@ class PromptSession:
class ChatGPTAPI:
- def __init__(self, node: Node, inference_engine_classname: str, response_timeout_secs: int = 90, on_chat_completion_request: Callable[[str, ChatCompletionRequest, str], None] = None):
+ def __init__(self, node: Node, inference_engine_classname: str, response_timeout: int = 90, on_chat_completion_request: Callable[[str, ChatCompletionRequest, str], None] = None):
self.node = node
self.inference_engine_classname = inference_engine_classname
- self.response_timeout_secs = response_timeout_secs
+ self.response_timeout = response_timeout
self.on_chat_completion_request = on_chat_completion_request
self.app = web.Application(client_max_size=100*1024*1024) # 100MB to support image upload
self.prompts: PrefixDict[str, PromptSession] = PrefixDict()
@@ -255,7 +255,7 @@ class ChatGPTAPI:
return web.json_response({"detail": f"Error processing prompt (see logs with DEBUG>=2): {str(e)}"}, status=500)
try:
- if DEBUG >= 2: print(f"Waiting for response to finish. timeout={self.response_timeout_secs}s")
+ if DEBUG >= 2: print(f"Waiting for response to finish. timeout={self.response_timeout}s")
if stream:
response = web.StreamResponse(
@@ -304,7 +304,7 @@ class ChatGPTAPI:
return _request_id == request_id and is_finished
- _, tokens, _ = await callback.wait(on_result, timeout=self.response_timeout_secs)
+ _, tokens, _ = await callback.wait(on_result, timeout=self.response_timeout)
if request_id in self.stream_tasks: # in case there is still a stream task running, wait for it to complete
if DEBUG >= 2: print("Pending stream task. Waiting for stream task to complete.")
try:
@@ -316,7 +316,7 @@ class ChatGPTAPI:
else:
_, tokens, _ = await callback.wait(
lambda _request_id, tokens, is_finished: _request_id == request_id and is_finished,
- timeout=self.response_timeout_secs,
+ timeout=self.response_timeout,
)
finish_reason = "length"
diff --git a/main.py b/main.py
index 51a4eda1..3c5db2cc 100644
--- a/main.py
+++ b/main.py
@@ -83,7 +83,7 @@ node.server = server
api = ChatGPTAPI(
node,
inference_engine.__class__.__name__,
- response_timeout_secs=args.chatgpt_api_response_timeout_secs,
+ response_timeout=args.chatgpt_api_response_timeout,
on_chat_completion_request=lambda req_id, __, prompt: topology_viz.update_prompt(req_id, prompt) if topology_viz else None
)
node.on_token.register("update_topology_viz").on_next(
← f342cdca get rid of -secs suffix
·
back to Exo
·
circleci use tee to output logs in realtime as well as captu 4537d614 →