ff_li commited on
Commit
f67d239
1 Parent(s): b53a832

目录调整

Browse files
Files changed (45) hide show
  1. .gitignore +2 -2
  2. {qwen_agent → agent}/__init__.py +0 -0
  3. {qwen_agent → agent}/actions/__init__.py +0 -0
  4. {qwen_agent → agent}/actions/base.py +2 -2
  5. {qwen_agent → agent}/actions/continue_writing.py +1 -1
  6. {qwen_agent → agent}/actions/expand_writing.py +1 -1
  7. {qwen_agent → agent}/actions/function_calling.py +3 -3
  8. {qwen_agent → agent}/actions/gen_keyword.py +1 -1
  9. {qwen_agent → agent}/actions/outline_writing.py +1 -1
  10. {qwen_agent → agent}/actions/react.py +2 -2
  11. {qwen_agent → agent}/actions/retrieval_qa.py +1 -1
  12. {qwen_agent → agent}/actions/summarize.py +1 -1
  13. {qwen_agent → agent}/actions/write_from_scratch.py +4 -4
  14. {qwen_agent → agent}/llm/__init__.py +0 -0
  15. {qwen_agent → agent}/llm/base.py +2 -2
  16. {qwen_agent → agent}/llm/qwen_dashscope.py +1 -1
  17. {qwen_agent → agent}/llm/qwen_oai.py +1 -1
  18. {qwen_agent → agent}/llm/qwen_oai_bak.py +1 -1
  19. {qwen_agent → agent}/log.py +0 -0
  20. {qwen_agent → agent}/memory/__init__.py +0 -0
  21. {qwen_agent → agent}/memory/memory.py +3 -3
  22. {qwen_agent → agent}/memory/similarity_search.py +2 -2
  23. {qwen_agent → agent}/schema.py +0 -0
  24. {qwen_agent → agent}/tools/__init__.py +0 -0
  25. {qwen_agent → agent}/tools/code_interpreter.py +2 -2
  26. {qwen_agent → agent}/tools/image_gen.py +0 -0
  27. {qwen_agent → agent}/tools/resource/AlibabaPuHuiTi-3-45-Light.ttf +0 -0
  28. {qwen_agent → agent}/tools/resource/code_interpreter_init_kernel.py +0 -0
  29. {qwen_agent → agent}/utils/__init__.py +0 -0
  30. {qwen_agent → agent}/utils/doc_parser.py +1 -1
  31. {qwen_agent → agent}/utils/qwen.tiktoken +0 -0
  32. {qwen_agent → agent}/utils/tokenization_qwen.py +0 -0
  33. {qwen_agent → agent}/utils/utils.py +1 -1
  34. assistant_server.py +3 -3
  35. {browser_qwen → chrome_agent}/background.js +0 -0
  36. {browser_qwen → chrome_agent}/img/copy.png +0 -0
  37. {browser_qwen → chrome_agent}/img/logo.png +0 -0
  38. {browser_qwen → chrome_agent}/img/popup.png +0 -0
  39. {browser_qwen → chrome_agent}/manifest.json +0 -0
  40. {browser_qwen → chrome_agent}/src/content.js +0 -0
  41. {browser_qwen → chrome_agent}/src/md5.js +0 -0
  42. {browser_qwen → chrome_agent}/src/popup.html +0 -0
  43. {browser_qwen → chrome_agent}/src/popup.js +0 -0
  44. utils.py +3 -3
  45. workstation_server.py +8 -8
.gitignore CHANGED
@@ -6,8 +6,8 @@ __pycache__
6
  .vscode
7
  .DS_Store
8
 
9
- qwen_agent/llm/gpt.py
10
- qwen_agent/llm/tools.py
11
  #workspace/*
12
  Qwen-Agent
13
 
 
6
  .vscode
7
  .DS_Store
8
 
9
+ agent/llm/gpt.py
10
+ agent/llm/tools.py
11
  #workspace/*
12
  Qwen-Agent
13
 
{qwen_agent → agent}/__init__.py RENAMED
File without changes
{qwen_agent → agent}/actions/__init__.py RENAMED
File without changes
{qwen_agent → agent}/actions/base.py RENAMED
@@ -1,8 +1,8 @@
1
  from abc import ABC, abstractmethod
2
  from typing import Dict, Iterator, List, Optional, Union
3
 
4
- from qwen_agent.llm.base import BaseChatModel
5
- from qwen_agent.utils.utils import has_chinese_chars
6
 
7
  # TODO: Should *planning* just be another action that uses other actions?
8
 
 
1
  from abc import ABC, abstractmethod
2
  from typing import Dict, Iterator, List, Optional, Union
3
 
4
+ from agent.llm.base import BaseChatModel
5
+ from agent.utils.utils import has_chinese_chars
6
 
7
  # TODO: Should *planning* just be another action that uses other actions?
8
 
{qwen_agent → agent}/actions/continue_writing.py RENAMED
@@ -1,4 +1,4 @@
1
- from qwen_agent.actions.base import Action
2
 
3
  PROMPT_TEMPLATE_ZH = """你是一个写作助手,请依据参考资料,根据给定的前置文本续写合适的内容。
4
  #参考资料:
 
1
+ from agent.actions.base import Action
2
 
3
  PROMPT_TEMPLATE_ZH = """你是一个写作助手,请依据参考资料,根据给定的前置文本续写合适的内容。
4
  #参考资料:
{qwen_agent → agent}/actions/expand_writing.py RENAMED
@@ -1,4 +1,4 @@
1
- from qwen_agent.actions.base import Action
2
 
3
  PROMPT_TEMPLATE_ZH = """
4
  你是一个写作助手,任务是依据参考资料,完成写作任务。
 
1
+ from agent.actions.base import Action
2
 
3
  PROMPT_TEMPLATE_ZH = """
4
  你是一个写作助手,任务是依据参考资料,完成写作任务。
{qwen_agent → agent}/actions/function_calling.py RENAMED
@@ -1,8 +1,8 @@
1
  from typing import Dict, Iterator, List
2
 
3
- from qwen_agent.actions.base import Action
4
- from qwen_agent.actions.react import ReAct
5
- from qwen_agent.tools import call_plugin
6
 
7
 
8
  class FunctionCalling(Action):
 
1
  from typing import Dict, Iterator, List
2
 
3
+ from agent.actions.base import Action
4
+ from agent.actions.react import ReAct
5
+ from agent.tools import call_plugin
6
 
7
 
8
  class FunctionCalling(Action):
{qwen_agent → agent}/actions/gen_keyword.py RENAMED
@@ -1,4 +1,4 @@
1
- from qwen_agent.actions.base import Action
2
 
3
  PROMPT_TEMPLATE_ZH = """请提取问题中的关键词,需要中英文均有,可以适量补充不在问题中但相关的关键词。关键词尽量切分为动词/名词/形容词等类型,不要长词组。关键词以JSON的格式给出,比如{{"keywords_zh": ["关键词1", "关键词2"], "keywords_en": ["keyword 1", "keyword 2"]}}
4
 
 
1
+ from agent.actions.base import Action
2
 
3
  PROMPT_TEMPLATE_ZH = """请提取问题中的关键词,需要中英文均有,可以适量补充不在问题中但相关的关键词。关键词尽量切分为动词/名词/形容词等类型,不要长词组。关键词以JSON的格式给出,比如{{"keywords_zh": ["关键词1", "关键词2"], "keywords_en": ["keyword 1", "keyword 2"]}}
4
 
{qwen_agent → agent}/actions/outline_writing.py RENAMED
@@ -1,4 +1,4 @@
1
- from qwen_agent.actions.base import Action
2
 
3
  PROMPT_TEMPLATE_ZH = """
4
  你是一个写作助手,任务是充分理解参考资料,从而完成写作。
 
1
+ from agent.actions.base import Action
2
 
3
  PROMPT_TEMPLATE_ZH = """
4
  你是一个写作助手,任务是充分理解参考资料,从而完成写作。
{qwen_agent → agent}/actions/react.py RENAMED
@@ -1,8 +1,8 @@
1
  import json
2
  from typing import Dict, Iterator, List, Optional
3
 
4
- from qwen_agent.actions.base import Action
5
- from qwen_agent.tools import call_plugin
6
 
7
  TOOL_DESC = """{name_for_model}: Call this tool to interact with the {name_for_human} API. What is the {name_for_human} API useful for? {description_for_model} Parameters: {parameters}"""
8
 
 
1
  import json
2
  from typing import Dict, Iterator, List, Optional
3
 
4
+ from agent.actions.base import Action
5
+ from agent.tools import call_plugin
6
 
7
  TOOL_DESC = """{name_for_model}: Call this tool to interact with the {name_for_human} API. What is the {name_for_human} API useful for? {description_for_model} Parameters: {parameters}"""
8
 
{qwen_agent → agent}/actions/retrieval_qa.py RENAMED
@@ -1,4 +1,4 @@
1
- from qwen_agent.actions.base import Action
2
 
3
  PROMPT_TEMPLATE_ZH = """请充分理解以下参考资料内容,组织出满足用户提问的条理清晰的回复。
4
  #参考资料:
 
1
+ from agent.actions.base import Action
2
 
3
  PROMPT_TEMPLATE_ZH = """请充分理解以下参考资料内容,组织出满足用户提问的条理清晰的回复。
4
  #参考资料:
{qwen_agent → agent}/actions/summarize.py RENAMED
@@ -1,4 +1,4 @@
1
- from qwen_agent.actions.retrieval_qa import RetrievalQA
2
 
3
 
4
  class Summarize(RetrievalQA):
 
1
+ from agent.actions.retrieval_qa import RetrievalQA
2
 
3
 
4
  class Summarize(RetrievalQA):
{qwen_agent → agent}/actions/write_from_scratch.py RENAMED
@@ -2,10 +2,10 @@ import re
2
 
3
  import json5
4
 
5
- from qwen_agent.actions.base import Action
6
- from qwen_agent.actions.expand_writing import ExpandWriting
7
- from qwen_agent.actions.outline_writing import OutlineWriting
8
- from qwen_agent.actions.summarize import Summarize
9
 
10
  default_plan = """{"action1": "summarize", "action2": "outline", "action3": "expand"}"""
11
 
 
2
 
3
  import json5
4
 
5
+ from agent.actions.base import Action
6
+ from agent.actions.expand_writing import ExpandWriting
7
+ from agent.actions.outline_writing import OutlineWriting
8
+ from agent.actions.summarize import Summarize
9
 
10
  default_plan = """{"action1": "summarize", "action2": "outline", "action3": "expand"}"""
11
 
{qwen_agent → agent}/llm/__init__.py RENAMED
File without changes
{qwen_agent → agent}/llm/base.py RENAMED
@@ -1,8 +1,8 @@
1
  from abc import ABC, abstractmethod
2
  from typing import Dict, Iterator, List, Optional, Union
3
 
4
- from qwen_agent.log import logger
5
- from qwen_agent.utils.utils import print_traceback
6
 
7
 
8
  class FnCallNotImplError(NotImplementedError):
 
1
  from abc import ABC, abstractmethod
2
  from typing import Dict, Iterator, List, Optional, Union
3
 
4
+ from agent.log import logger
5
+ from agent.utils.utils import print_traceback
6
 
7
 
8
  class FnCallNotImplError(NotImplementedError):
{qwen_agent → agent}/llm/qwen_dashscope.py RENAMED
@@ -4,7 +4,7 @@ from typing import Dict, Iterator, List, Optional
4
 
5
  import dashscope
6
 
7
- from qwen_agent.llm.base import BaseChatModel
8
 
9
 
10
  class QwenChatAtDS(BaseChatModel):
 
4
 
5
  import dashscope
6
 
7
+ from agent.llm.base import BaseChatModel
8
 
9
 
10
  class QwenChatAtDS(BaseChatModel):
{qwen_agent → agent}/llm/qwen_oai.py RENAMED
@@ -1,7 +1,7 @@
1
  import os
2
  from typing import Dict, Iterator, List, Optional
3
  import openai
4
- from qwen_agent.llm.base import BaseChatModel
5
  from typing import Dict, List, Literal, Optional, Union
6
 
7
 
 
1
  import os
2
  from typing import Dict, Iterator, List, Optional
3
  import openai
4
+ from agent.llm.base import BaseChatModel
5
  from typing import Dict, List, Literal, Optional, Union
6
 
7
 
{qwen_agent → agent}/llm/qwen_oai_bak.py RENAMED
@@ -3,7 +3,7 @@ from typing import Dict, Iterator, List, Optional
3
 
4
  import openai
5
 
6
- from qwen_agent.llm.base import BaseChatModel
7
 
8
  import re
9
  import copy
 
3
 
4
  import openai
5
 
6
+ from agent.llm.base import BaseChatModel
7
 
8
  import re
9
  import copy
{qwen_agent → agent}/log.py RENAMED
File without changes
{qwen_agent → agent}/memory/__init__.py RENAMED
File without changes
{qwen_agent → agent}/memory/memory.py RENAMED
@@ -1,9 +1,9 @@
1
  import copy
2
  from typing import Dict, List
3
 
4
- from qwen_agent.actions import GenKeyword
5
- from qwen_agent.memory.similarity_search import SimilaritySearch
6
- from qwen_agent.utils.tokenization_qwen import count_tokens
7
 
8
 
9
  # TODO: Design the interface.
 
1
  import copy
2
  from typing import Dict, List
3
 
4
+ from agent.actions import GenKeyword
5
+ from agent.memory.similarity_search import SimilaritySearch
6
+ from agent.utils.tokenization_qwen import count_tokens
7
 
8
 
9
  # TODO: Design the interface.
{qwen_agent → agent}/memory/similarity_search.py RENAMED
@@ -1,5 +1,5 @@
1
- from qwen_agent.schema import RefMaterial
2
- from qwen_agent.utils.utils import get_keyword_by_llm, get_split_word
3
 
4
 
5
  class SimilaritySearch:
 
1
+ from agent.schema import RefMaterial
2
+ from agent.utils.utils import get_keyword_by_llm, get_split_word
3
 
4
 
5
  class SimilaritySearch:
{qwen_agent → agent}/schema.py RENAMED
File without changes
{qwen_agent → agent}/tools/__init__.py RENAMED
File without changes
{qwen_agent → agent}/tools/code_interpreter.py RENAMED
@@ -22,8 +22,8 @@ from jupyter_client import BlockingKernelClient
22
 
23
  sys.path.insert(0, str(Path(__file__).absolute().parent.parent.parent)) # NOQA
24
 
25
- from qwen_agent.log import logger # NOQA
26
- from qwen_agent.utils.utils import extract_code, print_traceback # NOQA
27
 
28
  WORK_DIR = os.getenv('M6_CODE_INTERPRETER_WORK_DIR', '/tmp/m6_ci_workspace')
29
 
 
22
 
23
  sys.path.insert(0, str(Path(__file__).absolute().parent.parent.parent)) # NOQA
24
 
25
+ from agent.log import logger # NOQA
26
+ from agent.utils.utils import extract_code, print_traceback # NOQA
27
 
28
  WORK_DIR = os.getenv('M6_CODE_INTERPRETER_WORK_DIR', '/tmp/m6_ci_workspace')
29
 
{qwen_agent → agent}/tools/image_gen.py RENAMED
File without changes
{qwen_agent → agent}/tools/resource/AlibabaPuHuiTi-3-45-Light.ttf RENAMED
File without changes
{qwen_agent → agent}/tools/resource/code_interpreter_init_kernel.py RENAMED
File without changes
{qwen_agent → agent}/utils/__init__.py RENAMED
File without changes
{qwen_agent → agent}/utils/doc_parser.py RENAMED
@@ -1,6 +1,6 @@
1
  import re
2
 
3
- from qwen_agent.utils.tokenization_qwen import count_tokens
4
 
5
 
6
  def rm_newlines(text):
 
1
  import re
2
 
3
+ from agent.utils.tokenization_qwen import count_tokens
4
 
5
 
6
  def rm_newlines(text):
{qwen_agent → agent}/utils/qwen.tiktoken RENAMED
File without changes
{qwen_agent → agent}/utils/tokenization_qwen.py RENAMED
File without changes
{qwen_agent → agent}/utils/utils.py RENAMED
@@ -9,7 +9,7 @@ import jieba
9
  import json5
10
  from jieba import analyse
11
 
12
- from qwen_agent.log import logger
13
 
14
 
15
  def get_local_ip():
 
9
  import json5
10
  from jieba import analyse
11
 
12
+ from agent.log import logger
13
 
14
 
15
  def get_local_ip():
assistant_server.py CHANGED
@@ -3,9 +3,9 @@ import os
3
  from pathlib import Path
4
  import gradio as gr
5
  import jsonlines
6
- from qwen_agent.actions import RetrievalQA
7
- from qwen_agent.llm import QwenChatAsOAI
8
- from qwen_agent.memory import Memory
9
  from utils import service, cache_file, max_ref_token
10
 
11
  llm = QwenChatAsOAI(model="gpt-3.5-turbo")
 
3
  from pathlib import Path
4
  import gradio as gr
5
  import jsonlines
6
+ from agent.actions import RetrievalQA
7
+ from agent.llm import QwenChatAsOAI
8
+ from agent.memory import Memory
9
  from utils import service, cache_file, max_ref_token
10
 
11
  llm = QwenChatAsOAI(model="gpt-3.5-turbo")
{browser_qwen → chrome_agent}/background.js RENAMED
File without changes
{browser_qwen → chrome_agent}/img/copy.png RENAMED
File without changes
{browser_qwen → chrome_agent}/img/logo.png RENAMED
File without changes
{browser_qwen → chrome_agent}/img/popup.png RENAMED
File without changes
{browser_qwen → chrome_agent}/manifest.json RENAMED
File without changes
{browser_qwen → chrome_agent}/src/content.js RENAMED
File without changes
{browser_qwen → chrome_agent}/src/md5.js RENAMED
File without changes
{browser_qwen → chrome_agent}/src/popup.html RENAMED
File without changes
{browser_qwen → chrome_agent}/src/popup.js RENAMED
File without changes
utils.py CHANGED
@@ -4,9 +4,9 @@ import stat
4
  import sys
5
  from urllib.parse import unquote, urlparse
6
  import jsonlines
7
- from qwen_agent.log import logger
8
- from qwen_agent.utils.doc_parser import parse_doc, parse_html_bs
9
- from qwen_agent.utils.utils import print_traceback, save_text_to_file
10
  from schema import Record
11
  from b2sdk.v2 import B2Api
12
  from b2sdk.v2 import InMemoryAccountInfo
 
4
  import sys
5
  from urllib.parse import unquote, urlparse
6
  import jsonlines
7
+ from agent.log import logger
8
+ from agent.utils.doc_parser import parse_doc, parse_html_bs
9
+ from agent.utils.utils import print_traceback, save_text_to_file
10
  from schema import Record
11
  from b2sdk.v2 import B2Api
12
  from b2sdk.v2 import InMemoryAccountInfo
workstation_server.py CHANGED
@@ -5,14 +5,14 @@ import shutil
5
  from pathlib import Path
6
  import gradio as gr
7
  import jsonlines
8
- from qwen_agent.actions import (ContinueWriting, ReAct, RetrievalQA, WriteFromScratch)
9
- from qwen_agent.actions.function_calling import FunctionCalling
10
- from qwen_agent.llm import QwenChatAsOAI
11
- from qwen_agent.log import logger
12
- from qwen_agent.memory import Memory
13
- from qwen_agent.tools import call_plugin, list_of_all_functions
14
- from qwen_agent.utils.utils import (format_answer, get_last_one_line_context,
15
- has_chinese_chars, save_text_to_file)
16
  from utils import service, extract_and_cache_document, code_interpreter_ws, cache_root, max_ref_token, max_days, download_root
17
 
18
  llm = QwenChatAsOAI(model="gpt-3.5-turbo")
 
5
  from pathlib import Path
6
  import gradio as gr
7
  import jsonlines
8
+ from agent.actions import (ContinueWriting, ReAct, RetrievalQA, WriteFromScratch)
9
+ from agent.actions.function_calling import FunctionCalling
10
+ from agent.llm import QwenChatAsOAI
11
+ from agent.log import logger
12
+ from agent.memory import Memory
13
+ from agent.tools import call_plugin, list_of_all_functions
14
+ from agent.utils.utils import (format_answer, get_last_one_line_context,
15
+ has_chinese_chars, save_text_to_file)
16
  from utils import service, extract_and_cache_document, code_interpreter_ws, cache_root, max_ref_token, max_days, download_root
17
 
18
  llm = QwenChatAsOAI(model="gpt-3.5-turbo")