ChienChung commited on
Commit
351df55
·
verified ·
1 Parent(s): 1fdb60f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -5
app.py CHANGED
@@ -1291,11 +1291,33 @@ def autogen_multi_document_analysis(query: str, docs: list, file_names: list) ->
1291
  for name, doc in zip(file_names, docs)
1292
  )
1293
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1294
  # 定義代理人
1295
  user_proxy = UserProxyAgent(
1296
  name="User",
1297
  system_message="A user seeking information from multiple documents.",
1298
- human_input_mode="NEVER"
 
1299
  )
1300
 
1301
  # 定義專家代理人們
@@ -1308,7 +1330,7 @@ def autogen_multi_document_analysis(query: str, docs: list, file_names: list) ->
1308
  3. Identifying key differences and similarities
1309
  4. Analyzing project connections
1310
  Always provide evidence from the documents.""",
1311
- llm_config={"config_list": [{"model": "gpt-4", "api_key": openai_api_key}]}
1312
  ),
1313
  AssistantAgent(
1314
  name="QAExpert",
@@ -1317,7 +1339,7 @@ def autogen_multi_document_analysis(query: str, docs: list, file_names: list) ->
1317
  2. Finding relevant information
1318
  3. Cross-referencing content
1319
  Always cite specific parts of the documents.""",
1320
- llm_config={"config_list": [{"model": "gpt-4", "api_key": openai_api_key}]}
1321
  ),
1322
  AssistantAgent(
1323
  name="Summarizer",
@@ -1326,7 +1348,7 @@ def autogen_multi_document_analysis(query: str, docs: list, file_names: list) ->
1326
  2. Identifying main points
1327
  3. Highlighting key findings
1328
  Focus on clarity and completeness.""",
1329
- llm_config={"config_list": [{"model": "gpt-4", "api_key": openai_api_key}]}
1330
  )
1331
  ]
1332
 
@@ -1337,7 +1359,10 @@ def autogen_multi_document_analysis(query: str, docs: list, file_names: list) ->
1337
  max_round=5
1338
  )
1339
 
1340
- manager = GroupChatManager(groupchat=groupchat)
 
 
 
1341
 
1342
  # 準備任務提示
1343
  task_prompt = f"""Analyze these documents and answer the query:
 
1291
  for name, doc in zip(file_names, docs)
1292
  )
1293
 
1294
+ # 配置 LLM
1295
+ config_list = [{
1296
+ "model": "gpt-4",
1297
+ "api_key": openai_api_key
1298
+ }]
1299
+
1300
+ # 基礎配置
1301
+ llm_config = {
1302
+ "config_list": config_list,
1303
+ "temperature": 0,
1304
+ "request_timeout": 120,
1305
+ "seed": 42
1306
+ }
1307
+
1308
+ # 代碼執行配置
1309
+ code_execution_config = {
1310
+ "use_docker": False, # 禁用 Docker
1311
+ "last_n_messages": 3,
1312
+ "timeout": 60
1313
+ }
1314
+
1315
  # 定義代理人
1316
  user_proxy = UserProxyAgent(
1317
  name="User",
1318
  system_message="A user seeking information from multiple documents.",
1319
+ human_input_mode="NEVER",
1320
+ code_execution_config=code_execution_config # 使用代碼執行配置
1321
  )
1322
 
1323
  # 定義專家代理人們
 
1330
  3. Identifying key differences and similarities
1331
  4. Analyzing project connections
1332
  Always provide evidence from the documents.""",
1333
+ llm_config=llm_config
1334
  ),
1335
  AssistantAgent(
1336
  name="QAExpert",
 
1339
  2. Finding relevant information
1340
  3. Cross-referencing content
1341
  Always cite specific parts of the documents.""",
1342
+ llm_config=llm_config
1343
  ),
1344
  AssistantAgent(
1345
  name="Summarizer",
 
1348
  2. Identifying main points
1349
  3. Highlighting key findings
1350
  Focus on clarity and completeness.""",
1351
+ llm_config=llm_config
1352
  )
1353
  ]
1354
 
 
1359
  max_round=5
1360
  )
1361
 
1362
+ manager = GroupChatManager(
1363
+ groupchat=groupchat,
1364
+ llm_config=llm_config
1365
+ )
1366
 
1367
  # 準備任務提示
1368
  task_prompt = f"""Analyze these documents and answer the query: