| 12345678910111213141516171819202122 |
- # Please install OpenAI SDK first: `pip3 install openai`
- from openai import OpenAI
- client = OpenAI(api_key="sk-175159668af9430ea6208f5636b24198", base_url="https://api.deepseek.com")
- content = """
- 2025-03-11 20:48:12,451 - {"timestamp": "2025-03-11T20:48:12.451014", "data": {"message": ["Duplicati Backup report for vol1 (1c81f7e35e9a491d8b3ac149a65bc42e, DB-1, eb215a47f67b)\n\nDeletedFiles: 0\nDeletedFolders: 0\nModifiedFiles: 0\nExaminedFiles: 3\nOpenedFiles: 0\nAddedFiles: 0\nSizeOfModifiedFiles: 0\nSizeOfAddedFiles: 0\nSizeOfExaminedFiles: 759437\nSizeOfOpenedFiles: 0\nNotProcessedFiles: 0\nAddedFolders: 0\nTooLargeFiles: 0\nFilesWithError: 0\nModifiedFolders: 0\nModifiedSymlinks: 0\nAddedSymlinks: 0\nDeletedSymlinks: 0\nPartialBackup: False\nDryrun: False\nMainOperation: Backup\nParsedResult: Success\nInterrupted: False\nFatal: False\nVersion: 2.1.0.4 (2.1.0.4_stable_2025-01-31)\nEndTime: 3/11/2025 8:48:12\u202fPM (1741697292)\nBeginTime: 3/11/2025 8:48:12\u202fPM (1741697292)\nDuration: 00:00:00.2575008\nMessagesActualLength: 12\nWarningsActualLength: 0\nErrorsActualLength: 0\nLimitedMessages: [\n 2025-03-11 20:48:12 +08 - [Information-Duplicati.Library.Main.Controller-StartingOperation]: The operation Backup has started,\n 2025-03-11 20:48:12 +08 - [Information-Duplicati.Library.Main.BasicResults-BackendEvent]: Backend event: List - Started: (),\n 2025-03-11 20:48:12 +08 - [Information-Duplicati.Library.Main.BasicResults-BackendEvent]: Backend event: List - Completed: (12 bytes),\n 2025-03-11 20:48:12 +08 - [Information-Duplicati.Library.Main.BasicResults-BackendEvent]: Backend event: List - Started: (),\n 2025-03-11 20:48:12 +08 - [Information-Duplicati.Library.Main.BasicResults-BackendEvent]: Backend event: List - Completed: (12 bytes),\n 2025-03-11 20:48:12 +08 - [Information-Duplicati.Library.Main.BasicResults-BackendEvent]: Backend event: Get - Started: duplicati-20250309T111453Z.dlist.zip (836 bytes),\n 2025-03-11 20:48:12 +08 - [Information-Duplicati.Library.Main.BasicResults-BackendEvent]: Backend event: Get - Completed: duplicati-20250309T111453Z.dlist.zip (836 bytes),\n 2025-03-11 20:48:12 +08 - [Information-Duplicati.Library.Main.BasicResults-BackendEvent]: Backend event: Get - Started: duplicati-i6193d5c8b721428d842a4e18273aba16.dindex.zip (746 bytes),\n 2025-03-11 20:48:12 +08 - [Information-Duplicati.Library.Main.BasicResults-BackendEvent]: Backend event: Get - Completed: duplicati-i6193d5c8b721428d842a4e18273aba16.dindex.zip (746 bytes),\n 2025-03-11 20:48:12 +08 - [Information-Duplicati.Library.Main.BasicResults-BackendEvent]: Backend event: Get - Started: duplicati-b525ff5bb2fe44b9c84e2a0db4d478716.dblock.zip (263.423 KB),\n...\n]\nLimitedWarnings: []\nLimitedErrors: []"]}}
-
-
- """
- response = client.chat.completions.create(
- model="deepseek-chat",
- messages=[
- {"role": "system", "content": "ou are an operator analyzing backup logs. Check the log message for abnormalities and respond with 'normal' or 'abnormal'.If the backup is abnormal, provide a detailed diagnostic message explaining the issue and suggesting possible fixes"},
- {"role": "user", "content": content},
- ],
- temperature=0.7,
- stream=False
- )
- print(response.choices[0].message.content)
|