auto-coder 0.1.203__tar.gz → 0.1.204__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 auto-coder might be problematic. Click here for more details.

Files changed (125) hide show
  1. {auto_coder-0.1.203 → auto_coder-0.1.204}/PKG-INFO +1 -1
  2. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/auto_coder.egg-info/PKG-INFO +1 -1
  3. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/auto_coder_rag.py +34 -0
  4. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/common/code_auto_generate.py +1 -1
  5. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/common/code_auto_generate_diff.py +1 -1
  6. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/common/code_auto_generate_editblock.py +1 -1
  7. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/common/code_auto_generate_strict_diff.py +1 -1
  8. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/common/sys_prompt.py +1 -1
  9. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/rag/doc_filter.py +27 -9
  10. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/rag/long_context_rag.py +11 -5
  11. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/rag/token_limiter.py +7 -3
  12. auto_coder-0.1.204/src/autocoder/version.py +1 -0
  13. auto_coder-0.1.203/src/autocoder/version.py +0 -1
  14. {auto_coder-0.1.203 → auto_coder-0.1.204}/LICENSE +0 -0
  15. {auto_coder-0.1.203 → auto_coder-0.1.204}/README.md +0 -0
  16. {auto_coder-0.1.203 → auto_coder-0.1.204}/setup.cfg +0 -0
  17. {auto_coder-0.1.203 → auto_coder-0.1.204}/setup.py +0 -0
  18. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/auto_coder.egg-info/SOURCES.txt +0 -0
  19. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/auto_coder.egg-info/dependency_links.txt +0 -0
  20. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/auto_coder.egg-info/entry_points.txt +0 -0
  21. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/auto_coder.egg-info/requires.txt +0 -0
  22. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/auto_coder.egg-info/top_level.txt +0 -0
  23. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/__init__.py +0 -0
  24. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/agent/__init__.py +0 -0
  25. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/agent/auto_tool.py +0 -0
  26. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/agent/coder.py +0 -0
  27. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/agent/designer.py +0 -0
  28. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/agent/planner.py +0 -0
  29. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/agent/project_reader.py +0 -0
  30. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/auto_coder.py +0 -0
  31. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/auto_coder_lang.py +0 -0
  32. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/auto_coder_server.py +0 -0
  33. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/chat/__init__.py +0 -0
  34. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/chat_auto_coder.py +0 -0
  35. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/chat_auto_coder_lang.py +0 -0
  36. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/command_args.py +0 -0
  37. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/common/JupyterClient.py +0 -0
  38. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/common/ShellClient.py +0 -0
  39. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/common/__init__.py +0 -0
  40. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/common/anything2images.py +0 -0
  41. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/common/audio.py +0 -0
  42. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/common/cleaner.py +0 -0
  43. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/common/code_auto_execute.py +0 -0
  44. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/common/code_auto_merge.py +0 -0
  45. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/common/code_auto_merge_diff.py +0 -0
  46. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/common/code_auto_merge_editblock.py +0 -0
  47. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/common/code_auto_merge_strict_diff.py +0 -0
  48. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/common/command_completer.py +0 -0
  49. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/common/command_generator.py +0 -0
  50. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/common/command_templates.py +0 -0
  51. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/common/const.py +0 -0
  52. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/common/git_utils.py +0 -0
  53. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/common/image_to_page.py +0 -0
  54. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/common/interpreter.py +0 -0
  55. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/common/llm_rerank.py +0 -0
  56. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/common/screenshots.py +0 -0
  57. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/common/search.py +0 -0
  58. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/common/search_replace.py +0 -0
  59. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/common/text.py +0 -0
  60. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/common/types.py +0 -0
  61. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/db/__init__.py +0 -0
  62. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/db/store.py +0 -0
  63. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/dispacher/__init__.py +0 -0
  64. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/dispacher/actions/__init__.py +0 -0
  65. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/dispacher/actions/action.py +0 -0
  66. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/dispacher/actions/copilot.py +0 -0
  67. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/dispacher/actions/plugins/__init__.py +0 -0
  68. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/dispacher/actions/plugins/action_regex_project.py +0 -0
  69. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/dispacher/actions/plugins/action_translate.py +0 -0
  70. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/index/__init__.py +0 -0
  71. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/index/for_command.py +0 -0
  72. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/index/index.py +0 -0
  73. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/index/symbols_utils.py +0 -0
  74. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/lang.py +0 -0
  75. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/pyproject/__init__.py +0 -0
  76. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/rag/__init__.py +0 -0
  77. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/rag/api_server.py +0 -0
  78. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/rag/cache/__init__.py +0 -0
  79. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/rag/cache/base_cache.py +0 -0
  80. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/rag/cache/byzer_storage_cache.py +0 -0
  81. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/rag/cache/file_monitor_cache.py +0 -0
  82. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/rag/cache/simple_cache.py +0 -0
  83. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/rag/document_retriever.py +0 -0
  84. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/rag/llm_wrapper.py +0 -0
  85. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/rag/loaders/__init__.py +0 -0
  86. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/rag/loaders/docx_loader.py +0 -0
  87. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/rag/loaders/excel_loader.py +0 -0
  88. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/rag/loaders/pdf_loader.py +0 -0
  89. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/rag/loaders/ppt_loader.py +0 -0
  90. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/rag/rag_config.py +0 -0
  91. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/rag/rag_entry.py +0 -0
  92. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/rag/raw_rag.py +0 -0
  93. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/rag/relevant_utils.py +0 -0
  94. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/rag/simple_directory_reader.py +0 -0
  95. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/rag/simple_rag.py +0 -0
  96. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/rag/stream_event/__init__.py +0 -0
  97. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/rag/stream_event/event_writer.py +0 -0
  98. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/rag/stream_event/types.py +0 -0
  99. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/rag/token_checker.py +0 -0
  100. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/rag/token_counter.py +0 -0
  101. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/rag/types.py +0 -0
  102. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/rag/utils.py +0 -0
  103. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/rag/variable_holder.py +0 -0
  104. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/regexproject/__init__.py +0 -0
  105. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/suffixproject/__init__.py +0 -0
  106. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/tsproject/__init__.py +0 -0
  107. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/utils/__init__.py +0 -0
  108. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/utils/_markitdown.py +0 -0
  109. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/utils/conversation_store.py +0 -0
  110. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/utils/llm_client_interceptors.py +0 -0
  111. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/utils/log_capture.py +0 -0
  112. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/utils/multi_turn.py +0 -0
  113. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/utils/print_table.py +0 -0
  114. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/utils/queue_communicate.py +0 -0
  115. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/utils/request_event_queue.py +0 -0
  116. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/utils/request_queue.py +0 -0
  117. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/utils/rest.py +0 -0
  118. {auto_coder-0.1.203 → auto_coder-0.1.204}/src/autocoder/utils/tests.py +0 -0
  119. {auto_coder-0.1.203 → auto_coder-0.1.204}/tests/test_action_regex_project.py +0 -0
  120. {auto_coder-0.1.203 → auto_coder-0.1.204}/tests/test_chat_auto_coder.py +0 -0
  121. {auto_coder-0.1.203 → auto_coder-0.1.204}/tests/test_code_auto_merge_editblock.py +0 -0
  122. {auto_coder-0.1.203 → auto_coder-0.1.204}/tests/test_command_completer.py +0 -0
  123. {auto_coder-0.1.203 → auto_coder-0.1.204}/tests/test_planner.py +0 -0
  124. {auto_coder-0.1.203 → auto_coder-0.1.204}/tests/test_queue_communicate.py +0 -0
  125. {auto_coder-0.1.203 → auto_coder-0.1.204}/tests/test_symbols_utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: auto-coder
3
- Version: 0.1.203
3
+ Version: 0.1.204
4
4
  Summary: AutoCoder: AutoCoder
5
5
  Author: allwefantasy
6
6
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: auto-coder
3
- Version: 0.1.203
3
+ Version: 0.1.204
4
4
  Summary: AutoCoder: AutoCoder
5
5
  Author: allwefantasy
6
6
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
@@ -286,6 +286,24 @@ def main(input_args: Optional[List[str]] = None):
286
286
  help="Whether to return responses without contexts. only works when pro plugin is installed",
287
287
  )
288
288
 
289
+ serve_parser.add_argument(
290
+ "--recall_model",
291
+ default="",
292
+ help="The model used for recall documents",
293
+ )
294
+
295
+ serve_parser.add_argument(
296
+ "--chunk_model",
297
+ default="",
298
+ help="The model used for chunk documents",
299
+ )
300
+
301
+ serve_parser.add_argument(
302
+ "--qa_model",
303
+ default="",
304
+ help="The model used for question answering",
305
+ )
306
+
289
307
  # Tools command
290
308
  tools_parser = subparsers.add_parser("tools", help="Various tools")
291
309
  tools_subparsers = tools_parser.add_subparsers(dest="tool", help="Available tools")
@@ -334,6 +352,22 @@ def main(input_args: Optional[List[str]] = None):
334
352
  llm = byzerllm.ByzerLLM()
335
353
  llm.setup_default_model_name(args.model)
336
354
 
355
+ # Setup sub models if specified
356
+ if args.recall_model:
357
+ recall_model = byzerllm.ByzerLLM()
358
+ recall_model.setup_default_model_name(args.recall_model)
359
+ llm.setup_sub_client("recall_model", recall_model)
360
+
361
+ if args.chunk_model:
362
+ chunk_model = byzerllm.ByzerLLM()
363
+ chunk_model.setup_default_model_name(args.chunk_model)
364
+ llm.setup_sub_client("chunk_model", chunk_model)
365
+
366
+ if args.qa_model:
367
+ qa_model = byzerllm.ByzerLLM()
368
+ qa_model.setup_default_model_name(args.qa_model)
369
+ llm.setup_sub_client("qa_model", qa_model)
370
+
337
371
  # 当启用hybrid_index时,检查必要的组件
338
372
  if auto_coder_args.enable_hybrid_index:
339
373
  if not llm.is_model_exist("emb"):
@@ -172,7 +172,7 @@ class CodeAutoGenerate:
172
172
  conversations = []
173
173
 
174
174
  if self.args.system_prompt and self.args.system_prompt.strip() == "claude":
175
- conversations.append({"role": "system", "content": sys_prompt.prompt()})
175
+ conversations.append({"role": "system", "content": sys_prompt.claude_sys_prompt.prompt()})
176
176
  elif self.args.system_prompt:
177
177
  conversations.append({"role": "system", "content": self.args.system_prompt})
178
178
 
@@ -308,7 +308,7 @@ class CodeAutoGenerateDiff:
308
308
 
309
309
  conversations = []
310
310
  if self.args.system_prompt and self.args.system_prompt.strip() == "claude":
311
- conversations.append({"role": "system", "content": sys_prompt.prompt()})
311
+ conversations.append({"role": "system", "content": sys_prompt.claude_sys_prompt.prompt()})
312
312
  else:
313
313
  conversations.append({"role": "user", "content": init_prompt})
314
314
 
@@ -390,7 +390,7 @@ class CodeAutoGenerateEditBlock:
390
390
  conversations = []
391
391
 
392
392
  if self.args.system_prompt and self.args.system_prompt.strip() == "claude":
393
- conversations.append({"role": "system", "content": sys_prompt.prompt()})
393
+ conversations.append({"role": "system", "content": sys_prompt.claude_sys_prompt.prompt()})
394
394
  elif self.args.system_prompt:
395
395
  conversations.append({"role": "system", "content": self.args.system_prompt})
396
396
 
@@ -279,7 +279,7 @@ class CodeAutoGenerateStrictDiff:
279
279
 
280
280
  conversations = []
281
281
  if self.args.system_prompt and self.args.system_prompt.strip() == "claude":
282
- conversations.append({"role": "system", "content": sys_prompt.prompt()})
282
+ conversations.append({"role": "system", "content": sys_prompt.claude_sys_prompt.prompt()})
283
283
  elif self.args.system_prompt:
284
284
  conversations.append({"role": "system", "content": self.args.system_prompt})
285
285
 
@@ -1,5 +1,5 @@
1
1
  import byzerllm
2
- import datetime
2
+ from datetime import datetime
3
3
 
4
4
  @byzerllm.prompt()
5
5
  def claude_sys_prompt():
@@ -62,6 +62,10 @@ def _check_relevance_with_conversation(
62
62
  class DocFilterWorker:
63
63
  def __init__(self, llm: ByzerLLM):
64
64
  self.llm = llm
65
+ if self.llm.get_sub_client("recall_model"):
66
+ self.recall_llm = self.llm.get_sub_client("recall_model")
67
+ else:
68
+ self.recall_llm = self.llm
65
69
 
66
70
  def filter_doc(
67
71
  self, conversations: List[Dict[str, str]], docs: List[str]
@@ -72,7 +76,8 @@ class DocFilterWorker:
72
76
  conversations=conversations, documents=docs
73
77
  )
74
78
  except Exception as e:
75
- logger.error(f"Error in _check_relevance_with_conversation: {str(e)}")
79
+ logger.error(
80
+ f"Error in _check_relevance_with_conversation: {str(e)}")
76
81
  return (None, submit_time_1, time.time())
77
82
 
78
83
  end_time_2 = time.time()
@@ -88,6 +93,11 @@ class DocFilter:
88
93
  path: Optional[str] = None,
89
94
  ):
90
95
  self.llm = llm
96
+ if self.llm.get_sub_client("recall_model"):
97
+ self.recall_llm = self.llm.get_sub_client("recall_model")
98
+ else:
99
+ self.recall_llm = self.llm
100
+
91
101
  self.args = args
92
102
  self.relevant_score = self.args.rag_doc_filter_relevance or 5
93
103
  self.on_ray = on_ray
@@ -95,7 +105,8 @@ class DocFilter:
95
105
  if self.on_ray:
96
106
  cpu_count = os.cpu_count() or 1
97
107
  self.workers = [
98
- DocFilterWorker.options(max_concurrency=1000, num_cpus=0).remote(llm)
108
+ DocFilterWorker.options(
109
+ max_concurrency=1000, num_cpus=0).remote(llm)
99
110
  for _ in range(cpu_count)
100
111
  ]
101
112
 
@@ -137,10 +148,12 @@ class DocFilter:
137
148
  submit_time_1 = time.time()
138
149
  try:
139
150
  llm = ByzerLLM()
140
- llm.setup_default_model_name(self.llm.default_model_name)
141
151
  llm.skip_nontext_check = True
152
+ llm.setup_default_model_name(self.recall_llm.default_model_name)
153
+
142
154
  v = (
143
- _check_relevance_with_conversation.with_llm(llm)
155
+ _check_relevance_with_conversation.with_llm(
156
+ llm)
144
157
  .options({"llm_config": {"max_length": 10}})
145
158
  .run(
146
159
  conversations=conversations,
@@ -194,10 +207,12 @@ class DocFilter:
194
207
  )
195
208
  )
196
209
  except Exception as exc:
197
- logger.error(f"Document processing generated an exception: {exc}")
210
+ logger.error(
211
+ f"Document processing generated an exception: {exc}")
198
212
 
199
213
  # Sort relevant_docs by relevance score in descending order
200
- relevant_docs.sort(key=lambda x: x.relevance.relevant_score, reverse=True)
214
+ relevant_docs.sort(
215
+ key=lambda x: x.relevance.relevant_score, reverse=True)
201
216
  return relevant_docs
202
217
 
203
218
  def filter_docs_with_ray(
@@ -210,7 +225,8 @@ class DocFilter:
210
225
  worker = self.workers[count % len(self.workers)]
211
226
  count += 1
212
227
  future = worker.filter_doc.remote(
213
- conversations, [f"##File: {doc.module_name}\n{doc.source_code}"]
228
+ conversations, [
229
+ f"##File: {doc.module_name}\n{doc.source_code}"]
214
230
  )
215
231
  futures.append((future, doc))
216
232
 
@@ -248,8 +264,10 @@ class DocFilter:
248
264
  )
249
265
  )
250
266
  except Exception as exc:
251
- logger.error(f"Document processing generated an exception: {exc}")
267
+ logger.error(
268
+ f"Document processing generated an exception: {exc}")
252
269
 
253
270
  # Sort relevant_docs by relevance score in descending order
254
- relevant_docs.sort(key=lambda x: x.relevance.relevant_score, reverse=True)
271
+ relevant_docs.sort(
272
+ key=lambda x: x.relevance.relevant_score, reverse=True)
255
273
  return relevant_docs
@@ -341,6 +341,11 @@ class LongContextRAG:
341
341
 
342
342
  return response_generator(), []
343
343
  else:
344
+
345
+ target_llm = self.llm
346
+ if self.llm.get_sub_client("qa_model"):
347
+ target_llm = self.llm.get_sub_client("qa_model")
348
+
344
349
  query = conversations[-1]["content"]
345
350
  context = []
346
351
 
@@ -349,8 +354,9 @@ class LongContextRAG:
349
354
  in query
350
355
  or "简要总结一下对话内容,用作后续的上下文提示 prompt,控制在 200 字以内"
351
356
  in query
352
- ):
353
- chunks = self.llm.stream_chat_oai(
357
+ ):
358
+
359
+ chunks = target_llm.stream_chat_oai(
354
360
  conversations=conversations,
355
361
  model=model,
356
362
  role_mapping=role_mapping,
@@ -384,7 +390,7 @@ class LongContextRAG:
384
390
 
385
391
  if self.args.without_contexts and LLMComputeEngine is not None:
386
392
  llm_compute_engine = LLMComputeEngine(
387
- llm=self.llm,
393
+ llm=target_llm,
388
394
  inference_enhance=not self.args.disable_inference_enhance,
389
395
  inference_deep_thought=self.args.inference_deep_thought,
390
396
  inference_slow_without_deep_thought=self.args.inference_slow_without_deep_thought,
@@ -566,7 +572,7 @@ class LongContextRAG:
566
572
 
567
573
  if LLMComputeEngine is not None and not self.args.disable_inference_enhance:
568
574
  llm_compute_engine = LLMComputeEngine(
569
- llm=self.llm,
575
+ llm=target_llm,
570
576
  inference_enhance=not self.args.disable_inference_enhance,
571
577
  inference_deep_thought=self.args.inference_deep_thought,
572
578
  precision=self.args.inference_compute_precision,
@@ -597,7 +603,7 @@ class LongContextRAG:
597
603
  }
598
604
  ]
599
605
 
600
- chunks = self.llm.stream_chat_oai(
606
+ chunks = target_llm.stream_chat_oai(
601
607
  conversations=new_conversations,
602
608
  model=model,
603
609
  role_mapping=role_mapping,
@@ -16,7 +16,7 @@ class TokenLimiter:
16
16
  full_text_limit: int,
17
17
  segment_limit: int,
18
18
  buff_limit: int,
19
- llm,
19
+ llm:ByzerLLM,
20
20
  disable_segment_reorder: bool,
21
21
  ):
22
22
  self.count_tokens = count_tokens
@@ -24,6 +24,10 @@ class TokenLimiter:
24
24
  self.segment_limit = segment_limit
25
25
  self.buff_limit = buff_limit
26
26
  self.llm = llm
27
+ if self.llm.get_sub_client("chunk_model"):
28
+ self.chunk_llm = self.llm.get_sub_client("chunk_model")
29
+ else:
30
+ self.chunk_llm = self.llm
27
31
  self.first_round_full_docs = []
28
32
  self.second_round_extracted_docs = []
29
33
  self.sencond_round_time = 0
@@ -219,10 +223,10 @@ class TokenLimiter:
219
223
  source_code_lines = doc.source_code.split("\n")
220
224
  for idx, line in enumerate(source_code_lines):
221
225
  source_code_with_line_number += f"{idx+1} {line}\n"
222
-
226
+
223
227
  llm = ByzerLLM()
224
- llm.setup_default_model_name(self.llm.default_model_name)
225
228
  llm.skip_nontext_check = True
229
+ llm.setup_default_model_name(self.chunk_llm.default_model_name)
226
230
 
227
231
  extracted_info = (
228
232
  self.extract_relevance_range_from_docs_with_conversation.options(
@@ -0,0 +1 @@
1
+ __version__ = "0.1.204"
@@ -1 +0,0 @@
1
- __version__ = "0.1.203"
File without changes
File without changes
File without changes
File without changes