pygpt-net 2.6.53__py3-none-any.whl → 2.6.54__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 (35) hide show
  1. pygpt_net/CHANGELOG.txt +6 -0
  2. pygpt_net/__init__.py +3 -3
  3. pygpt_net/app.py +4 -0
  4. pygpt_net/controller/chat/remote_tools.py +2 -2
  5. pygpt_net/controller/ui/mode.py +7 -1
  6. pygpt_net/core/agents/provider.py +16 -9
  7. pygpt_net/core/models/models.py +25 -1
  8. pygpt_net/data/config/config.json +4 -4
  9. pygpt_net/data/config/models.json +3 -3
  10. pygpt_net/data/js/app.js +19 -0
  11. pygpt_net/data/locale/plugin.osm.en.ini +35 -0
  12. pygpt_net/data/locale/plugin.wolfram.en.ini +24 -0
  13. pygpt_net/js_rc.py +10490 -10432
  14. pygpt_net/plugin/base/worker.py +7 -1
  15. pygpt_net/plugin/osm/__init__.py +12 -0
  16. pygpt_net/plugin/osm/config.py +267 -0
  17. pygpt_net/plugin/osm/plugin.py +87 -0
  18. pygpt_net/plugin/osm/worker.py +719 -0
  19. pygpt_net/plugin/wolfram/__init__.py +12 -0
  20. pygpt_net/plugin/wolfram/config.py +214 -0
  21. pygpt_net/plugin/wolfram/plugin.py +115 -0
  22. pygpt_net/plugin/wolfram/worker.py +551 -0
  23. pygpt_net/provider/api/google/video.py +0 -0
  24. pygpt_net/provider/api/openai/agents/experts.py +1 -1
  25. pygpt_net/provider/api/openai/chat.py +2 -9
  26. pygpt_net/provider/api/x_ai/remote.py +2 -2
  27. pygpt_net/provider/llms/anthropic.py +29 -1
  28. pygpt_net/provider/llms/google.py +30 -1
  29. pygpt_net/provider/llms/open_router.py +3 -1
  30. pygpt_net/provider/llms/x_ai.py +21 -1
  31. {pygpt_net-2.6.53.dist-info → pygpt_net-2.6.54.dist-info}/METADATA +32 -2
  32. {pygpt_net-2.6.53.dist-info → pygpt_net-2.6.54.dist-info}/RECORD +34 -24
  33. {pygpt_net-2.6.53.dist-info → pygpt_net-2.6.54.dist-info}/LICENSE +0 -0
  34. {pygpt_net-2.6.53.dist-info → pygpt_net-2.6.54.dist-info}/WHEEL +0 -0
  35. {pygpt_net-2.6.53.dist-info → pygpt_net-2.6.54.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,12 @@
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.06.30 02:00:00 #
10
+ # ================================================== #
11
+
12
+ from .plugin import *
@@ -0,0 +1,214 @@
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.17 00:00:00 #
10
+ # ================================================== #
11
+
12
+ from pygpt_net.plugin.base.config import BaseConfig, BasePlugin
13
+
14
+
15
+ class Config(BaseConfig):
16
+ def __init__(self, plugin: BasePlugin = None, *args, **kwargs):
17
+ super(Config, self).__init__(plugin)
18
+ self.plugin = plugin
19
+
20
+ def from_defaults(self, plugin: BasePlugin = None):
21
+ # Endpoints / HTTP
22
+ plugin.add_option(
23
+ "api_base",
24
+ type="text",
25
+ value="https://api.wolframalpha.com",
26
+ label="API base",
27
+ description="Base API URL (default https://api.wolframalpha.com).",
28
+ )
29
+ plugin.add_option(
30
+ "http_timeout",
31
+ type="int",
32
+ value=30,
33
+ label="HTTP timeout (s)",
34
+ description="Requests timeout in seconds.",
35
+ )
36
+
37
+ # Auth / Keys
38
+ plugin.add_option(
39
+ "wa_appid",
40
+ type="text",
41
+ value="",
42
+ label="Wolfram Alpha AppID",
43
+ description="Your Wolfram Alpha AppID (https://developer.wolframalpha.com).",
44
+ secret=True,
45
+ )
46
+
47
+ # Defaults
48
+ plugin.add_option(
49
+ "units",
50
+ type="text",
51
+ value="metric",
52
+ label="Units",
53
+ description="metric | nonmetric (applied where supported).",
54
+ )
55
+ plugin.add_option(
56
+ "simple_background",
57
+ type="text",
58
+ value="white",
59
+ label="Simple API background",
60
+ description="white | transparent",
61
+ )
62
+ plugin.add_option(
63
+ "simple_layout",
64
+ type="text",
65
+ value="labelbar",
66
+ label="Simple API layout",
67
+ description="labelbar | inputonly | etc.",
68
+ )
69
+ plugin.add_option(
70
+ "simple_width",
71
+ type="int",
72
+ value=600,
73
+ label="Simple API width",
74
+ description="Image width in pixels (optional).",
75
+ )
76
+
77
+ # ---------------- Commands ----------------
78
+
79
+ # Generic endpoints
80
+ plugin.add_cmd(
81
+ "wa_short",
82
+ instruction="WolframAlpha: Short answer (concise text).",
83
+ params=[{"name": "query", "type": "str", "required": True, "description": "Natural language or math"}],
84
+ enabled=True,
85
+ description="Wolfram: short answer",
86
+ tab="query",
87
+ )
88
+ plugin.add_cmd(
89
+ "wa_spoken",
90
+ instruction="WolframAlpha: Spoken result (single sentence).",
91
+ params=[{"name": "query", "type": "str", "required": True, "description": "Natural language or math"}],
92
+ enabled=True,
93
+ description="Wolfram: spoken",
94
+ tab="query",
95
+ )
96
+ plugin.add_cmd(
97
+ "wa_simple",
98
+ instruction="WolframAlpha: Simple image result (PNG/GIF).",
99
+ params=[
100
+ {"name": "query", "type": "str", "required": True, "description": "Query"},
101
+ {"name": "out", "type": "str", "required": False, "description": "Output file path (relative or absolute)"},
102
+ {"name": "background", "type": "str", "required": False, "description": "white|transparent"},
103
+ {"name": "layout", "type": "str", "required": False, "description": "labelbar|inputonly|..."},
104
+ {"name": "width", "type": "int", "required": False, "description": "Image width"},
105
+ ],
106
+ enabled=True,
107
+ description="Wolfram: simple image",
108
+ tab="query",
109
+ )
110
+ plugin.add_cmd(
111
+ "wa_query",
112
+ instruction="WolframAlpha: Full JSON query (pods).",
113
+ params=[
114
+ {"name": "query", "type": "str", "required": True, "description": "Query"},
115
+ {"name": "format", "type": "str", "required": False, "description": "plaintext,image,..."},
116
+ {"name": "assumptions", "type": "list", "required": False, "description": "List of 'assumption' strings"},
117
+ {"name": "podstate", "type": "str", "required": False, "description": "Pod state id"},
118
+ {"name": "scantimeout", "type": "int", "required": False, "description": "Scan timeout (s)"},
119
+ {"name": "podtimeout", "type": "int", "required": False, "description": "Pod timeout (s)"},
120
+ {"name": "maxwidth", "type": "int", "required": False, "description": "Max image width"},
121
+ {"name": "download_images", "type": "bool", "required": False, "description": "Download pod images"},
122
+ {"name": "max_images", "type": "int", "required": False, "description": "Max images to download"},
123
+ ],
124
+ enabled=True,
125
+ description="Wolfram: full query (pods)",
126
+ tab="query",
127
+ )
128
+
129
+ # Math convenience
130
+ plugin.add_cmd(
131
+ "wa_calculate",
132
+ instruction="WolframAlpha: Evaluate/simplify numeric or symbolic expression.",
133
+ params=[{"name": "expr", "type": "str", "required": True, "description": "Expression"}],
134
+ enabled=True,
135
+ description="Math: calculate",
136
+ tab="math",
137
+ )
138
+ plugin.add_cmd(
139
+ "wa_solve",
140
+ instruction="WolframAlpha: Solve equation(s).",
141
+ params=[
142
+ {"name": "equation", "type": "str", "required": False, "description": "Single equation"},
143
+ {"name": "equations", "type": "list", "required": False, "description": "List of equations"},
144
+ {"name": "var", "type": "str", "required": False, "description": "Variable"},
145
+ {"name": "variables", "type": "list", "required": False, "description": "Variables list"},
146
+ {"name": "domain", "type": "str", "required": False, "description": "reals|integers|complexes"},
147
+ ],
148
+ enabled=True,
149
+ description="Math: solve",
150
+ tab="math",
151
+ )
152
+ plugin.add_cmd(
153
+ "wa_derivative",
154
+ instruction="WolframAlpha: Compute derivative.",
155
+ params=[
156
+ {"name": "expr", "type": "str", "required": True, "description": "Expression"},
157
+ {"name": "var", "type": "str", "required": False, "description": "Variable (default x)"},
158
+ {"name": "order", "type": "int", "required": False, "description": "Order (default 1)"},
159
+ {"name": "at", "type": "str", "required": False, "description": "Evaluation point, e.g. 'x=0'"},
160
+ ],
161
+ enabled=True,
162
+ description="Math: derivative",
163
+ tab="math",
164
+ )
165
+ plugin.add_cmd(
166
+ "wa_integral",
167
+ instruction="WolframAlpha: Compute integral (indef/def).",
168
+ params=[
169
+ {"name": "expr", "type": "str", "required": True, "description": "Expression"},
170
+ {"name": "var", "type": "str", "required": False, "description": "Variable (default x)"},
171
+ {"name": "a", "type": "str", "required": False, "description": "Lower limit"},
172
+ {"name": "b", "type": "str", "required": False, "description": "Upper limit"},
173
+ ],
174
+ enabled=True,
175
+ description="Math: integral",
176
+ tab="math",
177
+ )
178
+ plugin.add_cmd(
179
+ "wa_units_convert",
180
+ instruction="WolframAlpha: Convert units.",
181
+ params=[
182
+ {"name": "value", "type": "str", "required": True, "description": "Numeric value"},
183
+ {"name": "from", "type": "str", "required": True, "description": "From unit"},
184
+ {"name": "to", "type": "str", "required": True, "description": "To unit"},
185
+ ],
186
+ enabled=True,
187
+ description="Units: convert",
188
+ tab="units",
189
+ )
190
+ plugin.add_cmd(
191
+ "wa_matrix",
192
+ instruction="WolframAlpha: Matrix operations (determinant, inverse, eigenvalues, rank).",
193
+ params=[
194
+ {"name": "op", "type": "str", "required": False, "description": "determinant|inverse|eigenvalues|rank"},
195
+ {"name": "matrix", "type": "list", "required": True, "description": "List of lists, e.g. [[1,2],[3,4]]"},
196
+ ],
197
+ enabled=True,
198
+ description="Math: matrix ops",
199
+ tab="math",
200
+ )
201
+ plugin.add_cmd(
202
+ "wa_plot",
203
+ instruction="WolframAlpha: Plot function (image file via Simple API).",
204
+ params=[
205
+ {"name": "func", "type": "str", "required": True, "description": "Function f(x)"},
206
+ {"name": "var", "type": "str", "required": False, "description": "Variable (default x)"},
207
+ {"name": "a", "type": "str", "required": False, "description": "From"},
208
+ {"name": "b", "type": "str", "required": False, "description": "To"},
209
+ {"name": "out", "type": "str", "required": False, "description": "Output file path"},
210
+ ],
211
+ enabled=True,
212
+ description="Plots: function plot",
213
+ tab="plots",
214
+ )
@@ -0,0 +1,115 @@
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.08.15 23:00:00 #
10
+ # ================================================== #
11
+
12
+ from pygpt_net.plugin.base.plugin import BasePlugin
13
+ from pygpt_net.core.events import Event
14
+ from pygpt_net.item.ctx import CtxItem
15
+
16
+ from .config import Config
17
+
18
+
19
+ class Plugin(BasePlugin):
20
+ def __init__(self, *args, **kwargs):
21
+ super(Plugin, self).__init__(*args, **kwargs)
22
+ self.id = "wolfram"
23
+ self.name = "Wolfram Alpha"
24
+ self.description = "Compute and solve with Wolfram Alpha: short answers, full JSON pods, math (solve, derivatives, integrals), unit conversions, matrix operations, and plots."
25
+ self.prefix = "API"
26
+ self.order = 100
27
+ self.allowed_cmds = [
28
+ "wa_short",
29
+ "wa_spoken",
30
+ "wa_simple",
31
+ "wa_query",
32
+ "wa_calculate",
33
+ "wa_solve",
34
+ "wa_derivative",
35
+ "wa_integral",
36
+ "wa_units_convert",
37
+ "wa_matrix",
38
+ "wa_plot"
39
+ ]
40
+ self.use_locale = False
41
+ self.worker = None
42
+ self.config = Config(self)
43
+ self.init_options()
44
+
45
+ def init_options(self):
46
+ """Initialize options"""
47
+ self.config.from_defaults(self)
48
+
49
+ def handle(self, event: Event, *args, **kwargs):
50
+ """
51
+ Handle dispatched event
52
+
53
+ :param event: event object
54
+ :param args: event args
55
+ :param kwargs: event kwargs
56
+ """
57
+ name = event.name
58
+ data = event.data
59
+ ctx = event.ctx
60
+
61
+ if name == Event.CMD_SYNTAX:
62
+ self.cmd_syntax(data)
63
+
64
+ elif name == Event.CMD_EXECUTE:
65
+ self.cmd(
66
+ ctx,
67
+ data['commands'],
68
+ )
69
+
70
+ def cmd_syntax(self, data: dict):
71
+ """
72
+ Event: CMD_SYNTAX
73
+
74
+ :param data: event data dict
75
+ """
76
+ for option in self.allowed_cmds:
77
+ if self.has_cmd(option):
78
+ data['cmd'].append(self.get_cmd(option)) # append command
79
+
80
+ def cmd(self, ctx: CtxItem, cmds: list):
81
+ """
82
+ Event: CMD_EXECUTE
83
+
84
+ :param ctx: CtxItem
85
+ :param cmds: commands dict
86
+ """
87
+
88
+ from .worker import Worker
89
+
90
+ is_cmd = False
91
+ my_commands = []
92
+ for item in cmds:
93
+ if item["cmd"] in self.allowed_cmds:
94
+ my_commands.append(item)
95
+ is_cmd = True
96
+
97
+ if not is_cmd:
98
+ return
99
+
100
+ # set state: busy
101
+ self.cmd_prepare(ctx, my_commands)
102
+
103
+ try:
104
+ worker = Worker()
105
+ worker.from_defaults(self)
106
+ worker.cmds = my_commands
107
+ worker.ctx = ctx
108
+
109
+ if not self.is_async(ctx):
110
+ worker.run()
111
+ return
112
+ worker.run_async()
113
+
114
+ except Exception as e:
115
+ self.error(e)