pygpt-net 2.6.59__py3-none-any.whl → 2.6.60__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 (61) hide show
  1. pygpt_net/CHANGELOG.txt +4 -0
  2. pygpt_net/__init__.py +3 -3
  3. pygpt_net/app.py +9 -5
  4. pygpt_net/controller/__init__.py +1 -0
  5. pygpt_net/controller/presets/editor.py +442 -39
  6. pygpt_net/core/agents/custom/__init__.py +275 -0
  7. pygpt_net/core/agents/custom/debug.py +64 -0
  8. pygpt_net/core/agents/custom/factory.py +109 -0
  9. pygpt_net/core/agents/custom/graph.py +71 -0
  10. pygpt_net/core/agents/custom/llama_index/__init__.py +10 -0
  11. pygpt_net/core/agents/custom/llama_index/factory.py +89 -0
  12. pygpt_net/core/agents/custom/llama_index/router_streamer.py +106 -0
  13. pygpt_net/core/agents/custom/llama_index/runner.py +529 -0
  14. pygpt_net/core/agents/custom/llama_index/stream.py +56 -0
  15. pygpt_net/core/agents/custom/llama_index/utils.py +242 -0
  16. pygpt_net/core/agents/custom/logging.py +50 -0
  17. pygpt_net/core/agents/custom/memory.py +51 -0
  18. pygpt_net/core/agents/custom/router.py +116 -0
  19. pygpt_net/core/agents/custom/router_streamer.py +187 -0
  20. pygpt_net/core/agents/custom/runner.py +454 -0
  21. pygpt_net/core/agents/custom/schema.py +125 -0
  22. pygpt_net/core/agents/custom/utils.py +181 -0
  23. pygpt_net/core/agents/provider.py +72 -7
  24. pygpt_net/core/agents/runner.py +7 -4
  25. pygpt_net/core/agents/runners/helpers.py +1 -1
  26. pygpt_net/core/agents/runners/llama_workflow.py +3 -0
  27. pygpt_net/core/agents/runners/openai_workflow.py +8 -1
  28. pygpt_net/{ui/widget/builder → core/node_editor}/__init__.py +2 -2
  29. pygpt_net/core/{builder → node_editor}/graph.py +11 -218
  30. pygpt_net/core/node_editor/models.py +111 -0
  31. pygpt_net/core/node_editor/types.py +76 -0
  32. pygpt_net/core/node_editor/utils.py +17 -0
  33. pygpt_net/core/render/web/renderer.py +10 -8
  34. pygpt_net/data/config/config.json +3 -3
  35. pygpt_net/data/config/models.json +3 -3
  36. pygpt_net/data/locale/locale.en.ini +4 -4
  37. pygpt_net/item/agent.py +5 -1
  38. pygpt_net/item/preset.py +19 -1
  39. pygpt_net/provider/agents/base.py +33 -2
  40. pygpt_net/provider/agents/llama_index/flow_from_schema.py +92 -0
  41. pygpt_net/provider/agents/openai/flow_from_schema.py +96 -0
  42. pygpt_net/provider/core/agent/json_file.py +11 -5
  43. pygpt_net/tools/agent_builder/tool.py +217 -52
  44. pygpt_net/tools/agent_builder/ui/dialogs.py +119 -24
  45. pygpt_net/tools/agent_builder/ui/list.py +37 -10
  46. pygpt_net/ui/dialog/preset.py +16 -1
  47. pygpt_net/ui/main.py +1 -1
  48. pygpt_net/{core/builder → ui/widget/node_editor}/__init__.py +2 -2
  49. pygpt_net/ui/widget/node_editor/command.py +373 -0
  50. pygpt_net/ui/widget/node_editor/editor.py +2038 -0
  51. pygpt_net/ui/widget/node_editor/item.py +492 -0
  52. pygpt_net/ui/widget/node_editor/node.py +1205 -0
  53. pygpt_net/ui/widget/node_editor/utils.py +17 -0
  54. pygpt_net/ui/widget/node_editor/view.py +247 -0
  55. {pygpt_net-2.6.59.dist-info → pygpt_net-2.6.60.dist-info}/METADATA +72 -2
  56. {pygpt_net-2.6.59.dist-info → pygpt_net-2.6.60.dist-info}/RECORD +59 -33
  57. pygpt_net/core/agents/custom.py +0 -150
  58. pygpt_net/ui/widget/builder/editor.py +0 -2001
  59. {pygpt_net-2.6.59.dist-info → pygpt_net-2.6.60.dist-info}/LICENSE +0 -0
  60. {pygpt_net-2.6.59.dist-info → pygpt_net-2.6.60.dist-info}/WHEEL +0 -0
  61. {pygpt_net-2.6.59.dist-info → pygpt_net-2.6.60.dist-info}/entry_points.txt +0 -0
@@ -1,150 +0,0 @@
1
- #!/usr/bin/env python3
2
- # -*- coding: utf-8 -*-
3
- # ================================================== #
4
- # This file is a part of PYGPT package #
5
- # Website: https://pygpt.net #
6
- # GitHub: https://github.com/szczyglis-dev/py-gpt #
7
- # MIT License #
8
- # Created By : Marcin Szczygliński #
9
- # Updated Date: 2025.09.19 00:00:00 #
10
- # ================================================== #
11
-
12
- import copy
13
- from uuid import uuid4
14
-
15
- from pygpt_net.item.builder_layout import BuilderLayoutItem
16
- from pygpt_net.provider.core.agent.json_file import JsonFileProvider
17
-
18
- class Custom:
19
- def __init__(self, window=None):
20
- """
21
- Custom agents core
22
-
23
- :param window: Window instance
24
- """
25
- self.window = window
26
- self.provider = JsonFileProvider(window) # json file provider
27
- self.agents = {} # dict of AgentItem
28
- self.layout = None # BuilderLayoutItem
29
- self.loaded = False
30
-
31
- def load(self):
32
- """Load custom agents from provider"""
33
- data = self.provider.load()
34
- if "layout" in data:
35
- self.layout = data["layout"]
36
- if "agents" in data:
37
- self.agents = data["agents"]
38
- self.loaded = True
39
-
40
- def save(self):
41
- """Save custom agents to provider"""
42
- self.provider.save(self.layout, self.agents)
43
-
44
- def update_layout(self, layout: dict):
45
- """
46
- Update layout of custom agents
47
-
48
- :param layout: layout dict
49
- """
50
- if self.layout is None:
51
- self.layout = BuilderLayoutItem()
52
- self.layout.data = layout
53
-
54
- def reset(self):
55
- """Reset custom agents"""
56
- self.agents = {}
57
- self.layout = None
58
- self.loaded = False
59
- self.provider.truncate()
60
-
61
- def get_layout(self) -> dict:
62
- """
63
- Get layout of custom agents
64
-
65
- :return: layout dict
66
- """
67
- if not self.loaded:
68
- self.load()
69
- return self.layout
70
-
71
- def get_agents(self) -> dict:
72
- """
73
- Get custom agents
74
-
75
- :return: dict of AgentItem
76
- """
77
- if not self.loaded:
78
- self.load()
79
- return self.agents
80
-
81
- def get_agent(self, agent_id: str):
82
- """
83
- Get custom agent by ID
84
-
85
- :param agent_id: agent ID
86
- :return: AgentItem or None
87
- """
88
- if not self.loaded:
89
- self.load()
90
- return self.agents.get(agent_id)
91
-
92
- def new_agent(self, name: str):
93
- """
94
- Create new custom agent
95
-
96
- :param name: agent name
97
- """
98
- if not self.loaded:
99
- self.load()
100
- new_id = str(uuid4())
101
- from pygpt_net.item.agent import AgentItem
102
- new_agent = AgentItem()
103
- new_agent.id = new_id
104
- new_agent.name = name
105
- self.agents[new_id] = new_agent
106
- self.save()
107
- return new_id
108
-
109
- def duplicate_agent(self, agent_id: str, new_name: str):
110
- """
111
- Duplicate custom agent
112
-
113
- :param agent_id: agent ID
114
- :param new_name: new agent name
115
- """
116
- if not self.loaded:
117
- self.load()
118
- agent = self.agents.get(agent_id)
119
- if agent:
120
- new_agent = copy.deepcopy(agent)
121
- new_agent.id = str(uuid4())
122
- new_agent.name = new_name
123
- self.agents[new_agent.id] = new_agent
124
- self.save()
125
-
126
- def delete_agent(self, agent_id: str):
127
- """
128
- Delete custom agent
129
-
130
- :param agent_id: agent ID
131
- """
132
- if not self.loaded:
133
- self.load()
134
- if agent_id in self.agents:
135
- del self.agents[agent_id]
136
- self.save()
137
-
138
- def update_agent_layout(self, agent_id: str, layout: dict):
139
- """
140
- Update layout of a specific custom agent
141
-
142
- :param agent_id: agent ID
143
- :param layout: new layout dict
144
- """
145
- if not self.loaded:
146
- self.load()
147
- agent = self.agents.get(agent_id)
148
- if agent:
149
- agent.layout = layout
150
- self.save()