entari-plugin-hyw 4.0.0rc13__tar.gz → 4.0.0rc14__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of entari-plugin-hyw might be problematic. Click here for more details.

Files changed (78) hide show
  1. {entari_plugin_hyw-4.0.0rc13/src/entari_plugin_hyw.egg-info → entari_plugin_hyw-4.0.0rc14}/PKG-INFO +1 -1
  2. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/pyproject.toml +1 -1
  3. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14/src/entari_plugin_hyw.egg-info}/PKG-INFO +1 -1
  4. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/agent.py +89 -26
  5. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/MANIFEST.in +0 -0
  6. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/README.md +0 -0
  7. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/setup.cfg +0 -0
  8. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/entari_plugin_hyw/Untitled-1 +0 -0
  9. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/entari_plugin_hyw/__init__.py +0 -0
  10. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/entari_plugin_hyw/filters.py +0 -0
  11. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/entari_plugin_hyw/history.py +0 -0
  12. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/entari_plugin_hyw/misc.py +0 -0
  13. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/entari_plugin_hyw/search_cache.py +0 -0
  14. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/entari_plugin_hyw.egg-info/SOURCES.txt +0 -0
  15. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/entari_plugin_hyw.egg-info/dependency_links.txt +0 -0
  16. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/entari_plugin_hyw.egg-info/requires.txt +0 -0
  17. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/entari_plugin_hyw.egg-info/top_level.txt +0 -0
  18. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/__init__.py +0 -0
  19. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/__init__.py +0 -0
  20. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/card-dist/index.html +0 -0
  21. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/card-dist/logos/anthropic.svg +0 -0
  22. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/card-dist/logos/cerebras.svg +0 -0
  23. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/card-dist/logos/deepseek.png +0 -0
  24. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/card-dist/logos/gemini.svg +0 -0
  25. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/card-dist/logos/google.svg +0 -0
  26. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/card-dist/logos/grok.png +0 -0
  27. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/card-dist/logos/huggingface.png +0 -0
  28. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/card-dist/logos/microsoft.svg +0 -0
  29. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/card-dist/logos/minimax.png +0 -0
  30. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/card-dist/logos/mistral.png +0 -0
  31. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/card-dist/logos/nvida.png +0 -0
  32. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/card-dist/logos/openai.svg +0 -0
  33. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/card-dist/logos/openrouter.png +0 -0
  34. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/card-dist/logos/perplexity.svg +0 -0
  35. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/card-dist/logos/qwen.png +0 -0
  36. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/card-dist/logos/xai.png +0 -0
  37. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/card-dist/logos/xiaomi.png +0 -0
  38. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/card-dist/logos/zai.png +0 -0
  39. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/card-dist/vite.svg +0 -0
  40. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/index.html +0 -0
  41. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/logos/anthropic.svg +0 -0
  42. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/logos/cerebras.svg +0 -0
  43. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/logos/deepseek.png +0 -0
  44. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/logos/gemini.svg +0 -0
  45. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/logos/google.svg +0 -0
  46. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/logos/grok.png +0 -0
  47. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/logos/huggingface.png +0 -0
  48. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/logos/microsoft.svg +0 -0
  49. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/logos/minimax.png +0 -0
  50. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/logos/mistral.png +0 -0
  51. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/logos/nvida.png +0 -0
  52. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/logos/openai.svg +0 -0
  53. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/logos/openrouter.png +0 -0
  54. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/logos/perplexity.svg +0 -0
  55. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/logos/qwen.png +0 -0
  56. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/logos/xai.png +0 -0
  57. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/logos/xiaomi.png +0 -0
  58. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/assets/logos/zai.png +0 -0
  59. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/engines/__init__.py +0 -0
  60. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/engines/base.py +0 -0
  61. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/engines/default.py +0 -0
  62. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/engines/duckduckgo.py +0 -0
  63. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/landing.html +0 -0
  64. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/manager.py +0 -0
  65. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/renderer.py +0 -0
  66. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/browser_control/service.py +0 -0
  67. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/config.py +0 -0
  68. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/core.py +0 -0
  69. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/crawling/__init__.py +0 -0
  70. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/crawling/completeness.py +0 -0
  71. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/crawling/models.py +0 -0
  72. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/definitions.py +0 -0
  73. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/image_cache.py +0 -0
  74. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/pipeline.py +0 -0
  75. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/search.py +0 -0
  76. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/stages/__init__.py +0 -0
  77. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/stages/base.py +0 -0
  78. {entari_plugin_hyw-4.0.0rc13 → entari_plugin_hyw-4.0.0rc14}/src/hyw_core/stages/summary.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: entari_plugin_hyw
3
- Version: 4.0.0rc13
3
+ Version: 4.0.0rc14
4
4
  Summary: Use large language models to interpret chat messages
5
5
  Author-email: kumoSleeping <zjr2992@outlook.com>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "entari_plugin_hyw"
7
- version = "4.0.0-rc13"
7
+ version = "4.0.0-rc14"
8
8
  description = "Use large language models to interpret chat messages"
9
9
  authors = [{name = "kumoSleeping", email = "zjr2992@outlook.com"}]
10
10
  dependencies = [
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: entari_plugin_hyw
3
- Version: 4.0.0rc13
3
+ Version: 4.0.0rc14
4
4
  Summary: Use large language models to interpret chat messages
5
5
  Author-email: kumoSleeping <zjr2992@outlook.com>
6
6
  License: MIT
@@ -141,6 +141,8 @@ class AgentPipeline:
141
141
 
142
142
  MAX_TOOL_ROUNDS = 2 # Maximum rounds of tool calls
143
143
  MAX_PARALLEL_TOOLS = 3 # Maximum parallel tool calls per round
144
+ MAX_LLM_RETRIES = 3 # Maximum retries for empty API responses
145
+ LLM_RETRY_DELAY = 1.0 # Delay between retries in seconds
144
146
 
145
147
  def __init__(
146
148
  self,
@@ -247,38 +249,88 @@ class AgentPipeline:
247
249
  })
248
250
 
249
251
 
250
- # Final call without tools
251
- response = await client.chat.completions.create(
252
- model=model,
253
- messages=session.messages,
254
- temperature=self.config.temperature,
255
- )
252
+ # Final call without tools (with retry)
253
+ response = None
254
+ for retry in range(self.MAX_LLM_RETRIES):
255
+ try:
256
+ response = await client.chat.completions.create(
257
+ model=model,
258
+ messages=session.messages,
259
+ temperature=self.config.temperature,
260
+ )
261
+
262
+ if response.usage:
263
+ usage_totals["input_tokens"] += response.usage.prompt_tokens or 0
264
+ usage_totals["output_tokens"] += response.usage.completion_tokens or 0
265
+
266
+ # Check for valid response
267
+ if response.choices:
268
+ break # Success, exit retry loop
269
+
270
+ # Empty choices, retry
271
+ logger.warning(f"AgentPipeline: Empty choices in force-summary (attempt {retry + 1}/{self.MAX_LLM_RETRIES}): {response}")
272
+ if retry < self.MAX_LLM_RETRIES - 1:
273
+ await asyncio.sleep(self.LLM_RETRY_DELAY)
274
+ except Exception as e:
275
+ logger.warning(f"AgentPipeline: LLM error (attempt {retry + 1}/{self.MAX_LLM_RETRIES}): {e}")
276
+ if retry < self.MAX_LLM_RETRIES - 1:
277
+ await asyncio.sleep(self.LLM_RETRY_DELAY)
278
+ else:
279
+ return {
280
+ "llm_response": f"Error: {e}",
281
+ "success": False,
282
+ "error": str(e),
283
+ "stats": {"total_time": time.time() - start_time}
284
+ }
256
285
 
257
- if response.usage:
258
- usage_totals["input_tokens"] += response.usage.prompt_tokens or 0
259
- usage_totals["output_tokens"] += response.usage.completion_tokens or 0
286
+ # Final check after all retries
287
+ if not response or not response.choices:
288
+ logger.error(f"AgentPipeline: All retries failed for force-summary")
289
+ return {
290
+ "llm_response": "抱歉,AI 服务返回了空响应,请稍后重试。",
291
+ "success": False,
292
+ "error": "Empty response from API after retries",
293
+ "stats": {"total_time": time.time() - start_time},
294
+ "usage": usage_totals,
295
+ }
260
296
 
261
297
  final_content = response.choices[0].message.content or ""
262
298
  break
263
299
 
264
- # Normal call with tools
300
+ # Normal call with tools (with retry)
265
301
  llm_start = time.time()
266
- try:
267
- response = await client.chat.completions.create(
268
- model=model,
269
- messages=session.messages,
270
- temperature=self.config.temperature,
271
- tools=tools,
272
- tool_choice="auto",
273
- )
274
- except Exception as e:
275
- logger.error(f"AgentPipeline: LLM error: {e}")
276
- return {
277
- "llm_response": f"Error: {e}",
278
- "success": False,
279
- "error": str(e),
280
- "stats": {"total_time": time.time() - start_time}
281
- }
302
+ response = None
303
+
304
+ for retry in range(self.MAX_LLM_RETRIES):
305
+ try:
306
+ response = await client.chat.completions.create(
307
+ model=model,
308
+ messages=session.messages,
309
+ temperature=self.config.temperature,
310
+ tools=tools,
311
+ tool_choice="auto",
312
+ )
313
+
314
+ # Check for valid response
315
+ if response.choices:
316
+ break # Success, exit retry loop
317
+
318
+ # Empty choices, retry
319
+ logger.warning(f"AgentPipeline: Empty choices (attempt {retry + 1}/{self.MAX_LLM_RETRIES}): {response}")
320
+ if retry < self.MAX_LLM_RETRIES - 1:
321
+ await asyncio.sleep(self.LLM_RETRY_DELAY)
322
+ except Exception as e:
323
+ logger.warning(f"AgentPipeline: LLM error (attempt {retry + 1}/{self.MAX_LLM_RETRIES}): {e}")
324
+ if retry < self.MAX_LLM_RETRIES - 1:
325
+ await asyncio.sleep(self.LLM_RETRY_DELAY)
326
+ else:
327
+ logger.error(f"AgentPipeline: All retries failed: {e}")
328
+ return {
329
+ "llm_response": f"Error: {e}",
330
+ "success": False,
331
+ "error": str(e),
332
+ "stats": {"total_time": time.time() - start_time}
333
+ }
282
334
 
283
335
  llm_duration = time.time() - llm_start
284
336
  session.llm_time += llm_duration
@@ -287,6 +339,17 @@ class AgentPipeline:
287
339
  if session.call_count == 0 and session.first_llm_time == 0:
288
340
  session.first_llm_time = llm_duration
289
341
 
342
+ # Final check after all retries
343
+ if not response or not response.choices:
344
+ logger.error(f"AgentPipeline: All retries failed, empty choices")
345
+ return {
346
+ "llm_response": "抱歉,AI 服务返回了空响应,请稍后重试。",
347
+ "success": False,
348
+ "error": "Empty response from API after retries",
349
+ "stats": {"total_time": time.time() - start_time},
350
+ "usage": usage_totals,
351
+ }
352
+
290
353
  if response.usage:
291
354
  usage_totals["input_tokens"] += response.usage.prompt_tokens or 0
292
355
  usage_totals["output_tokens"] += response.usage.completion_tokens or 0