jarvis-ai-assistant 0.1.42__tar.gz → 0.1.43__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {jarvis_ai_assistant-0.1.42/src/jarvis_ai_assistant.egg-info → jarvis_ai_assistant-0.1.43}/PKG-INFO +1 -1
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/pyproject.toml +1 -1
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/setup.py +1 -1
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/__init__.py +1 -1
- jarvis_ai_assistant-0.1.43/src/jarvis/__pycache__/__init__.cpython-313.pyc +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/__pycache__/agent.cpython-313.pyc +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/__pycache__/main.cpython-313.pyc +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/agent.py +1 -1
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/main.py +1 -1
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/models/__pycache__/ai8.cpython-313.pyc +0 -0
- jarvis_ai_assistant-0.1.43/src/jarvis/models/__pycache__/base.cpython-313.pyc +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/models/__pycache__/kimi.cpython-313.pyc +0 -0
- jarvis_ai_assistant-0.1.43/src/jarvis/models/__pycache__/openai.cpython-313.pyc +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/models/__pycache__/oyi.cpython-313.pyc +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/models/__pycache__/registry.cpython-313.pyc +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/models/ai8.py +9 -5
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/models/base.py +4 -1
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/models/kimi.py +4 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/models/openai.py +8 -4
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/models/oyi.py +9 -5
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/models/registry.py +8 -4
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/tools/__pycache__/generator.cpython-313.pyc +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/tools/generator.py +6 -1
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43/src/jarvis_ai_assistant.egg-info}/PKG-INFO +1 -1
- jarvis_ai_assistant-0.1.42/src/jarvis/__pycache__/__init__.cpython-313.pyc +0 -0
- jarvis_ai_assistant-0.1.42/src/jarvis/models/__pycache__/base.cpython-313.pyc +0 -0
- jarvis_ai_assistant-0.1.42/src/jarvis/models/__pycache__/openai.cpython-313.pyc +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/LICENSE +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/MANIFEST.in +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/README.md +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/setup.cfg +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/__pycache__/models.cpython-313.pyc +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/__pycache__/tools.cpython-313.pyc +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/__pycache__/utils.cpython-313.pyc +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/__pycache__/zte_llm.cpython-313.pyc +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/models/__init__.py +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/models/__pycache__/__init__.cpython-313.pyc +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/tools/__init__.py +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/tools/__pycache__/__init__.cpython-313.pyc +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/tools/__pycache__/base.cpython-313.pyc +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/tools/__pycache__/bing_search.cpython-313.pyc +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/tools/__pycache__/calculator.cpython-313.pyc +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/tools/__pycache__/calculator_tool.cpython-313.pyc +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/tools/__pycache__/file_ops.cpython-313.pyc +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/tools/__pycache__/methodology.cpython-313.pyc +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/tools/__pycache__/python_script.cpython-313.pyc +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/tools/__pycache__/rag.cpython-313.pyc +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/tools/__pycache__/registry.cpython-313.pyc +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/tools/__pycache__/search.cpython-313.pyc +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/tools/__pycache__/shell.cpython-313.pyc +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/tools/__pycache__/sub_agent.cpython-313.pyc +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/tools/__pycache__/user_confirmation.cpython-313.pyc +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/tools/__pycache__/user_input.cpython-313.pyc +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/tools/__pycache__/user_interaction.cpython-313.pyc +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/tools/__pycache__/webpage.cpython-313.pyc +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/tools/base.py +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/tools/file_ops.py +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/tools/methodology.py +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/tools/registry.py +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/tools/shell.py +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/tools/sub_agent.py +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis/utils.py +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis_ai_assistant.egg-info/SOURCES.txt +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis_ai_assistant.egg-info/dependency_links.txt +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis_ai_assistant.egg-info/entry_points.txt +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis_ai_assistant.egg-info/requires.txt +0 -0
- {jarvis_ai_assistant-0.1.42 → jarvis_ai_assistant-0.1.43}/src/jarvis_ai_assistant.egg-info/top_level.txt +0 -0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "jarvis-ai-assistant"
|
7
|
-
version = "0.1.
|
7
|
+
version = "0.1.43"
|
8
8
|
description = "Jarvis: An AI assistant that uses tools to interact with the system"
|
9
9
|
readme = "README.md"
|
10
10
|
authors = [{ name = "Your Name", email = "your.email@example.com" }]
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
2
2
|
|
3
3
|
setup(
|
4
4
|
name="jarvis-ai-assistant",
|
5
|
-
version="0.1.
|
5
|
+
version="0.1.43",
|
6
6
|
author="skyfire",
|
7
7
|
author_email="skyfireitdiy@hotmail.com",
|
8
8
|
description="An AI assistant that uses various tools to interact with the system",
|
Binary file
|
Binary file
|
@@ -20,7 +20,7 @@ class Agent:
|
|
20
20
|
name: Agent名称,默认为"Jarvis"
|
21
21
|
is_sub_agent: 是否为子Agent,默认为False
|
22
22
|
"""
|
23
|
-
self.model = PlatformRegistry.
|
23
|
+
self.model = PlatformRegistry.get_global_platform()
|
24
24
|
self.tool_registry = ToolRegistry.get_global_tool_registry()
|
25
25
|
self.name = name
|
26
26
|
self.is_sub_agent = is_sub_agent
|
@@ -114,7 +114,7 @@ def main():
|
|
114
114
|
PrettyOutput.print("未指定AI平台,请使用 -p 参数或者设置 JARVIS_PLATFORM 环境变量", OutputType.ERROR)
|
115
115
|
return 1
|
116
116
|
|
117
|
-
PlatformRegistry.
|
117
|
+
PlatformRegistry.get_global_platform_registry().set_global_platform_name(platform)
|
118
118
|
|
119
119
|
try:
|
120
120
|
# 获取全局模型实例
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -62,11 +62,15 @@ class AI8Model(BasePlatform):
|
|
62
62
|
self.system_message = ""
|
63
63
|
self.conversation = None
|
64
64
|
self.files = []
|
65
|
-
self.
|
65
|
+
self.model_name = os.getenv("AI8_MODEL") or "deepseek-chat"
|
66
66
|
self.token = os.getenv("AI8_API_KEY")
|
67
|
-
if not all([self.
|
67
|
+
if not all([self.model_name, self.token]):
|
68
68
|
raise Exception("AI8_MODEL or AI8_API_KEY is not set")
|
69
|
-
PrettyOutput.print(f"当前使用模型: {self.
|
69
|
+
PrettyOutput.print(f"当前使用模型: {self.model_name}", OutputType.SYSTEM)
|
70
|
+
|
71
|
+
def set_model_name(self, model_name: str):
|
72
|
+
"""设置模型名称"""
|
73
|
+
self.model_name = model_name
|
70
74
|
|
71
75
|
def create_conversation(self) -> bool:
|
72
76
|
"""Create a new conversation"""
|
@@ -102,7 +106,7 @@ class AI8Model(BasePlatform):
|
|
102
106
|
# 2. 更新会话设置
|
103
107
|
session_data = {
|
104
108
|
**self.conversation,
|
105
|
-
"model": self.
|
109
|
+
"model": self.model_name,
|
106
110
|
"contextCount": 1024,
|
107
111
|
"prompt": self.system_message,
|
108
112
|
"plugins": ["tavily_search"],
|
@@ -228,7 +232,7 @@ class AI8Model(BasePlatform):
|
|
228
232
|
|
229
233
|
def name(self) -> str:
|
230
234
|
"""Return model name"""
|
231
|
-
return self.
|
235
|
+
return self.model_name
|
232
236
|
|
233
237
|
def reset(self):
|
234
238
|
"""Reset model state"""
|
@@ -9,8 +9,11 @@ class BasePlatform(ABC):
|
|
9
9
|
def __init__(self):
|
10
10
|
"""初始化模型"""
|
11
11
|
pass
|
12
|
+
|
13
|
+
def set_model_name(self, model_name: str):
|
14
|
+
"""设置模型名称"""
|
15
|
+
raise NotImplementedError("set_model_name is not implemented")
|
12
16
|
|
13
|
-
|
14
17
|
@abstractmethod
|
15
18
|
def chat(self, message: str) -> str:
|
16
19
|
"""执行对话"""
|
@@ -30,9 +30,9 @@ class OpenAIModel(BasePlatform):
|
|
30
30
|
raise Exception("OPENAI_API_KEY is not set")
|
31
31
|
|
32
32
|
self.base_url = os.getenv("OPENAI_API_BASE", "https://api.deepseek.com")
|
33
|
-
self.
|
33
|
+
self.model_name = os.getenv("OPENAI_MODEL_NAME", "deepseek-chat")
|
34
34
|
|
35
|
-
PrettyOutput.print(f"当前使用模型: {self.
|
35
|
+
PrettyOutput.print(f"当前使用模型: {self.model_name}", OutputType.SYSTEM)
|
36
36
|
|
37
37
|
self.client = OpenAI(
|
38
38
|
api_key=self.api_key,
|
@@ -41,6 +41,10 @@ class OpenAIModel(BasePlatform):
|
|
41
41
|
self.messages: List[Dict[str, str]] = []
|
42
42
|
self.system_message = ""
|
43
43
|
|
44
|
+
def set_model_name(self, model_name: str):
|
45
|
+
"""设置模型名称"""
|
46
|
+
self.model_name = model_name
|
47
|
+
|
44
48
|
def set_system_message(self, message: str):
|
45
49
|
"""设置系统消息"""
|
46
50
|
self.system_message = message
|
@@ -55,7 +59,7 @@ class OpenAIModel(BasePlatform):
|
|
55
59
|
self.messages.append({"role": "user", "content": message})
|
56
60
|
|
57
61
|
response = self.client.chat.completions.create(
|
58
|
-
model=self.
|
62
|
+
model=self.model_name, # 使用配置的模型名称
|
59
63
|
messages=self.messages,
|
60
64
|
stream=True
|
61
65
|
)
|
@@ -82,7 +86,7 @@ class OpenAIModel(BasePlatform):
|
|
82
86
|
|
83
87
|
def name(self) -> str:
|
84
88
|
"""返回模型名称"""
|
85
|
-
return self.
|
89
|
+
return self.model_name
|
86
90
|
|
87
91
|
def reset(self):
|
88
92
|
"""重置模型状态"""
|
@@ -47,11 +47,15 @@ class OyiModel(BasePlatform):
|
|
47
47
|
self.conversation = None
|
48
48
|
self.upload_files = []
|
49
49
|
self.first_chat = True
|
50
|
-
self.
|
50
|
+
self.model_name = os.getenv("OYI_MODEL") or "deepseek-chat"
|
51
51
|
self.token = os.getenv("OYI_API_KEY")
|
52
|
-
if not all([self.
|
52
|
+
if not all([self.model_name, self.token]):
|
53
53
|
raise Exception("OYI_MODEL or OYI_API_KEY is not set")
|
54
|
-
PrettyOutput.print(f"当前使用模型: {self.
|
54
|
+
PrettyOutput.print(f"当前使用模型: {self.model_name}", OutputType.SYSTEM)
|
55
|
+
|
56
|
+
def set_model_name(self, model_name: str):
|
57
|
+
"""设置模型名称"""
|
58
|
+
self.model_name = model_name
|
55
59
|
|
56
60
|
|
57
61
|
def create_conversation(self) -> bool:
|
@@ -71,7 +75,7 @@ class OyiModel(BasePlatform):
|
|
71
75
|
"isLock": False,
|
72
76
|
"systemMessage": "",
|
73
77
|
"params": json.dumps({
|
74
|
-
"model": self.
|
78
|
+
"model": self.model_name,
|
75
79
|
"is_webSearch": True,
|
76
80
|
"message": [],
|
77
81
|
"systemMessage": None,
|
@@ -202,7 +206,7 @@ class OyiModel(BasePlatform):
|
|
202
206
|
|
203
207
|
def name(self) -> str:
|
204
208
|
"""Return model name"""
|
205
|
-
return self.
|
209
|
+
return self.model_name
|
206
210
|
|
207
211
|
def reset(self):
|
208
212
|
"""Reset model state"""
|
@@ -130,7 +130,7 @@ class PlatformRegistry:
|
|
130
130
|
|
131
131
|
|
132
132
|
@staticmethod
|
133
|
-
def
|
133
|
+
def get_global_platform_registry():
|
134
134
|
"""获取全局平台注册器"""
|
135
135
|
if PlatformRegistry.global_platform_registry is None:
|
136
136
|
PlatformRegistry.global_platform_registry = PlatformRegistry()
|
@@ -152,9 +152,9 @@ class PlatformRegistry:
|
|
152
152
|
self.platforms: Dict[str, Type[BasePlatform]] = {}
|
153
153
|
|
154
154
|
@staticmethod
|
155
|
-
def
|
155
|
+
def get_global_platform() -> BasePlatform:
|
156
156
|
"""获取全局平台实例"""
|
157
|
-
platform = PlatformRegistry.
|
157
|
+
platform = PlatformRegistry.get_global_platform_registry().create_platform(PlatformRegistry.global_platform_name)
|
158
158
|
if not platform:
|
159
159
|
raise Exception(f"Failed to create platform: {PlatformRegistry.global_platform_name}")
|
160
160
|
return platform
|
@@ -194,6 +194,10 @@ class PlatformRegistry:
|
|
194
194
|
"""获取可用平台列表"""
|
195
195
|
return list(self.platforms.keys())
|
196
196
|
|
197
|
-
def
|
197
|
+
def set_global_platform_name(self, platform_name: str):
|
198
198
|
"""设置全局平台"""
|
199
199
|
PlatformRegistry.global_platform_name = platform_name
|
200
|
+
|
201
|
+
def get_global_platform_name(self) -> str:
|
202
|
+
"""获取全局平台名称"""
|
203
|
+
return PlatformRegistry.global_platform_name
|
Binary file
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import os
|
1
2
|
from typing import Dict, Any
|
2
3
|
from pathlib import Path
|
3
4
|
from jarvis.models.registry import PlatformRegistry
|
@@ -41,7 +42,11 @@ class ToolGeneratorTool:
|
|
41
42
|
|
42
43
|
def _generate_tool_code(self, tool_name: str, class_name: str, description: str, parameters: Dict) -> str:
|
43
44
|
"""使用大模型生成工具代码"""
|
44
|
-
|
45
|
+
platform_name = os.getenv("JARVIS_CODEGEN_PLATFORM") or PlatformRegistry.get_global_platform_name()
|
46
|
+
model = PlatformRegistry.create_platform(platform_name)
|
47
|
+
model_name = os.getenv("JARVIS_CODEGEN_MODEL")
|
48
|
+
if model_name:
|
49
|
+
model.set_model_name(model_name)
|
45
50
|
|
46
51
|
prompt = f"""请生成一个Python工具类的代码,要求如下,除了代码,不要输出任何内容:
|
47
52
|
|
Binary file
|
Binary file
|
Binary file
|
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
|