auto-coder 0.1.44__tar.gz → 0.1.45__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.
- {auto-coder-0.1.44 → auto-coder-0.1.45}/PKG-INFO +4 -3
- {auto-coder-0.1.44 → auto-coder-0.1.45}/README.md +1 -1
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/auto_coder.egg-info/PKG-INFO +4 -3
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/auto_coder.egg-info/SOURCES.txt +1 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/auto_coder.egg-info/requires.txt +2 -1
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/agent/coder.py +5 -7
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/auto_coder.py +3 -3
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/command_args.py +3 -2
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/common/__init__.py +3 -3
- auto-coder-0.1.45/src/autocoder/common/audio.py +92 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/index/index.py +19 -15
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/rag/llm_wrapper.py +1 -1
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/rag/simple_rag.py +8 -2
- auto-coder-0.1.45/src/autocoder/version.py +1 -0
- auto-coder-0.1.44/src/autocoder/version.py +0 -1
- {auto-coder-0.1.44 → auto-coder-0.1.45}/setup.cfg +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/setup.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/auto_coder.egg-info/dependency_links.txt +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/auto_coder.egg-info/entry_points.txt +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/auto_coder.egg-info/top_level.txt +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/__init__.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/agent/__init__.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/common/JupyterClient.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/common/ShellClient.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/common/cleaner.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/common/code_auto_execute.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/common/code_auto_generate.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/common/code_auto_merge.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/common/const.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/common/git_utils.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/common/image_to_page.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/common/llm_rerank.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/common/screenshots.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/common/search.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/common/types.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/db/__init__.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/db/store.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/dispacher/__init__.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/dispacher/actions/__init__.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/dispacher/actions/action.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/dispacher/actions/copilot.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/index/__init__.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/index/for_command.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/lang.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/pyproject/__init__.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/rag/__init__.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/rag/api_server.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/suffixproject/__init__.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/tsproject/__init__.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/utils/__init__.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/utils/llm_client_interceptors.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/utils/print_table.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/src/autocoder/utils/rest.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/tests/test_code_auto_merge.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/tests/test_image_to_page.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/tests/test_llm_rerank.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/tests/test_shell_client.py +0 -0
- {auto-coder-0.1.44 → auto-coder-0.1.45}/tests/test_simple_rag.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: auto-coder
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.45
|
|
4
4
|
Summary: AutoCoder: AutoCoder
|
|
5
5
|
Author: allwefantasy
|
|
6
6
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
@@ -42,12 +42,13 @@ Requires-Dist: sqlmodel
|
|
|
42
42
|
Requires-Dist: wudao
|
|
43
43
|
Requires-Dist: SwissArmyTransformer
|
|
44
44
|
Requires-Dist: jieba
|
|
45
|
-
Requires-Dist: byzerllm>=0.1.
|
|
45
|
+
Requires-Dist: byzerllm>=0.1.75
|
|
46
46
|
Requires-Dist: GitPython
|
|
47
47
|
Requires-Dist: openai>=1.14.3
|
|
48
48
|
Requires-Dist: anthropic
|
|
49
49
|
Requires-Dist: google-generativeai
|
|
50
50
|
Requires-Dist: protobuf
|
|
51
|
+
Requires-Dist: azure-cognitiveservices-speech
|
|
51
52
|
|
|
52
53
|
<p align="center">
|
|
53
54
|
<picture>
|
|
@@ -68,7 +69,7 @@ Auto-Coder (powered by Byzer-LLM)
|
|
|
68
69
|
|
|
69
70
|
*Latest News* 🔥
|
|
70
71
|
|
|
71
|
-
- [2024/04] Release Auto-Coder 0.1.
|
|
72
|
+
- [2024/04] Release Auto-Coder 0.1.45
|
|
72
73
|
- [2024/03] Release Auto-Coder 0.1.25
|
|
73
74
|
- [2024/03] Release Auto-Coder 0.1.24
|
|
74
75
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: auto-coder
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.45
|
|
4
4
|
Summary: AutoCoder: AutoCoder
|
|
5
5
|
Author: allwefantasy
|
|
6
6
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
@@ -42,12 +42,13 @@ Requires-Dist: sqlmodel
|
|
|
42
42
|
Requires-Dist: wudao
|
|
43
43
|
Requires-Dist: SwissArmyTransformer
|
|
44
44
|
Requires-Dist: jieba
|
|
45
|
-
Requires-Dist: byzerllm>=0.1.
|
|
45
|
+
Requires-Dist: byzerllm>=0.1.75
|
|
46
46
|
Requires-Dist: GitPython
|
|
47
47
|
Requires-Dist: openai>=1.14.3
|
|
48
48
|
Requires-Dist: anthropic
|
|
49
49
|
Requires-Dist: google-generativeai
|
|
50
50
|
Requires-Dist: protobuf
|
|
51
|
+
Requires-Dist: azure-cognitiveservices-speech
|
|
51
52
|
|
|
52
53
|
<p align="center">
|
|
53
54
|
<picture>
|
|
@@ -68,7 +69,7 @@ Auto-Coder (powered by Byzer-LLM)
|
|
|
68
69
|
|
|
69
70
|
*Latest News* 🔥
|
|
70
71
|
|
|
71
|
-
- [2024/04] Release Auto-Coder 0.1.
|
|
72
|
+
- [2024/04] Release Auto-Coder 0.1.45
|
|
72
73
|
- [2024/03] Release Auto-Coder 0.1.25
|
|
73
74
|
- [2024/03] Release Auto-Coder 0.1.24
|
|
74
75
|
|
|
@@ -16,6 +16,7 @@ src/autocoder/agent/coder.py
|
|
|
16
16
|
src/autocoder/common/JupyterClient.py
|
|
17
17
|
src/autocoder/common/ShellClient.py
|
|
18
18
|
src/autocoder/common/__init__.py
|
|
19
|
+
src/autocoder/common/audio.py
|
|
19
20
|
src/autocoder/common/cleaner.py
|
|
20
21
|
src/autocoder/common/code_auto_execute.py
|
|
21
22
|
src/autocoder/common/code_auto_generate.py
|
|
@@ -4,12 +4,10 @@ from pydantic import BaseModel,Field
|
|
|
4
4
|
class ReactThink(BaseModel):
|
|
5
5
|
thoughts:str = Field(...,description="Thoughts on current situation, reflect on how you should proceed to fulfill the user requirement")
|
|
6
6
|
state: bool = Field(...,description="Decide whether you need to take more actions to complete the user requirement. Return true if you think so. Return false if you think the requirement has been completely fulfilled.")
|
|
7
|
-
|
|
8
7
|
|
|
9
|
-
|
|
10
8
|
class Coder:
|
|
11
9
|
def __init__(self,llm:byzerllm.ByzerLLM) -> None:
|
|
12
|
-
self.llm = llm
|
|
10
|
+
self.llm = llm
|
|
13
11
|
self.memory = []
|
|
14
12
|
|
|
15
13
|
@byzerllm.prompt(llm=lambda self:self.llm)
|
|
@@ -17,10 +15,10 @@ class Coder:
|
|
|
17
15
|
'''
|
|
18
16
|
# User Requirement
|
|
19
17
|
{user_requirement}
|
|
18
|
+
|
|
20
19
|
# Context
|
|
21
|
-
{context}
|
|
20
|
+
{context}
|
|
22
21
|
'''
|
|
23
|
-
|
|
22
|
+
|
|
24
23
|
def run(self,with_message):
|
|
25
|
-
pass
|
|
26
|
-
|
|
24
|
+
pass
|
|
@@ -56,7 +56,7 @@ def main():
|
|
|
56
56
|
print("-" * 50)
|
|
57
57
|
for arg, value in vars(args).items():
|
|
58
58
|
print(f"{arg:20}: {value}")
|
|
59
|
-
print("-" * 50)
|
|
59
|
+
print("-" * 50)
|
|
60
60
|
|
|
61
61
|
# init store
|
|
62
62
|
store = Store(os.path.join(args.source_dir,".auto-coder","metadata.db"))
|
|
@@ -178,10 +178,10 @@ def main():
|
|
|
178
178
|
response,contexts = rag.stream_search(args.query)
|
|
179
179
|
|
|
180
180
|
s = ""
|
|
181
|
-
print("\n\n=============RESPONSE==================\n\n")
|
|
181
|
+
print("\n\n=============RESPONSE==================\n\n")
|
|
182
182
|
for res in response:
|
|
183
183
|
print(res,end="")
|
|
184
|
-
s += res
|
|
184
|
+
s += res
|
|
185
185
|
|
|
186
186
|
print("\n\n=============CONTEXTS==================")
|
|
187
187
|
|
|
@@ -53,8 +53,9 @@ def parse_args() -> AutoCoderArgs:
|
|
|
53
53
|
|
|
54
54
|
parser.add_argument("--search_engine", default="", help=desc["search_engine"])
|
|
55
55
|
parser.add_argument("--search_engine_token", default="",help=desc["search_engine_token"])
|
|
56
|
-
|
|
57
|
-
parser.add_argument("--
|
|
56
|
+
|
|
57
|
+
parser.add_argument("--enable_rag_search", nargs='?', const=True, default=False, help=desc["enable_rag_search"])
|
|
58
|
+
parser.add_argument("--enable_rag_context", nargs='?',const=True, default=False, help=desc["enable_rag_context"])
|
|
58
59
|
|
|
59
60
|
parser.add_argument("--auto_merge", action='store_true', help=desc["auto_merge"])
|
|
60
61
|
|
|
@@ -4,7 +4,7 @@ import sys
|
|
|
4
4
|
import subprocess
|
|
5
5
|
import os
|
|
6
6
|
import time
|
|
7
|
-
from typing import List,Dict,Any,Optional
|
|
7
|
+
from typing import List,Dict,Any,Optional,Union
|
|
8
8
|
|
|
9
9
|
class SourceCode(pydantic.BaseModel):
|
|
10
10
|
module_name: str
|
|
@@ -85,8 +85,8 @@ class AutoCoderArgs(pydantic.BaseModel):
|
|
|
85
85
|
|
|
86
86
|
search_engine: str = ""
|
|
87
87
|
search_engine_token: str = ""
|
|
88
|
-
enable_rag_search:bool
|
|
89
|
-
enable_rag_context:bool
|
|
88
|
+
enable_rag_search:Union[bool,str] = False
|
|
89
|
+
enable_rag_context:Union[bool,str] = False
|
|
90
90
|
required_exts:str = ""
|
|
91
91
|
|
|
92
92
|
auto_merge: bool = pydantic.Field(False, description="Whether to automatically merge the generated code into the existing file")
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import io
|
|
2
|
+
import os
|
|
3
|
+
import queue
|
|
4
|
+
import threading
|
|
5
|
+
import byzerllm
|
|
6
|
+
import time
|
|
7
|
+
import json
|
|
8
|
+
import base64
|
|
9
|
+
from concurrent.futures import ThreadPoolExecutor
|
|
10
|
+
import shutil
|
|
11
|
+
|
|
12
|
+
def play_wave(filename:str):
|
|
13
|
+
try:
|
|
14
|
+
import simpleaudio as sa
|
|
15
|
+
except ImportError:
|
|
16
|
+
raise ImportError("The simpleaudio module is required to play audio files. Try running 'pip install simpleaudio'")
|
|
17
|
+
|
|
18
|
+
wave_obj = sa.WaveObject.from_wave_file(filename)
|
|
19
|
+
play_obj = wave_obj.play()
|
|
20
|
+
play_obj.wait_done()
|
|
21
|
+
|
|
22
|
+
class PlayStreamAudioFromText:
|
|
23
|
+
def __init__(self, tts_model_name:str="openai_tts"):
|
|
24
|
+
self.q = queue.Queue()
|
|
25
|
+
self.pool = ThreadPoolExecutor(max_workers=5)
|
|
26
|
+
self.llm = byzerllm.ByzerLLM()
|
|
27
|
+
self.llm.setup_default_model_name(tts_model_name)
|
|
28
|
+
self.wav_num = -1
|
|
29
|
+
|
|
30
|
+
def text_to_speech(self, text, file_path):
|
|
31
|
+
print(f"Converting text to speech: {text}")
|
|
32
|
+
t = self.llm.chat_oai(conversations=[{
|
|
33
|
+
"role":"user",
|
|
34
|
+
"content": json.dumps({
|
|
35
|
+
"input": text,
|
|
36
|
+
"voice": "echo",
|
|
37
|
+
"response_format": "wav"
|
|
38
|
+
}, ensure_ascii=False)
|
|
39
|
+
}])
|
|
40
|
+
temp_file_path = file_path + ".tmp"
|
|
41
|
+
with open(temp_file_path, "wb") as f:
|
|
42
|
+
f.write(base64.b64decode(t[0].output))
|
|
43
|
+
shutil.move(temp_file_path, file_path)
|
|
44
|
+
print(f"Converted successfully: {file_path}")
|
|
45
|
+
self.q.task_done()
|
|
46
|
+
|
|
47
|
+
def play_audio_files(self):
|
|
48
|
+
idx = 1
|
|
49
|
+
while True:
|
|
50
|
+
if self.wav_num == -2:
|
|
51
|
+
break
|
|
52
|
+
file_path = f"/tmp/wavs/{idx:03d}.wav"
|
|
53
|
+
if not os.path.exists(file_path):
|
|
54
|
+
time.sleep(0.1) # Reduce CPU usage
|
|
55
|
+
continue
|
|
56
|
+
play_wave(file_path)
|
|
57
|
+
idx += 1
|
|
58
|
+
if idx > self.wav_num:
|
|
59
|
+
self.wav_num = -2
|
|
60
|
+
|
|
61
|
+
def process_texts(self):
|
|
62
|
+
idx = 1
|
|
63
|
+
s = ""
|
|
64
|
+
while True:
|
|
65
|
+
text = self.q.get()
|
|
66
|
+
if text is None:
|
|
67
|
+
self.q.task_done()
|
|
68
|
+
break
|
|
69
|
+
s += text
|
|
70
|
+
if len(s) < 10:
|
|
71
|
+
continue
|
|
72
|
+
sentences = s.split("。")
|
|
73
|
+
for sentence in sentences:
|
|
74
|
+
if len(sentence) == 0:
|
|
75
|
+
continue
|
|
76
|
+
file_path = f"/tmp/wavs/{idx:03d}.wav"
|
|
77
|
+
print(f"Processing: {sentence} to {file_path}")
|
|
78
|
+
self.pool.submit(self.text_to_speech, sentence, file_path)
|
|
79
|
+
idx += 1
|
|
80
|
+
s = ""
|
|
81
|
+
self.wav_num = idx - 1
|
|
82
|
+
|
|
83
|
+
def run(self, text_generator):
|
|
84
|
+
os.makedirs("/tmp/wavs", exist_ok=True)
|
|
85
|
+
threading.Thread(target=self.play_audio_files).start()
|
|
86
|
+
threading.Thread(target=self.process_texts)._start()
|
|
87
|
+
for text in text_generator:
|
|
88
|
+
self.q.put(text)
|
|
89
|
+
self.q.put(None)
|
|
90
|
+
while self.wav_num != -2:
|
|
91
|
+
time.sleep(0.1)
|
|
92
|
+
|
|
@@ -154,16 +154,15 @@ class IndexManager:
|
|
|
154
154
|
if ext in [".md",".html",".txt",".doc",".pdf"]:
|
|
155
155
|
continue
|
|
156
156
|
|
|
157
|
-
md5 = hashlib.md5(source.source_code.encode('utf-8')).hexdigest()
|
|
158
|
-
logger.info(f"try to build index for {file_path} md5: {md5}")
|
|
157
|
+
md5 = hashlib.md5(source.source_code.encode('utf-8')).hexdigest()
|
|
159
158
|
if source.source_code.strip() == "":
|
|
160
159
|
continue
|
|
161
160
|
|
|
162
161
|
if source.module_name in index_data and index_data[source.module_name]["md5"] == md5:
|
|
163
162
|
continue
|
|
164
163
|
|
|
165
|
-
try:
|
|
166
|
-
|
|
164
|
+
try:
|
|
165
|
+
start_time = time.monotonic()
|
|
167
166
|
source_code = source.source_code
|
|
168
167
|
if len(source.source_code) > self.max_input_length:
|
|
169
168
|
logger.warning(f"Warning: The length of source code is too long ({len(source.source_code)}) > model_max_input_length({self.max_input_length}), splitting into chunks...")
|
|
@@ -177,7 +176,9 @@ class IndexManager:
|
|
|
177
176
|
else:
|
|
178
177
|
symbols = self.get_all_file_symbols(source.module_name, source_code)
|
|
179
178
|
time.sleep(self.anti_quota_limit)
|
|
180
|
-
|
|
179
|
+
|
|
180
|
+
logger.info(f"Parse and update index for {file_path} md5: {md5} took {time.monotonic() - start_time:.2f}s")
|
|
181
|
+
|
|
181
182
|
except Exception as e:
|
|
182
183
|
logger.warning(f"Error: {e}")
|
|
183
184
|
continue
|
|
@@ -291,18 +292,16 @@ class IndexManager:
|
|
|
291
292
|
all_results:List[TargetFile] = []
|
|
292
293
|
|
|
293
294
|
def w():
|
|
294
|
-
return self._get_meta_str(skip_symbols=True)
|
|
295
|
+
return self._get_meta_str(skip_symbols=True,max_chunk_size=self.max_input_length-1000)
|
|
295
296
|
|
|
297
|
+
logger.info("Find the related files by query according to the files...")
|
|
296
298
|
temp_result = self._query_index_with_thread(query,w)
|
|
297
|
-
all_results.extend(temp_result)
|
|
298
|
-
|
|
299
|
-
|
|
299
|
+
all_results.extend(temp_result)
|
|
300
300
|
|
|
301
|
-
if self.args.index_filter_level >= 1:
|
|
302
|
-
|
|
303
|
-
logger.info("Find the related files by query according to the file and symbols...")
|
|
301
|
+
if self.args.index_filter_level >= 1:
|
|
302
|
+
logger.info("Find the related files by query according to the symbols...")
|
|
304
303
|
def w():
|
|
305
|
-
return self._get_meta_str(skip_symbols=False)
|
|
304
|
+
return self._get_meta_str(skip_symbols=False,max_chunk_size=self.max_input_length-1000)
|
|
306
305
|
temp_result = self._query_index_with_thread(query,w)
|
|
307
306
|
all_results.extend(temp_result)
|
|
308
307
|
|
|
@@ -340,10 +339,13 @@ def build_index_and_filter_files(llm,args:AutoCoderArgs,sources:List[SourceCode]
|
|
|
340
339
|
for source in sources:
|
|
341
340
|
if source.tag in ["REST","RAG","SEARCH"]:
|
|
342
341
|
final_files.append(get_file_path(source.module_name))
|
|
343
|
-
|
|
342
|
+
|
|
343
|
+
logger.info("Building index for all files...")
|
|
344
344
|
index_manager = IndexManager(llm=llm,sources=sources,args=args)
|
|
345
345
|
index_manager.build_index()
|
|
346
346
|
|
|
347
|
+
logger.info(f"Finding related files in the index...")
|
|
348
|
+
start_time = time.monotonic()
|
|
347
349
|
target_files = index_manager.get_target_files_by_query(args.query)
|
|
348
350
|
|
|
349
351
|
if target_files:
|
|
@@ -364,7 +366,9 @@ def build_index_and_filter_files(llm,args:AutoCoderArgs,sources:List[SourceCode]
|
|
|
364
366
|
|
|
365
367
|
if not final_files:
|
|
366
368
|
logger.warning("Warning: No related files found, use all files")
|
|
367
|
-
final_files = [file.module_name for file in sources]
|
|
369
|
+
final_files = [file.module_name for file in sources]
|
|
370
|
+
|
|
371
|
+
logger.info(f"Find related files took {time.monotonic() - start_time:.2f}s")
|
|
368
372
|
else:
|
|
369
373
|
final_files = [file.module_name for file in sources]
|
|
370
374
|
|
|
@@ -6,7 +6,7 @@ from byzerllm.utils.client.types import (
|
|
|
6
6
|
import pydantic
|
|
7
7
|
from byzerllm import ByzerLLM
|
|
8
8
|
from byzerllm.utils.client import LLMResponse
|
|
9
|
-
from byzerllm.utils import SingleOutputMeta
|
|
9
|
+
from byzerllm.utils.types import SingleOutputMeta
|
|
10
10
|
from autocoder.rag.simple_rag import SimpleRAG
|
|
11
11
|
from loguru import logger
|
|
12
12
|
|
|
@@ -132,13 +132,19 @@ class SimpleRAG:
|
|
|
132
132
|
|
|
133
133
|
def search(self,query:str) -> List[SourceCode]:
|
|
134
134
|
if self.args.enable_rag_search:
|
|
135
|
-
|
|
135
|
+
target_query = query
|
|
136
|
+
if isinstance(self.args.enable_rag_search,str):
|
|
137
|
+
target_query = self.args.enable_rag_search
|
|
138
|
+
texts,contexts = self.stream_search(target_query)
|
|
136
139
|
s = "".join([text for text in texts])
|
|
137
140
|
urls = ",".join(set([context["doc_url"] for context in contexts]))
|
|
138
141
|
## append RAG: prefix is used to protect avoid the source code is modified by the code auto execute
|
|
139
142
|
return [SourceCode(module_name=f"RAG:{urls}", source_code=s)]
|
|
140
143
|
elif self.args.enable_rag_context:
|
|
141
|
-
|
|
144
|
+
target_query = query
|
|
145
|
+
if isinstance(self.args.enable_rag_context,str):
|
|
146
|
+
target_query = self.args.enable_rag_context
|
|
147
|
+
contexts = self.retrieve(target_query)
|
|
142
148
|
for context in contexts:
|
|
143
149
|
context["raw_chunk"]
|
|
144
150
|
try:
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.45"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.1.44"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|