mirror of
				https://github.com/csunny/DB-GPT.git
				synced 2025-10-31 14:56:04 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			21 lines
		
	
	
		
			602 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			602 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| import asyncio
 | |
| 
 | |
| from starlette.responses import StreamingResponse
 | |
| 
 | |
| from pilot.scene.base_chat import BaseChat
 | |
| from pilot.scene.chat_factory import ChatFactory
 | |
| 
 | |
| chat_factory = ChatFactory()
 | |
| 
 | |
| 
 | |
| async def llm_chat_response_nostream(chat_scene: str, **chat_param):
 | |
|     """llm_chat_response_nostream"""
 | |
|     chat: BaseChat = chat_factory.get_implementation(chat_scene, **chat_param)
 | |
|     res = await chat.get_llm_response()
 | |
|     return res
 | |
| 
 | |
| 
 | |
| async def llm_chat_response(chat_scene: str, **chat_param):
 | |
|     chat: BaseChat = chat_factory.get_implementation(chat_scene, **chat_param)
 | |
|     return chat.stream_call()
 |