Skip to content

Commit 871309c

Browse files
committed
removed flow support
1 parent 0742765 commit 871309c

File tree

1 file changed

+10
-22
lines changed

1 file changed

+10
-22
lines changed

osbot_llms/fast_api/routes/Routes__Chat.py

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33

44
from fastapi import Request
55
from fastapi.params import Header
6-
from osbot_utils.helpers.flows.Flow import Flow
7-
from osbot_utils.helpers.flows.decorators.flow import flow
8-
from osbot_utils.helpers.flows.models.Flow_Run__Config import Flow_Run__Config
96
from starlette.responses import StreamingResponse
107
from osbot_fast_api.api.Fast_API_Routes import Fast_API_Routes
118
from osbot_utils.context_managers.capture_duration import capture_duration
@@ -33,35 +30,26 @@ def execute_llm_request(self, llm_chat_completion):
3330
return 'no engine'
3431

3532
async def handle_other_llms(self, llm_chat_completion: LLMs__Chat_Completion, request: Request, request_id: str):
36-
@flow(flow_config=Flow_Run__Config(log_to_console=True))
37-
def handle_other_llms__streamer() -> Flow:
33+
def handle_other_llms__streamer():
3834
print("in handle_other_llms__streamer")
3935
print(llm_chat_completion.json())
4036
return StreamingResponse(self.handle_other_llms__streamer(llm_chat_completion, request, request_id),media_type='text/event-stream"; charset=utf-8')
4137

4238
stream = llm_chat_completion.stream
4339
if stream:
44-
with handle_other_llms__streamer() as _:
45-
_.execute_flow()
46-
return _.flow_return_value
40+
return handle_other_llms__streamer()
4741
else:
4842
return await self.handle_other_llms__no_stream(llm_chat_completion, request, request_id)
4943

5044
async def handle_other_llms__no_stream(self, llm_chat_completion: LLMs__Chat_Completion, request: Request, request_id: str):
51-
@flow(flow_config=Flow_Run__Config(log_to_console=True))
52-
def flow_handle_other_llms__no_stream() -> Flow:
53-
print("in handle_other_llms__streamer")
54-
print(llm_chat_completion.json())
55-
complete_answer = self.execute_llm_request(llm_chat_completion)
56-
try:
57-
llm_chat_completion.llm_answer = complete_answer
58-
except:
59-
pass
60-
return complete_answer
61-
62-
with flow_handle_other_llms__no_stream() as _:
63-
_.execute_flow()
64-
return _.flow_return_value
45+
print("in handle_other_llms__streamer")
46+
print(llm_chat_completion.json())
47+
complete_answer = self.execute_llm_request(llm_chat_completion)
48+
try:
49+
llm_chat_completion.llm_answer = complete_answer
50+
except:
51+
pass
52+
return complete_answer
6553

6654

6755
async def handle_other_llms__streamer(self, llm_chat_completion: LLMs__Chat_Completion, request: Request, request_id: str):

0 commit comments

Comments
 (0)