File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -66,13 +66,14 @@ def _init_llm(self) -> VLLMOpenAI:
6666 openai_api_key = self .config .api_key or 'Empty' ,
6767 openai_api_base = self .config .api_base_url ,
6868 model_name = self .config .model_name ,
69+ streaming = True ,
6970 ** self .config .additional_params ,
7071 )
7172class OpenAILLM (BaseLLM ):
7273 def _init_llm (self ) -> BaseChatModel :
7374 return BaseChatOpenAI (
7475 model = self .config .model_name ,
75- api_key = self .config .api_key ,
76+ api_key = self .config .api_key or 'Empty' ,
7677 base_url = self .config .api_base_url ,
7778 stream_usage = True ,
7879 ** self .config .additional_params ,
Original file line number Diff line number Diff line change @@ -28,7 +28,10 @@ async def generate():
2828 )
2929 llm_instance = LLMFactory .create_llm (config )
3030 async for chunk in llm_instance .llm .astream ("1+1=?" ):
31- if chunk and chunk .content :
31+ SQLBotLogUtil .info (chunk )
32+ if chunk and isinstance (chunk , str ):
33+ yield json .dumps ({"content" : chunk }) + "\n "
34+ if chunk and isinstance (chunk , dict ) and chunk .content :
3235 yield json .dumps ({"content" : chunk .content }) + "\n "
3336
3437 except Exception as e :
You can’t perform that action at this time.
0 commit comments