| | |
| | | |
| | | async def chat_completions(self, url, data, headers): |
| | | complete_response = "" |
| | | # print(data) |
| | | async for line in self.http_stream(url, data, headers): |
| | | # logger.error(line) |
| | | if line.startswith("data:"): |
| | |
| | | "files": files |
| | | } |
| | | |
| | | @staticmethod |
| | | async def complex_request_data(query: str, conversation_id: str, user: str, files: list=None, inputs: dict=None) -> dict: |
| | | if not files: |
| | | files = [] |
| | | if not inputs: |
| | | inputs = {} |
| | | return { |
| | | "inputs": inputs, |
| | | "query": query, |
| | | "response_mode": "streaming", |
| | | "conversation_id": conversation_id, |
| | | "user": user, |
| | | "files": files |
| | | } |
| | | |
| | | |
| | | if __name__ == "__main__": |
| | | async def aa(): |