pygpt-net 2.6.20__py3-none-any.whl → 2.6.22__py3-none-any.whl
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.
- pygpt_net/CHANGELOG.txt +13 -0
- pygpt_net/__init__.py +3 -3
- pygpt_net/app.py +3 -1
- pygpt_net/controller/__init__.py +4 -8
- pygpt_net/controller/access/voice.py +2 -2
- pygpt_net/controller/agent/agent.py +130 -2
- pygpt_net/controller/agent/experts.py +93 -96
- pygpt_net/controller/agent/llama.py +2 -1
- pygpt_net/controller/assistant/assistant.py +18 -1
- pygpt_net/controller/assistant/batch.py +2 -3
- pygpt_net/controller/assistant/editor.py +2 -2
- pygpt_net/controller/assistant/files.py +2 -3
- pygpt_net/controller/assistant/store.py +2 -2
- pygpt_net/controller/attachment/attachment.py +17 -1
- pygpt_net/controller/audio/audio.py +2 -2
- pygpt_net/controller/camera/camera.py +15 -7
- pygpt_net/controller/chat/chat.py +2 -2
- pygpt_net/controller/chat/common.py +50 -33
- pygpt_net/controller/chat/image.py +67 -77
- pygpt_net/controller/chat/input.py +94 -166
- pygpt_net/controller/chat/output.py +83 -140
- pygpt_net/controller/chat/response.py +83 -102
- pygpt_net/controller/chat/text.py +116 -149
- pygpt_net/controller/ctx/common.py +2 -1
- pygpt_net/controller/ctx/ctx.py +87 -6
- pygpt_net/controller/files/files.py +13 -1
- pygpt_net/controller/idx/idx.py +26 -2
- pygpt_net/controller/idx/indexer.py +85 -76
- pygpt_net/controller/kernel/reply.py +53 -66
- pygpt_net/controller/kernel/stack.py +16 -16
- pygpt_net/controller/lang/lang.py +52 -34
- pygpt_net/controller/model/importer.py +3 -2
- pygpt_net/controller/model/model.py +62 -3
- pygpt_net/controller/notepad/notepad.py +86 -84
- pygpt_net/controller/plugins/settings.py +3 -4
- pygpt_net/controller/settings/editor.py +4 -4
- pygpt_net/controller/settings/profile.py +105 -124
- pygpt_net/controller/theme/menu.py +154 -57
- pygpt_net/controller/theme/nodes.py +51 -44
- pygpt_net/controller/theme/theme.py +33 -9
- pygpt_net/controller/tools/tools.py +2 -2
- pygpt_net/controller/ui/tabs.py +2 -3
- pygpt_net/controller/ui/ui.py +16 -2
- pygpt_net/core/agents/observer/evaluation.py +3 -3
- pygpt_net/core/agents/provider.py +25 -3
- pygpt_net/core/agents/runner.py +4 -1
- pygpt_net/core/agents/runners/llama_workflow.py +19 -7
- pygpt_net/core/agents/runners/loop.py +3 -1
- pygpt_net/core/agents/runners/openai_workflow.py +17 -3
- pygpt_net/core/agents/tools.py +4 -1
- pygpt_net/core/bridge/context.py +34 -37
- pygpt_net/core/ctx/container.py +13 -12
- pygpt_net/core/ctx/ctx.py +1 -1
- pygpt_net/core/ctx/output.py +7 -4
- pygpt_net/core/db/database.py +2 -2
- pygpt_net/core/debug/console/console.py +2 -2
- pygpt_net/core/debug/debug.py +12 -1
- pygpt_net/core/dispatcher/dispatcher.py +24 -1
- pygpt_net/core/events/app.py +7 -7
- pygpt_net/core/events/control.py +26 -26
- pygpt_net/core/events/event.py +6 -3
- pygpt_net/core/events/kernel.py +2 -2
- pygpt_net/core/events/render.py +13 -13
- pygpt_net/core/experts/experts.py +76 -82
- pygpt_net/core/experts/worker.py +12 -12
- pygpt_net/core/filesystem/actions.py +1 -2
- pygpt_net/core/models/models.py +5 -1
- pygpt_net/core/models/ollama.py +14 -5
- pygpt_net/core/render/plain/helpers.py +2 -5
- pygpt_net/core/render/plain/renderer.py +26 -30
- pygpt_net/core/render/web/body.py +1 -1
- pygpt_net/core/render/web/helpers.py +2 -2
- pygpt_net/core/render/web/renderer.py +4 -4
- pygpt_net/core/settings/settings.py +43 -13
- pygpt_net/core/tabs/tabs.py +20 -13
- pygpt_net/core/types/__init__.py +2 -1
- pygpt_net/core/types/agent.py +4 -4
- pygpt_net/core/types/base.py +19 -0
- pygpt_net/core/types/console.py +6 -6
- pygpt_net/core/types/mode.py +8 -8
- pygpt_net/core/types/multimodal.py +3 -3
- pygpt_net/core/types/openai.py +2 -1
- pygpt_net/data/config/config.json +5 -5
- pygpt_net/data/config/models.json +19 -3
- pygpt_net/data/config/settings.json +14 -14
- pygpt_net/data/locale/locale.de.ini +4 -1
- pygpt_net/data/locale/locale.en.ini +6 -3
- pygpt_net/data/locale/locale.es.ini +4 -1
- pygpt_net/data/locale/locale.fr.ini +4 -1
- pygpt_net/data/locale/locale.it.ini +4 -1
- pygpt_net/data/locale/locale.pl.ini +5 -4
- pygpt_net/data/locale/locale.uk.ini +4 -1
- pygpt_net/data/locale/locale.zh.ini +4 -1
- pygpt_net/item/ctx.py +256 -240
- pygpt_net/item/model.py +59 -116
- pygpt_net/item/preset.py +122 -105
- pygpt_net/plugin/twitter/plugin.py +2 -2
- pygpt_net/provider/agents/llama_index/workflow/planner.py +3 -3
- pygpt_net/provider/agents/openai/agent.py +4 -12
- pygpt_net/provider/agents/openai/agent_b2b.py +10 -15
- pygpt_net/provider/agents/openai/agent_planner.py +4 -4
- pygpt_net/provider/agents/openai/agent_with_experts.py +3 -7
- pygpt_net/provider/agents/openai/agent_with_experts_feedback.py +4 -8
- pygpt_net/provider/agents/openai/agent_with_feedback.py +4 -8
- pygpt_net/provider/agents/openai/bot_researcher.py +2 -18
- pygpt_net/provider/agents/openai/bots/__init__.py +0 -0
- pygpt_net/provider/agents/openai/bots/research_bot/__init__.py +0 -0
- pygpt_net/provider/agents/openai/bots/research_bot/agents/__init__.py +0 -0
- pygpt_net/provider/agents/openai/bots/research_bot/agents/planner_agent.py +1 -1
- pygpt_net/provider/agents/openai/bots/research_bot/agents/search_agent.py +1 -0
- pygpt_net/provider/agents/openai/bots/research_bot/agents/writer_agent.py +1 -1
- pygpt_net/provider/agents/openai/bots/research_bot/manager.py +1 -10
- pygpt_net/provider/agents/openai/evolve.py +5 -9
- pygpt_net/provider/agents/openai/supervisor.py +4 -8
- pygpt_net/provider/core/config/patch.py +10 -3
- pygpt_net/provider/core/ctx/db_sqlite/utils.py +43 -43
- pygpt_net/provider/core/model/patch.py +11 -1
- pygpt_net/provider/core/preset/json_file.py +47 -49
- pygpt_net/provider/gpt/agents/experts.py +2 -2
- pygpt_net/tools/audio_transcriber/ui/dialogs.py +44 -54
- pygpt_net/tools/code_interpreter/body.py +1 -2
- pygpt_net/tools/code_interpreter/tool.py +7 -4
- pygpt_net/tools/code_interpreter/ui/html.py +1 -3
- pygpt_net/tools/code_interpreter/ui/widgets.py +2 -3
- pygpt_net/tools/html_canvas/ui/widgets.py +1 -3
- pygpt_net/tools/image_viewer/ui/dialogs.py +40 -37
- pygpt_net/tools/indexer/ui/widgets.py +2 -4
- pygpt_net/tools/media_player/tool.py +2 -5
- pygpt_net/tools/media_player/ui/widgets.py +60 -36
- pygpt_net/tools/text_editor/ui/widgets.py +18 -19
- pygpt_net/tools/translator/ui/widgets.py +39 -35
- pygpt_net/ui/base/context_menu.py +9 -4
- pygpt_net/ui/dialog/db.py +1 -3
- pygpt_net/ui/dialog/models.py +1 -3
- pygpt_net/ui/dialog/models_importer.py +2 -4
- pygpt_net/ui/dialogs.py +34 -30
- pygpt_net/ui/layout/chat/attachments.py +72 -84
- pygpt_net/ui/layout/chat/attachments_ctx.py +40 -44
- pygpt_net/ui/layout/chat/attachments_uploaded.py +36 -39
- pygpt_net/ui/layout/chat/calendar.py +100 -70
- pygpt_net/ui/layout/chat/chat.py +23 -17
- pygpt_net/ui/layout/chat/input.py +95 -118
- pygpt_net/ui/layout/chat/output.py +100 -162
- pygpt_net/ui/layout/chat/painter.py +89 -61
- pygpt_net/ui/layout/ctx/ctx_list.py +43 -52
- pygpt_net/ui/layout/status.py +23 -14
- pygpt_net/ui/layout/toolbox/agent.py +27 -38
- pygpt_net/ui/layout/toolbox/agent_llama.py +42 -45
- pygpt_net/ui/layout/toolbox/assistants.py +42 -38
- pygpt_net/ui/layout/toolbox/computer_env.py +32 -23
- pygpt_net/ui/layout/toolbox/footer.py +13 -16
- pygpt_net/ui/layout/toolbox/image.py +18 -21
- pygpt_net/ui/layout/toolbox/indexes.py +46 -89
- pygpt_net/ui/layout/toolbox/mode.py +20 -7
- pygpt_net/ui/layout/toolbox/model.py +12 -10
- pygpt_net/ui/layout/toolbox/presets.py +68 -52
- pygpt_net/ui/layout/toolbox/prompt.py +31 -58
- pygpt_net/ui/layout/toolbox/toolbox.py +25 -21
- pygpt_net/ui/layout/toolbox/vision.py +20 -22
- pygpt_net/ui/main.py +2 -4
- pygpt_net/ui/menu/about.py +64 -84
- pygpt_net/ui/menu/audio.py +87 -63
- pygpt_net/ui/menu/config.py +121 -127
- pygpt_net/ui/menu/debug.py +69 -76
- pygpt_net/ui/menu/file.py +32 -35
- pygpt_net/ui/menu/menu.py +2 -3
- pygpt_net/ui/menu/plugins.py +69 -33
- pygpt_net/ui/menu/theme.py +45 -46
- pygpt_net/ui/menu/tools.py +56 -60
- pygpt_net/ui/menu/video.py +20 -25
- pygpt_net/ui/tray.py +1 -2
- pygpt_net/ui/widget/audio/bar.py +1 -3
- pygpt_net/ui/widget/audio/input_button.py +3 -4
- pygpt_net/ui/widget/calendar/select.py +1 -2
- pygpt_net/ui/widget/dialog/base.py +12 -9
- pygpt_net/ui/widget/dialog/editor_file.py +20 -23
- pygpt_net/ui/widget/dialog/find.py +25 -24
- pygpt_net/ui/widget/dialog/profile.py +57 -53
- pygpt_net/ui/widget/draw/painter.py +62 -93
- pygpt_net/ui/widget/element/button.py +42 -30
- pygpt_net/ui/widget/element/checkbox.py +23 -15
- pygpt_net/ui/widget/element/group.py +6 -5
- pygpt_net/ui/widget/element/labels.py +1 -2
- pygpt_net/ui/widget/filesystem/explorer.py +93 -102
- pygpt_net/ui/widget/image/display.py +1 -2
- pygpt_net/ui/widget/lists/assistant.py +1 -2
- pygpt_net/ui/widget/lists/attachment.py +1 -2
- pygpt_net/ui/widget/lists/attachment_ctx.py +1 -2
- pygpt_net/ui/widget/lists/context.py +2 -4
- pygpt_net/ui/widget/lists/index.py +1 -2
- pygpt_net/ui/widget/lists/model.py +1 -2
- pygpt_net/ui/widget/lists/model_editor.py +1 -2
- pygpt_net/ui/widget/lists/model_importer.py +1 -2
- pygpt_net/ui/widget/lists/preset.py +1 -2
- pygpt_net/ui/widget/lists/preset_plugins.py +1 -2
- pygpt_net/ui/widget/lists/profile.py +1 -2
- pygpt_net/ui/widget/lists/uploaded.py +1 -2
- pygpt_net/ui/widget/option/checkbox.py +2 -4
- pygpt_net/ui/widget/option/checkbox_list.py +1 -4
- pygpt_net/ui/widget/option/cmd.py +1 -4
- pygpt_net/ui/widget/option/dictionary.py +25 -28
- pygpt_net/ui/widget/option/input.py +1 -3
- pygpt_net/ui/widget/tabs/Input.py +16 -12
- pygpt_net/ui/widget/tabs/body.py +5 -3
- pygpt_net/ui/widget/tabs/layout.py +36 -25
- pygpt_net/ui/widget/tabs/output.py +96 -74
- pygpt_net/ui/widget/textarea/calendar_note.py +1 -2
- pygpt_net/ui/widget/textarea/editor.py +41 -73
- pygpt_net/ui/widget/textarea/find.py +11 -10
- pygpt_net/ui/widget/textarea/html.py +3 -6
- pygpt_net/ui/widget/textarea/input.py +63 -64
- pygpt_net/ui/widget/textarea/notepad.py +54 -38
- pygpt_net/ui/widget/textarea/output.py +65 -54
- pygpt_net/ui/widget/textarea/search_input.py +5 -4
- pygpt_net/ui/widget/textarea/web.py +2 -4
- pygpt_net/ui/widget/vision/camera.py +2 -31
- {pygpt_net-2.6.20.dist-info → pygpt_net-2.6.22.dist-info}/METADATA +25 -154
- {pygpt_net-2.6.20.dist-info → pygpt_net-2.6.22.dist-info}/RECORD +218 -217
- {pygpt_net-2.6.20.dist-info → pygpt_net-2.6.22.dist-info}/LICENSE +0 -0
- {pygpt_net-2.6.20.dist-info → pygpt_net-2.6.22.dist-info}/WHEEL +0 -0
- {pygpt_net-2.6.20.dist-info → pygpt_net-2.6.22.dist-info}/entry_points.txt +0 -0
pygpt_net/item/model.py
CHANGED
|
@@ -6,10 +6,11 @@
|
|
|
6
6
|
# GitHub: https://github.com/szczyglis-dev/py-gpt #
|
|
7
7
|
# MIT License #
|
|
8
8
|
# Created By : Marcin Szczygliński #
|
|
9
|
-
# Updated Date: 2025.08.
|
|
9
|
+
# Updated Date: 2025.08.23 15:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
import json
|
|
13
|
+
from typing import Optional
|
|
13
14
|
|
|
14
15
|
from pygpt_net.core.types import (
|
|
15
16
|
MODE_CHAT,
|
|
@@ -22,27 +23,27 @@ from pygpt_net.core.types import (
|
|
|
22
23
|
|
|
23
24
|
class ModelItem:
|
|
24
25
|
|
|
25
|
-
def __init__(self, id=None):
|
|
26
|
+
def __init__(self, id: Optional[str] = None):
|
|
26
27
|
"""
|
|
27
28
|
Model data item
|
|
28
29
|
|
|
29
30
|
:param id: Model ID
|
|
30
31
|
"""
|
|
32
|
+
self.ctx = 0
|
|
33
|
+
self.default = False
|
|
34
|
+
self.extra = {}
|
|
31
35
|
self.id = id
|
|
32
|
-
self.
|
|
33
|
-
self.
|
|
36
|
+
self.imported = False
|
|
37
|
+
self.input = ["text"] # multimodal support: image, audio, etc.
|
|
34
38
|
self.langchain = {}
|
|
35
39
|
self.llama_index = {}
|
|
40
|
+
self.mode = ["chat"]
|
|
36
41
|
self.multimodal = ["text"] # multimodal support: image, audio, etc.
|
|
37
|
-
self.
|
|
42
|
+
self.name = None
|
|
38
43
|
self.output = ["text"] # multimodal support: image, audio, etc.
|
|
39
|
-
self.ctx = 0
|
|
40
|
-
self.tokens = 0
|
|
41
|
-
self.default = False
|
|
42
|
-
self.imported = False
|
|
43
44
|
self.provider = "openai" # default provider
|
|
45
|
+
self.tokens = 0
|
|
44
46
|
self.tool_calls = False # native tool calls available
|
|
45
|
-
self.extra = {}
|
|
46
47
|
|
|
47
48
|
def from_dict(self, data: dict):
|
|
48
49
|
"""
|
|
@@ -50,61 +51,37 @@ class ModelItem:
|
|
|
50
51
|
|
|
51
52
|
:param data: dict
|
|
52
53
|
"""
|
|
53
|
-
if 'id' in data:
|
|
54
|
-
self.id = data['id']
|
|
55
|
-
if 'name' in data:
|
|
56
|
-
self.name = data['name']
|
|
57
|
-
if 'mode' in data:
|
|
58
|
-
mode = data['mode'].replace(' ', '')
|
|
59
|
-
self.mode = mode.split(',')
|
|
60
|
-
if 'input' in data:
|
|
61
|
-
input = data['input'].replace(' ', '')
|
|
62
|
-
self.input = input.split(',')
|
|
63
|
-
if 'output' in data:
|
|
64
|
-
output = data['output'].replace(' ', '')
|
|
65
|
-
self.output = output.split(',')
|
|
66
54
|
if 'ctx' in data:
|
|
67
55
|
self.ctx = data['ctx']
|
|
68
|
-
if 'tokens' in data:
|
|
69
|
-
self.tokens = data['tokens']
|
|
70
56
|
if 'default' in data:
|
|
71
57
|
self.default = data['default']
|
|
72
58
|
if 'extra' in data:
|
|
73
59
|
self.extra = data['extra']
|
|
60
|
+
if 'id' in data:
|
|
61
|
+
self.id = data['id']
|
|
74
62
|
if 'imported' in data:
|
|
75
63
|
self.imported = data['imported']
|
|
64
|
+
if 'input' in data:
|
|
65
|
+
input = data['input'].replace(' ', '')
|
|
66
|
+
self.input = input.split(',')
|
|
67
|
+
if 'mode' in data:
|
|
68
|
+
mode = data['mode'].replace(' ', '')
|
|
69
|
+
self.mode = mode.split(',')
|
|
70
|
+
if 'name' in data:
|
|
71
|
+
self.name = data['name']
|
|
72
|
+
if 'output' in data:
|
|
73
|
+
output = data['output'].replace(' ', '')
|
|
74
|
+
self.output = output.split(',')
|
|
76
75
|
if 'provider' in data:
|
|
77
76
|
self.provider = data['provider']
|
|
77
|
+
if 'tokens' in data:
|
|
78
|
+
self.tokens = data['tokens']
|
|
78
79
|
if 'tool_calls' in data:
|
|
79
80
|
self.tool_calls = data['tool_calls']
|
|
80
|
-
|
|
81
|
-
# langchain
|
|
82
|
-
"""
|
|
83
|
-
if 'langchain.provider' in data:
|
|
84
|
-
self.langchain['provider'] = data['langchain.provider']
|
|
85
|
-
if 'langchain.mode' in data:
|
|
86
|
-
if data['langchain.mode'] is None or data['langchain.mode'] == "":
|
|
87
|
-
self.langchain['mode'] = []
|
|
88
|
-
else:
|
|
89
|
-
mode = data['langchain.mode'].replace(' ', '')
|
|
90
|
-
self.langchain['mode'] = mode.split(',')
|
|
91
|
-
if 'langchain.args' in data:
|
|
92
|
-
self.langchain['args'] = data['langchain.args']
|
|
93
|
-
if 'langchain.env' in data:
|
|
94
|
-
self.langchain['env'] = data['langchain.env']
|
|
95
|
-
"""
|
|
96
81
|
|
|
97
82
|
# llama index
|
|
98
83
|
if 'llama_index.provider' in data:
|
|
99
84
|
self.llama_index['provider'] = data['llama_index.provider'] # backward compatibility < v2.5.20
|
|
100
|
-
"""
|
|
101
|
-
if 'llama_index.mode' in data:
|
|
102
|
-
if data['llama_index.mode'] is None or data['llama_index.mode'] == "":
|
|
103
|
-
self.llama_index['mode'] = []
|
|
104
|
-
else:
|
|
105
|
-
mode = data['llama_index.mode'].replace(' ', '')
|
|
106
|
-
self.llama_index['mode'] = mode.split(',')
|
|
107
|
-
"""
|
|
108
85
|
if 'llama_index.args' in data:
|
|
109
86
|
self.llama_index['args'] = data['llama_index.args']
|
|
110
87
|
if 'llama_index.env' in data:
|
|
@@ -116,83 +93,44 @@ class ModelItem:
|
|
|
116
93
|
|
|
117
94
|
:return: dict
|
|
118
95
|
"""
|
|
119
|
-
data = {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
# data['langchain.args'] = []
|
|
137
|
-
# data['langchain.env'] = []
|
|
138
|
-
# data['llama_index.provider'] = None
|
|
139
|
-
# data['llama_index.mode'] = ""
|
|
140
|
-
data['llama_index.args'] = []
|
|
141
|
-
data['llama_index.env'] = []
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
# langchain
|
|
145
|
-
"""
|
|
146
|
-
if 'provider' in self.langchain:
|
|
147
|
-
data['langchain.provider'] = self.langchain['provider']
|
|
148
|
-
if 'mode' in self.langchain:
|
|
149
|
-
data['langchain.mode'] = ",".join(self.langchain['mode'])
|
|
150
|
-
if 'args' in self.langchain:
|
|
151
|
-
# old versions support
|
|
152
|
-
if isinstance(self.langchain['args'], dict):
|
|
153
|
-
for key, value in self.langchain['args'].items():
|
|
154
|
-
item = {}
|
|
155
|
-
item['name'] = key
|
|
156
|
-
item['value'] = value
|
|
157
|
-
item['type'] = 'str'
|
|
158
|
-
data['langchain.args'].append(item)
|
|
159
|
-
elif isinstance(self.langchain['args'], list):
|
|
160
|
-
data['langchain.args'] = self.langchain['args']
|
|
161
|
-
if 'env' in self.langchain:
|
|
162
|
-
# old versions support
|
|
163
|
-
if isinstance(self.langchain['env'], dict):
|
|
164
|
-
for key, value in self.langchain['env'].items():
|
|
165
|
-
item = {}
|
|
166
|
-
item['name'] = key
|
|
167
|
-
item['value'] = value
|
|
168
|
-
data['langchain.env'].append(item)
|
|
169
|
-
elif isinstance(self.langchain['env'], list):
|
|
170
|
-
data['langchain.env'] = self.langchain['env']
|
|
171
|
-
"""
|
|
172
|
-
|
|
173
|
-
# llama_index
|
|
174
|
-
# if 'provider' in self.llama_index:
|
|
175
|
-
# data['llama_index.provider'] = self.llama_index['provider']
|
|
176
|
-
# if 'mode' in self.llama_index:
|
|
177
|
-
# data['llama_index.mode'] = ",".join(self.llama_index['mode'])
|
|
96
|
+
data = {
|
|
97
|
+
'id': self.id,
|
|
98
|
+
'name': self.name,
|
|
99
|
+
'mode': ','.join(self.mode),
|
|
100
|
+
'input': ','.join(self.input),
|
|
101
|
+
'output': ','.join(self.output),
|
|
102
|
+
'ctx': self.ctx,
|
|
103
|
+
'tokens': self.tokens,
|
|
104
|
+
'default': self.default,
|
|
105
|
+
'extra': self.extra,
|
|
106
|
+
'imported': self.imported,
|
|
107
|
+
'provider': self.provider,
|
|
108
|
+
'tool_calls': self.tool_calls,
|
|
109
|
+
'llama_index.args': [],
|
|
110
|
+
'llama_index.env': []
|
|
111
|
+
}
|
|
112
|
+
|
|
178
113
|
if 'args' in self.llama_index:
|
|
179
114
|
# old versions support
|
|
180
115
|
if isinstance(self.llama_index['args'], dict):
|
|
181
116
|
for key, value in self.llama_index['args'].items():
|
|
182
|
-
item = {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
117
|
+
item = {
|
|
118
|
+
'name': key,
|
|
119
|
+
'value': value,
|
|
120
|
+
'type': 'str'
|
|
121
|
+
}
|
|
186
122
|
data['llama_index.args'].append(item)
|
|
187
123
|
elif isinstance(self.llama_index['args'], list):
|
|
188
124
|
data['llama_index.args'] = self.llama_index['args']
|
|
125
|
+
|
|
189
126
|
if 'env' in self.llama_index:
|
|
190
127
|
# old versions support
|
|
191
128
|
if isinstance(self.llama_index['env'], dict):
|
|
192
129
|
for key, value in self.llama_index['env'].items():
|
|
193
|
-
item = {
|
|
194
|
-
|
|
195
|
-
|
|
130
|
+
item = {
|
|
131
|
+
'name': key,
|
|
132
|
+
'value': value
|
|
133
|
+
}
|
|
196
134
|
data['llama_index.env'].append(item)
|
|
197
135
|
elif isinstance(self.llama_index['env'], list):
|
|
198
136
|
data['llama_index.env'] = self.llama_index['env']
|
|
@@ -262,7 +200,12 @@ class ModelItem:
|
|
|
262
200
|
return False
|
|
263
201
|
return "ollama" in self.llama_index.get("provider", "")
|
|
264
202
|
|
|
265
|
-
def get_provider(self):
|
|
203
|
+
def get_provider(self) -> str:
|
|
204
|
+
"""
|
|
205
|
+
Get model provider
|
|
206
|
+
|
|
207
|
+
:return: Provider name
|
|
208
|
+
"""
|
|
266
209
|
return self.provider
|
|
267
210
|
|
|
268
211
|
def get_ollama_model(self) -> str:
|
pygpt_net/item/preset.py
CHANGED
|
@@ -6,165 +6,178 @@
|
|
|
6
6
|
# GitHub: https://github.com/szczyglis-dev/py-gpt #
|
|
7
7
|
# MIT License #
|
|
8
8
|
# Created By : Marcin Szczygliński #
|
|
9
|
-
# Updated Date: 2025.08.
|
|
9
|
+
# Updated Date: 2025.08.23 15:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
import json
|
|
13
13
|
import uuid
|
|
14
14
|
|
|
15
|
-
|
|
16
15
|
class PresetItem:
|
|
17
|
-
|
|
18
|
-
|
|
19
16
|
def __init__(self):
|
|
20
|
-
self.
|
|
21
|
-
self.
|
|
22
|
-
self.
|
|
17
|
+
self.agent = False
|
|
18
|
+
self.agent_llama = False
|
|
19
|
+
self.agent_openai = False
|
|
20
|
+
self.agent_provider = None
|
|
21
|
+
self.agent_provider_openai = None
|
|
23
22
|
self.ai_avatar = ""
|
|
23
|
+
self.ai_name = ""
|
|
24
24
|
self.ai_personalize = False
|
|
25
|
-
self.
|
|
26
|
-
self.
|
|
25
|
+
self.assistant = False
|
|
26
|
+
self.assistant_id = ""
|
|
27
|
+
self.audio = False
|
|
27
28
|
self.chat = False
|
|
28
29
|
self.completion = False
|
|
30
|
+
self.computer = False
|
|
31
|
+
self.description = ""
|
|
32
|
+
self.enabled = True
|
|
33
|
+
self.expert = False
|
|
34
|
+
self.experts = [] # agent mode
|
|
35
|
+
self.extra = {}
|
|
36
|
+
self.filename = None
|
|
29
37
|
self.img = False
|
|
30
|
-
self.
|
|
38
|
+
self.idx = None
|
|
31
39
|
self.langchain = False
|
|
32
|
-
self.assistant = False
|
|
33
40
|
self.llama_index = False
|
|
34
|
-
self.
|
|
35
|
-
self.
|
|
36
|
-
self.
|
|
37
|
-
self.expert = False
|
|
38
|
-
self.audio = False
|
|
41
|
+
self.model = None
|
|
42
|
+
self.name = "*"
|
|
43
|
+
self.prompt = ""
|
|
39
44
|
self.research = False
|
|
40
|
-
self.
|
|
45
|
+
self.remote_tools = []
|
|
41
46
|
self.temperature = 1.0
|
|
42
|
-
self.filename = None
|
|
43
|
-
self.model = None
|
|
44
|
-
self.version = None
|
|
45
|
-
self.experts = [] # agent mode
|
|
46
|
-
self.idx = None
|
|
47
|
-
self.agent_provider = None
|
|
48
|
-
self.agent_provider_openai = None
|
|
49
|
-
self.assistant_id = ""
|
|
50
|
-
self.description = ""
|
|
51
|
-
self.enabled = True
|
|
52
47
|
self.tools = {
|
|
53
48
|
"function": [],
|
|
54
49
|
}
|
|
55
|
-
self.
|
|
56
|
-
self.
|
|
50
|
+
self.uuid = None
|
|
51
|
+
self.user_name = ""
|
|
52
|
+
self.version = None
|
|
53
|
+
self.vision = False
|
|
57
54
|
|
|
58
55
|
def get_id(self) -> str:
|
|
56
|
+
"""
|
|
57
|
+
Get preset ID
|
|
58
|
+
|
|
59
|
+
:return: ID of the preset
|
|
60
|
+
"""
|
|
59
61
|
return self.filename
|
|
60
62
|
|
|
61
|
-
def to_dict(self):
|
|
63
|
+
def to_dict(self) -> dict:
|
|
64
|
+
"""
|
|
65
|
+
Convert preset item to dict
|
|
66
|
+
|
|
67
|
+
:return: dict representation of the preset item
|
|
68
|
+
"""
|
|
62
69
|
return {
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
70
|
+
"agent": self.agent,
|
|
71
|
+
"agent_llama": self.agent_llama,
|
|
72
|
+
"agent_openai": self.agent_openai,
|
|
73
|
+
"agent_provider": self.agent_provider,
|
|
74
|
+
"agent_provider_openai": self.agent_provider_openai,
|
|
66
75
|
"ai_avatar": self.ai_avatar,
|
|
76
|
+
"ai_name": self.ai_name,
|
|
67
77
|
"ai_personalize": self.ai_personalize,
|
|
68
|
-
"
|
|
69
|
-
"
|
|
78
|
+
"assistant": self.assistant,
|
|
79
|
+
"assistant_id": self.assistant_id,
|
|
80
|
+
"audio": self.audio,
|
|
70
81
|
"chat": self.chat,
|
|
71
82
|
"completion": self.completion,
|
|
83
|
+
"computer": self.computer,
|
|
84
|
+
"description": self.description,
|
|
85
|
+
"enabled": self.enabled,
|
|
86
|
+
"expert": self.expert,
|
|
87
|
+
"experts": self.experts,
|
|
88
|
+
"extra": self.extra,
|
|
89
|
+
"filename": self.filename,
|
|
72
90
|
"img": self.img,
|
|
73
|
-
"
|
|
91
|
+
"idx": self.idx,
|
|
74
92
|
"langchain": self.langchain,
|
|
75
|
-
"assistant": self.assistant,
|
|
76
93
|
"llama_index": self.llama_index,
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"audio": self.audio,
|
|
94
|
+
"model": self.model,
|
|
95
|
+
"name": self.name,
|
|
96
|
+
"prompt": self.prompt,
|
|
97
|
+
"remote_tools": self.remote_tools,
|
|
82
98
|
"research": self.research,
|
|
83
|
-
"computer": self.computer,
|
|
84
99
|
"temperature": self.temperature,
|
|
85
|
-
"filename": self.filename,
|
|
86
|
-
"model": self.model,
|
|
87
100
|
"tool.function": self.tools["function"],
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"assistant_id": self.assistant_id,
|
|
93
|
-
"enabled": self.enabled,
|
|
94
|
-
"description": self.description,
|
|
95
|
-
"remote_tools": self.remote_tools,
|
|
96
|
-
"extra": self.extra,
|
|
101
|
+
"user_name": self.user_name,
|
|
102
|
+
"uuid": str(self.uuid),
|
|
103
|
+
"version": self.version,
|
|
104
|
+
"vision": self.vision,
|
|
97
105
|
}
|
|
98
106
|
|
|
99
|
-
def from_dict(self, data):
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
107
|
+
def from_dict(self, data: dict):
|
|
108
|
+
"""
|
|
109
|
+
Load data from dict
|
|
110
|
+
|
|
111
|
+
:param data: data dict
|
|
112
|
+
"""
|
|
113
|
+
if "agent" in data:
|
|
114
|
+
self.agent = data["agent"]
|
|
115
|
+
if "agent_llama" in data:
|
|
116
|
+
self.agent_llama = data["agent_llama"]
|
|
117
|
+
if "agent_openai" in data:
|
|
118
|
+
self.agent_openai = data["agent_openai"]
|
|
119
|
+
if "agent_provider" in data:
|
|
120
|
+
self.agent_provider = data["agent_provider"]
|
|
121
|
+
if "agent_provider_openai" in data:
|
|
122
|
+
self.agent_provider_openai = data["agent_provider_openai"]
|
|
106
123
|
if "ai_avatar" in data:
|
|
107
124
|
self.ai_avatar = data["ai_avatar"]
|
|
125
|
+
if "ai_name" in data:
|
|
126
|
+
self.ai_name = data["ai_name"]
|
|
108
127
|
if "ai_personalize" in data:
|
|
109
128
|
self.ai_personalize = data["ai_personalize"]
|
|
110
|
-
if "
|
|
111
|
-
self.
|
|
112
|
-
if "
|
|
113
|
-
self.
|
|
129
|
+
if "assistant" in data:
|
|
130
|
+
self.assistant = data["assistant"]
|
|
131
|
+
if "assistant_id" in data:
|
|
132
|
+
self.assistant_id = data["assistant_id"]
|
|
133
|
+
if "audio" in data:
|
|
134
|
+
self.audio = data["audio"]
|
|
114
135
|
if "chat" in data:
|
|
115
136
|
self.chat = data["chat"]
|
|
116
137
|
if "completion" in data:
|
|
117
138
|
self.completion = data["completion"]
|
|
139
|
+
if "computer" in data:
|
|
140
|
+
self.computer = data["computer"]
|
|
141
|
+
if "description" in data:
|
|
142
|
+
self.description = data["description"]
|
|
143
|
+
if "enabled" in data:
|
|
144
|
+
self.enabled = data["enabled"]
|
|
145
|
+
if "expert" in data:
|
|
146
|
+
self.expert = data["expert"]
|
|
147
|
+
if "experts" in data:
|
|
148
|
+
self.experts = data["experts"]
|
|
149
|
+
if "extra" in data:
|
|
150
|
+
self.extra = data["extra"]
|
|
151
|
+
if "filename" in data:
|
|
152
|
+
self.filename = data["filename"]
|
|
118
153
|
if "img" in data:
|
|
119
154
|
self.img = data["img"]
|
|
120
|
-
if "
|
|
121
|
-
self.
|
|
155
|
+
if "idx" in data:
|
|
156
|
+
self.idx = data["idx"]
|
|
122
157
|
if "langchain" in data:
|
|
123
158
|
self.langchain = data["langchain"]
|
|
124
|
-
if "assistant" in data:
|
|
125
|
-
self.assistant = data["assistant"]
|
|
126
159
|
if "llama_index" in data:
|
|
127
160
|
self.llama_index = data["llama_index"]
|
|
128
|
-
if "
|
|
129
|
-
self.
|
|
130
|
-
if "
|
|
131
|
-
self.
|
|
132
|
-
if "
|
|
133
|
-
self.
|
|
134
|
-
if "
|
|
135
|
-
self.
|
|
136
|
-
if "audio" in data:
|
|
137
|
-
self.audio = data["audio"]
|
|
161
|
+
if "model" in data:
|
|
162
|
+
self.model = data["model"]
|
|
163
|
+
if "name" in data:
|
|
164
|
+
self.name = data["name"]
|
|
165
|
+
if "prompt" in data:
|
|
166
|
+
self.prompt = data["prompt"]
|
|
167
|
+
if "remote_tools" in data:
|
|
168
|
+
self.remote_tools = data["remote_tools"]
|
|
138
169
|
if "research" in data:
|
|
139
170
|
self.research = data["research"]
|
|
140
|
-
if "computer" in data:
|
|
141
|
-
self.computer = data["computer"]
|
|
142
171
|
if "temperature" in data:
|
|
143
172
|
self.temperature = data["temperature"]
|
|
144
|
-
if "filename" in data:
|
|
145
|
-
self.filename = data["filename"]
|
|
146
|
-
if "model" in data:
|
|
147
|
-
self.model = data["model"]
|
|
148
173
|
if "tool.function" in data:
|
|
149
174
|
self.tools["function"] = data["tool.function"]
|
|
150
|
-
if "
|
|
151
|
-
self.
|
|
152
|
-
if "
|
|
153
|
-
self.
|
|
154
|
-
if "
|
|
155
|
-
self.
|
|
156
|
-
if "agent_provider_openai" in data:
|
|
157
|
-
self.agent_provider_openai = data["agent_provider_openai"]
|
|
158
|
-
if "assistant_id" in data:
|
|
159
|
-
self.assistant_id = data["assistant_id"]
|
|
160
|
-
if "enabled" in data:
|
|
161
|
-
self.enabled = data["enabled"]
|
|
162
|
-
if "description" in data:
|
|
163
|
-
self.description = data["description"]
|
|
164
|
-
if "remote_tools" in data:
|
|
165
|
-
self.remote_tools = data["remote_tools"]
|
|
166
|
-
if "extra" in data:
|
|
167
|
-
self.extra = data["extra"]
|
|
175
|
+
if "user_name" in data:
|
|
176
|
+
self.user_name = data["user_name"]
|
|
177
|
+
if "uuid" in data:
|
|
178
|
+
self.uuid = uuid.UUID(data["uuid"])
|
|
179
|
+
if "vision" in data:
|
|
180
|
+
self.vision = data["vision"]
|
|
168
181
|
return self
|
|
169
182
|
|
|
170
183
|
def add_function(self, name: str, parameters: str, desc: str):
|
|
@@ -211,6 +224,10 @@ class PresetItem:
|
|
|
211
224
|
pass
|
|
212
225
|
return ""
|
|
213
226
|
|
|
214
|
-
def __str__(self):
|
|
215
|
-
"""
|
|
227
|
+
def __str__(self) -> str:
|
|
228
|
+
"""
|
|
229
|
+
To string
|
|
230
|
+
|
|
231
|
+
:return: serialized item
|
|
232
|
+
"""
|
|
216
233
|
return self.dump()
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
# GitHub: https://github.com/szczyglis-dev/py-gpt #
|
|
7
7
|
# MIT License #
|
|
8
8
|
# Created By : Marcin Szczygliński #
|
|
9
|
-
# Updated Date: 2025.08.
|
|
9
|
+
# Updated Date: 2025.08.24 23:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
from pygpt_net.plugin.base.plugin import BasePlugin
|
|
@@ -20,7 +20,7 @@ class Plugin(BasePlugin):
|
|
|
20
20
|
def __init__(self, *args, **kwargs):
|
|
21
21
|
super(Plugin, self).__init__(*args, **kwargs)
|
|
22
22
|
self.id = "twitter"
|
|
23
|
-
self.name = "Twitter
|
|
23
|
+
self.name = "X/Twitter"
|
|
24
24
|
self.description = "Interact with tweets and users, manage bookmarks and media, perform likes, retweets, and more."
|
|
25
25
|
self.prefix = "API"
|
|
26
26
|
self.order = 100
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
# GitHub: https://github.com/szczyglis-dev/py-gpt #
|
|
7
7
|
# MIT License #
|
|
8
8
|
# Created By : Marcin Szczygliński #
|
|
9
|
-
# Updated Date: 2025.08.
|
|
9
|
+
# Updated Date: 2025.08.24 02:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
from typing import List, Optional, Callable
|
|
@@ -518,7 +518,7 @@ class PlannerWorkflow(Workflow):
|
|
|
518
518
|
lines.append(
|
|
519
519
|
f"\n**===== Sub Task {i}: {st.name} =====**\n"
|
|
520
520
|
f"Expected output: {st.expected_output}\n"
|
|
521
|
-
f"Dependencies: {st.dependencies}\n"
|
|
521
|
+
f"Dependencies: {st.dependencies}\n\n"
|
|
522
522
|
)
|
|
523
523
|
await self._emit_text(ctx, "\n".join(lines))
|
|
524
524
|
return PlanReady(plan=plan, query=ev.query)
|
|
@@ -556,7 +556,7 @@ class PlannerWorkflow(Workflow):
|
|
|
556
556
|
header = (
|
|
557
557
|
f"\n\n**===== Sub Task {i}/{total}: {st.name} =====**\n"
|
|
558
558
|
f"Expected output: {st.expected_output}\n"
|
|
559
|
-
f"Dependencies: {st.dependencies}\n"
|
|
559
|
+
f"Dependencies: {st.dependencies}\n\n"
|
|
560
560
|
)
|
|
561
561
|
|
|
562
562
|
# stop callback
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
# GitHub: https://github.com/szczyglis-dev/py-gpt #
|
|
7
7
|
# MIT License #
|
|
8
8
|
# Created By : Marcin Szczygliński #
|
|
9
|
-
# Updated Date: 2025.08.
|
|
9
|
+
# Updated Date: 2025.08.24 03:00:00 #
|
|
10
10
|
# ================================================== #
|
|
11
11
|
|
|
12
12
|
from typing import Dict, Any, Tuple, Optional
|
|
@@ -14,8 +14,6 @@ from typing import Dict, Any, Tuple, Optional
|
|
|
14
14
|
from agents import (
|
|
15
15
|
Agent as OpenAIAgent,
|
|
16
16
|
Runner,
|
|
17
|
-
RunConfig,
|
|
18
|
-
ModelSettings,
|
|
19
17
|
)
|
|
20
18
|
|
|
21
19
|
from pygpt_net.core.agents.bridge import ConnectionContext
|
|
@@ -28,15 +26,13 @@ from pygpt_net.core.types import (
|
|
|
28
26
|
from pygpt_net.item.ctx import CtxItem
|
|
29
27
|
from pygpt_net.item.model import ModelItem
|
|
30
28
|
|
|
31
|
-
from pygpt_net.provider.gpt.agents.
|
|
32
|
-
from pygpt_net.provider.gpt.agents.remote_tools import get_remote_tools, is_computer_tool, append_tools
|
|
29
|
+
from pygpt_net.provider.gpt.agents.remote_tools import is_computer_tool, append_tools
|
|
33
30
|
from pygpt_net.provider.gpt.agents.computer import Agent as ComputerAgent, LocalComputer
|
|
34
31
|
from pygpt_net.provider.gpt.agents.response import StreamHandler
|
|
35
32
|
|
|
36
33
|
from ..base import BaseAgent
|
|
37
34
|
from ...gpt.agents.experts import get_experts
|
|
38
35
|
|
|
39
|
-
|
|
40
36
|
class Agent(BaseAgent):
|
|
41
37
|
def __init__(self, *args, **kwargs):
|
|
42
38
|
super(Agent, self).__init__(*args, **kwargs)
|
|
@@ -63,7 +59,7 @@ class Agent(BaseAgent):
|
|
|
63
59
|
kwargs = {
|
|
64
60
|
"name": agent_name,
|
|
65
61
|
"instructions": system_prompt,
|
|
66
|
-
"model": model
|
|
62
|
+
"model": window.core.agents.provider.get_openai_model(model),
|
|
67
63
|
}
|
|
68
64
|
if handoffs:
|
|
69
65
|
kwargs["handoffs"] = handoffs
|
|
@@ -127,11 +123,7 @@ class Agent(BaseAgent):
|
|
|
127
123
|
"input": messages,
|
|
128
124
|
"max_turns": int(max_steps),
|
|
129
125
|
}
|
|
130
|
-
if model.provider
|
|
131
|
-
custom_provider = get_custom_model_provider(window, model)
|
|
132
|
-
kwargs["run_config"] = RunConfig(model_provider=custom_provider)
|
|
133
|
-
else:
|
|
134
|
-
set_openai_env(window)
|
|
126
|
+
if model.provider == "openai":
|
|
135
127
|
if previous_response_id:
|
|
136
128
|
kwargs["previous_response_id"] = previous_response_id
|
|
137
129
|
|