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.
Files changed (221) hide show
  1. pygpt_net/CHANGELOG.txt +13 -0
  2. pygpt_net/__init__.py +3 -3
  3. pygpt_net/app.py +3 -1
  4. pygpt_net/controller/__init__.py +4 -8
  5. pygpt_net/controller/access/voice.py +2 -2
  6. pygpt_net/controller/agent/agent.py +130 -2
  7. pygpt_net/controller/agent/experts.py +93 -96
  8. pygpt_net/controller/agent/llama.py +2 -1
  9. pygpt_net/controller/assistant/assistant.py +18 -1
  10. pygpt_net/controller/assistant/batch.py +2 -3
  11. pygpt_net/controller/assistant/editor.py +2 -2
  12. pygpt_net/controller/assistant/files.py +2 -3
  13. pygpt_net/controller/assistant/store.py +2 -2
  14. pygpt_net/controller/attachment/attachment.py +17 -1
  15. pygpt_net/controller/audio/audio.py +2 -2
  16. pygpt_net/controller/camera/camera.py +15 -7
  17. pygpt_net/controller/chat/chat.py +2 -2
  18. pygpt_net/controller/chat/common.py +50 -33
  19. pygpt_net/controller/chat/image.py +67 -77
  20. pygpt_net/controller/chat/input.py +94 -166
  21. pygpt_net/controller/chat/output.py +83 -140
  22. pygpt_net/controller/chat/response.py +83 -102
  23. pygpt_net/controller/chat/text.py +116 -149
  24. pygpt_net/controller/ctx/common.py +2 -1
  25. pygpt_net/controller/ctx/ctx.py +87 -6
  26. pygpt_net/controller/files/files.py +13 -1
  27. pygpt_net/controller/idx/idx.py +26 -2
  28. pygpt_net/controller/idx/indexer.py +85 -76
  29. pygpt_net/controller/kernel/reply.py +53 -66
  30. pygpt_net/controller/kernel/stack.py +16 -16
  31. pygpt_net/controller/lang/lang.py +52 -34
  32. pygpt_net/controller/model/importer.py +3 -2
  33. pygpt_net/controller/model/model.py +62 -3
  34. pygpt_net/controller/notepad/notepad.py +86 -84
  35. pygpt_net/controller/plugins/settings.py +3 -4
  36. pygpt_net/controller/settings/editor.py +4 -4
  37. pygpt_net/controller/settings/profile.py +105 -124
  38. pygpt_net/controller/theme/menu.py +154 -57
  39. pygpt_net/controller/theme/nodes.py +51 -44
  40. pygpt_net/controller/theme/theme.py +33 -9
  41. pygpt_net/controller/tools/tools.py +2 -2
  42. pygpt_net/controller/ui/tabs.py +2 -3
  43. pygpt_net/controller/ui/ui.py +16 -2
  44. pygpt_net/core/agents/observer/evaluation.py +3 -3
  45. pygpt_net/core/agents/provider.py +25 -3
  46. pygpt_net/core/agents/runner.py +4 -1
  47. pygpt_net/core/agents/runners/llama_workflow.py +19 -7
  48. pygpt_net/core/agents/runners/loop.py +3 -1
  49. pygpt_net/core/agents/runners/openai_workflow.py +17 -3
  50. pygpt_net/core/agents/tools.py +4 -1
  51. pygpt_net/core/bridge/context.py +34 -37
  52. pygpt_net/core/ctx/container.py +13 -12
  53. pygpt_net/core/ctx/ctx.py +1 -1
  54. pygpt_net/core/ctx/output.py +7 -4
  55. pygpt_net/core/db/database.py +2 -2
  56. pygpt_net/core/debug/console/console.py +2 -2
  57. pygpt_net/core/debug/debug.py +12 -1
  58. pygpt_net/core/dispatcher/dispatcher.py +24 -1
  59. pygpt_net/core/events/app.py +7 -7
  60. pygpt_net/core/events/control.py +26 -26
  61. pygpt_net/core/events/event.py +6 -3
  62. pygpt_net/core/events/kernel.py +2 -2
  63. pygpt_net/core/events/render.py +13 -13
  64. pygpt_net/core/experts/experts.py +76 -82
  65. pygpt_net/core/experts/worker.py +12 -12
  66. pygpt_net/core/filesystem/actions.py +1 -2
  67. pygpt_net/core/models/models.py +5 -1
  68. pygpt_net/core/models/ollama.py +14 -5
  69. pygpt_net/core/render/plain/helpers.py +2 -5
  70. pygpt_net/core/render/plain/renderer.py +26 -30
  71. pygpt_net/core/render/web/body.py +1 -1
  72. pygpt_net/core/render/web/helpers.py +2 -2
  73. pygpt_net/core/render/web/renderer.py +4 -4
  74. pygpt_net/core/settings/settings.py +43 -13
  75. pygpt_net/core/tabs/tabs.py +20 -13
  76. pygpt_net/core/types/__init__.py +2 -1
  77. pygpt_net/core/types/agent.py +4 -4
  78. pygpt_net/core/types/base.py +19 -0
  79. pygpt_net/core/types/console.py +6 -6
  80. pygpt_net/core/types/mode.py +8 -8
  81. pygpt_net/core/types/multimodal.py +3 -3
  82. pygpt_net/core/types/openai.py +2 -1
  83. pygpt_net/data/config/config.json +5 -5
  84. pygpt_net/data/config/models.json +19 -3
  85. pygpt_net/data/config/settings.json +14 -14
  86. pygpt_net/data/locale/locale.de.ini +4 -1
  87. pygpt_net/data/locale/locale.en.ini +6 -3
  88. pygpt_net/data/locale/locale.es.ini +4 -1
  89. pygpt_net/data/locale/locale.fr.ini +4 -1
  90. pygpt_net/data/locale/locale.it.ini +4 -1
  91. pygpt_net/data/locale/locale.pl.ini +5 -4
  92. pygpt_net/data/locale/locale.uk.ini +4 -1
  93. pygpt_net/data/locale/locale.zh.ini +4 -1
  94. pygpt_net/item/ctx.py +256 -240
  95. pygpt_net/item/model.py +59 -116
  96. pygpt_net/item/preset.py +122 -105
  97. pygpt_net/plugin/twitter/plugin.py +2 -2
  98. pygpt_net/provider/agents/llama_index/workflow/planner.py +3 -3
  99. pygpt_net/provider/agents/openai/agent.py +4 -12
  100. pygpt_net/provider/agents/openai/agent_b2b.py +10 -15
  101. pygpt_net/provider/agents/openai/agent_planner.py +4 -4
  102. pygpt_net/provider/agents/openai/agent_with_experts.py +3 -7
  103. pygpt_net/provider/agents/openai/agent_with_experts_feedback.py +4 -8
  104. pygpt_net/provider/agents/openai/agent_with_feedback.py +4 -8
  105. pygpt_net/provider/agents/openai/bot_researcher.py +2 -18
  106. pygpt_net/provider/agents/openai/bots/__init__.py +0 -0
  107. pygpt_net/provider/agents/openai/bots/research_bot/__init__.py +0 -0
  108. pygpt_net/provider/agents/openai/bots/research_bot/agents/__init__.py +0 -0
  109. pygpt_net/provider/agents/openai/bots/research_bot/agents/planner_agent.py +1 -1
  110. pygpt_net/provider/agents/openai/bots/research_bot/agents/search_agent.py +1 -0
  111. pygpt_net/provider/agents/openai/bots/research_bot/agents/writer_agent.py +1 -1
  112. pygpt_net/provider/agents/openai/bots/research_bot/manager.py +1 -10
  113. pygpt_net/provider/agents/openai/evolve.py +5 -9
  114. pygpt_net/provider/agents/openai/supervisor.py +4 -8
  115. pygpt_net/provider/core/config/patch.py +10 -3
  116. pygpt_net/provider/core/ctx/db_sqlite/utils.py +43 -43
  117. pygpt_net/provider/core/model/patch.py +11 -1
  118. pygpt_net/provider/core/preset/json_file.py +47 -49
  119. pygpt_net/provider/gpt/agents/experts.py +2 -2
  120. pygpt_net/tools/audio_transcriber/ui/dialogs.py +44 -54
  121. pygpt_net/tools/code_interpreter/body.py +1 -2
  122. pygpt_net/tools/code_interpreter/tool.py +7 -4
  123. pygpt_net/tools/code_interpreter/ui/html.py +1 -3
  124. pygpt_net/tools/code_interpreter/ui/widgets.py +2 -3
  125. pygpt_net/tools/html_canvas/ui/widgets.py +1 -3
  126. pygpt_net/tools/image_viewer/ui/dialogs.py +40 -37
  127. pygpt_net/tools/indexer/ui/widgets.py +2 -4
  128. pygpt_net/tools/media_player/tool.py +2 -5
  129. pygpt_net/tools/media_player/ui/widgets.py +60 -36
  130. pygpt_net/tools/text_editor/ui/widgets.py +18 -19
  131. pygpt_net/tools/translator/ui/widgets.py +39 -35
  132. pygpt_net/ui/base/context_menu.py +9 -4
  133. pygpt_net/ui/dialog/db.py +1 -3
  134. pygpt_net/ui/dialog/models.py +1 -3
  135. pygpt_net/ui/dialog/models_importer.py +2 -4
  136. pygpt_net/ui/dialogs.py +34 -30
  137. pygpt_net/ui/layout/chat/attachments.py +72 -84
  138. pygpt_net/ui/layout/chat/attachments_ctx.py +40 -44
  139. pygpt_net/ui/layout/chat/attachments_uploaded.py +36 -39
  140. pygpt_net/ui/layout/chat/calendar.py +100 -70
  141. pygpt_net/ui/layout/chat/chat.py +23 -17
  142. pygpt_net/ui/layout/chat/input.py +95 -118
  143. pygpt_net/ui/layout/chat/output.py +100 -162
  144. pygpt_net/ui/layout/chat/painter.py +89 -61
  145. pygpt_net/ui/layout/ctx/ctx_list.py +43 -52
  146. pygpt_net/ui/layout/status.py +23 -14
  147. pygpt_net/ui/layout/toolbox/agent.py +27 -38
  148. pygpt_net/ui/layout/toolbox/agent_llama.py +42 -45
  149. pygpt_net/ui/layout/toolbox/assistants.py +42 -38
  150. pygpt_net/ui/layout/toolbox/computer_env.py +32 -23
  151. pygpt_net/ui/layout/toolbox/footer.py +13 -16
  152. pygpt_net/ui/layout/toolbox/image.py +18 -21
  153. pygpt_net/ui/layout/toolbox/indexes.py +46 -89
  154. pygpt_net/ui/layout/toolbox/mode.py +20 -7
  155. pygpt_net/ui/layout/toolbox/model.py +12 -10
  156. pygpt_net/ui/layout/toolbox/presets.py +68 -52
  157. pygpt_net/ui/layout/toolbox/prompt.py +31 -58
  158. pygpt_net/ui/layout/toolbox/toolbox.py +25 -21
  159. pygpt_net/ui/layout/toolbox/vision.py +20 -22
  160. pygpt_net/ui/main.py +2 -4
  161. pygpt_net/ui/menu/about.py +64 -84
  162. pygpt_net/ui/menu/audio.py +87 -63
  163. pygpt_net/ui/menu/config.py +121 -127
  164. pygpt_net/ui/menu/debug.py +69 -76
  165. pygpt_net/ui/menu/file.py +32 -35
  166. pygpt_net/ui/menu/menu.py +2 -3
  167. pygpt_net/ui/menu/plugins.py +69 -33
  168. pygpt_net/ui/menu/theme.py +45 -46
  169. pygpt_net/ui/menu/tools.py +56 -60
  170. pygpt_net/ui/menu/video.py +20 -25
  171. pygpt_net/ui/tray.py +1 -2
  172. pygpt_net/ui/widget/audio/bar.py +1 -3
  173. pygpt_net/ui/widget/audio/input_button.py +3 -4
  174. pygpt_net/ui/widget/calendar/select.py +1 -2
  175. pygpt_net/ui/widget/dialog/base.py +12 -9
  176. pygpt_net/ui/widget/dialog/editor_file.py +20 -23
  177. pygpt_net/ui/widget/dialog/find.py +25 -24
  178. pygpt_net/ui/widget/dialog/profile.py +57 -53
  179. pygpt_net/ui/widget/draw/painter.py +62 -93
  180. pygpt_net/ui/widget/element/button.py +42 -30
  181. pygpt_net/ui/widget/element/checkbox.py +23 -15
  182. pygpt_net/ui/widget/element/group.py +6 -5
  183. pygpt_net/ui/widget/element/labels.py +1 -2
  184. pygpt_net/ui/widget/filesystem/explorer.py +93 -102
  185. pygpt_net/ui/widget/image/display.py +1 -2
  186. pygpt_net/ui/widget/lists/assistant.py +1 -2
  187. pygpt_net/ui/widget/lists/attachment.py +1 -2
  188. pygpt_net/ui/widget/lists/attachment_ctx.py +1 -2
  189. pygpt_net/ui/widget/lists/context.py +2 -4
  190. pygpt_net/ui/widget/lists/index.py +1 -2
  191. pygpt_net/ui/widget/lists/model.py +1 -2
  192. pygpt_net/ui/widget/lists/model_editor.py +1 -2
  193. pygpt_net/ui/widget/lists/model_importer.py +1 -2
  194. pygpt_net/ui/widget/lists/preset.py +1 -2
  195. pygpt_net/ui/widget/lists/preset_plugins.py +1 -2
  196. pygpt_net/ui/widget/lists/profile.py +1 -2
  197. pygpt_net/ui/widget/lists/uploaded.py +1 -2
  198. pygpt_net/ui/widget/option/checkbox.py +2 -4
  199. pygpt_net/ui/widget/option/checkbox_list.py +1 -4
  200. pygpt_net/ui/widget/option/cmd.py +1 -4
  201. pygpt_net/ui/widget/option/dictionary.py +25 -28
  202. pygpt_net/ui/widget/option/input.py +1 -3
  203. pygpt_net/ui/widget/tabs/Input.py +16 -12
  204. pygpt_net/ui/widget/tabs/body.py +5 -3
  205. pygpt_net/ui/widget/tabs/layout.py +36 -25
  206. pygpt_net/ui/widget/tabs/output.py +96 -74
  207. pygpt_net/ui/widget/textarea/calendar_note.py +1 -2
  208. pygpt_net/ui/widget/textarea/editor.py +41 -73
  209. pygpt_net/ui/widget/textarea/find.py +11 -10
  210. pygpt_net/ui/widget/textarea/html.py +3 -6
  211. pygpt_net/ui/widget/textarea/input.py +63 -64
  212. pygpt_net/ui/widget/textarea/notepad.py +54 -38
  213. pygpt_net/ui/widget/textarea/output.py +65 -54
  214. pygpt_net/ui/widget/textarea/search_input.py +5 -4
  215. pygpt_net/ui/widget/textarea/web.py +2 -4
  216. pygpt_net/ui/widget/vision/camera.py +2 -31
  217. {pygpt_net-2.6.20.dist-info → pygpt_net-2.6.22.dist-info}/METADATA +25 -154
  218. {pygpt_net-2.6.20.dist-info → pygpt_net-2.6.22.dist-info}/RECORD +218 -217
  219. {pygpt_net-2.6.20.dist-info → pygpt_net-2.6.22.dist-info}/LICENSE +0 -0
  220. {pygpt_net-2.6.20.dist-info → pygpt_net-2.6.22.dist-info}/WHEEL +0 -0
  221. {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.08 19:00:00 #
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.name = None
33
- self.mode = ["chat"]
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.input = ["text"] # multimodal support: image, audio, etc.
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
- data['id'] = self.id
121
- data['name'] = self.name
122
- data['mode'] = ','.join(self.mode)
123
- data['input'] = ','.join(self.input)
124
- data['output'] = ','.join(self.output)
125
- # data['langchain'] = self.langchain
126
- data['ctx'] = self.ctx
127
- data['tokens'] = self.tokens
128
- data['default'] = self.default
129
- data['extra'] = self.extra
130
- data['imported'] = self.imported
131
- data['provider'] = self.provider
132
- data['tool_calls'] = self.tool_calls
133
-
134
- # data['langchain.provider'] = None
135
- # data['langchain.mode'] = ""
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
- item['name'] = key
184
- item['value'] = value
185
- item['type'] = 'str'
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
- item['name'] = key
195
- item['value'] = value
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.09 19:00:00 #
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.uuid = None
21
- self.name = "*"
22
- self.ai_name = ""
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.user_name = ""
26
- self.prompt = ""
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.vision = False
38
+ self.idx = None
31
39
  self.langchain = False
32
- self.assistant = False
33
40
  self.llama_index = False
34
- self.agent = False
35
- self.agent_llama = False
36
- self.agent_openai = False
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.computer = False
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.remote_tools = []
56
- self.extra = {}
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
- "uuid": str(self.uuid),
64
- "name": self.name,
65
- "ai_name": self.ai_name,
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
- "user_name": self.user_name,
69
- "prompt": self.prompt,
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
- "vision": self.vision,
91
+ "idx": self.idx,
74
92
  "langchain": self.langchain,
75
- "assistant": self.assistant,
76
93
  "llama_index": self.llama_index,
77
- "agent": self.agent,
78
- "agent_llama": self.agent_llama,
79
- "agent_openai": self.agent_openai,
80
- "expert": self.expert,
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
- "experts": self.experts,
89
- "idx": self.idx,
90
- "agent_provider": self.agent_provider,
91
- "agent_provider_openai": self.agent_provider_openai,
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
- if "uuid" in data:
101
- self.uuid = uuid.UUID(data["uuid"])
102
- if "name" in data:
103
- self.name = data["name"]
104
- if "ai_name" in data:
105
- self.ai_name = data["ai_name"]
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 "user_name" in data:
111
- self.user_name = data["user_name"]
112
- if "prompt" in data:
113
- self.prompt = data["prompt"]
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 "vision" in data:
121
- self.vision = data["vision"]
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 "agent" in data:
129
- self.agent = data["agent"]
130
- if "agent_llama" in data:
131
- self.agent_llama = data["agent_llama"]
132
- if "agent_openai" in data:
133
- self.agent_openai = data["agent_openai"]
134
- if "expert" in data:
135
- self.expert = data["expert"]
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 "experts" in data:
151
- self.experts = data["experts"]
152
- if "idx" in data:
153
- self.idx = data["idx"]
154
- if "agent_provider" in data:
155
- self.agent_provider = data["agent_provider"]
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
- """To string"""
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.15 23:00:00 #
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/X"
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.14 03:00:00 #
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.11 19:00:00 #
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.client import get_custom_model_provider, set_openai_env
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.id,
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 != "openai":
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