pygent 0.1.2__py3-none-any.whl → 0.1.3__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.
- pygent/agent.py +1 -1
- pygent/ui.py +36 -0
- {pygent-0.1.2.dist-info → pygent-0.1.3.dist-info}/METADATA +3 -1
- pygent-0.1.3.dist-info/RECORD +14 -0
- {pygent-0.1.2.dist-info → pygent-0.1.3.dist-info}/entry_points.txt +1 -0
- pygent-0.1.2.dist-info/RECORD +0 -13
- {pygent-0.1.2.dist-info → pygent-0.1.3.dist-info}/WHEEL +0 -0
- {pygent-0.1.2.dist-info → pygent-0.1.3.dist-info}/licenses/LICENSE +0 -0
- {pygent-0.1.2.dist-info → pygent-0.1.3.dist-info}/top_level.txt +0 -0
pygent/agent.py
CHANGED
@@ -18,7 +18,7 @@ from rich.panel import Panel
|
|
18
18
|
from .runtime import Runtime
|
19
19
|
from .tools import TOOL_SCHEMAS, execute_tool
|
20
20
|
|
21
|
-
MODEL = os.getenv("PYGENT_MODEL", "gpt-
|
21
|
+
MODEL = os.getenv("PYGENT_MODEL", "gpt-4.1-mini")
|
22
22
|
SYSTEM_MSG = (
|
23
23
|
"You are Pygent, a sandboxed coding assistant.\n"
|
24
24
|
"Respond with JSON when you need to use a tool."
|
pygent/ui.py
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
from .agent import Agent, _chat
|
2
|
+
from .runtime import Runtime
|
3
|
+
from .tools import execute_tool
|
4
|
+
|
5
|
+
|
6
|
+
def run_gui(use_docker: bool | None = None) -> None:
|
7
|
+
"""Launch a simple Gradio chat interface."""
|
8
|
+
try:
|
9
|
+
import gradio as gr
|
10
|
+
except ModuleNotFoundError as exc: # pragma: no cover - optional
|
11
|
+
raise SystemExit(
|
12
|
+
"Gradio is required for the GUI. Install with 'pip install pygent[ui]'"
|
13
|
+
) from exc
|
14
|
+
|
15
|
+
agent = Agent(runtime=Runtime(use_docker=use_docker))
|
16
|
+
|
17
|
+
def _respond(message: str, history: list[tuple[str, str]] | None) -> str:
|
18
|
+
agent.history.append({"role": "user", "content": message})
|
19
|
+
assistant_msg = _chat(agent.history)
|
20
|
+
agent.history.append(assistant_msg)
|
21
|
+
reply = assistant_msg.content or ""
|
22
|
+
if assistant_msg.tool_calls:
|
23
|
+
for call in assistant_msg.tool_calls:
|
24
|
+
output = execute_tool(call, agent.runtime)
|
25
|
+
agent.history.append({"role": "tool", "content": output, "tool_call_id": call.id})
|
26
|
+
reply += f"\n\n[tool:{call.function.name}]\n{output}"
|
27
|
+
return reply
|
28
|
+
|
29
|
+
try:
|
30
|
+
gr.ChatInterface(_respond, title="Pygent").launch()
|
31
|
+
finally:
|
32
|
+
agent.runtime.cleanup()
|
33
|
+
|
34
|
+
|
35
|
+
def main() -> None: # pragma: no cover
|
36
|
+
run_gui()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: pygent
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.3
|
4
4
|
Summary: Pygent is a minimalist coding assistant that runs commands in a Docker container when available and falls back to local execution. See https://marianochaves.github.io/pygent for documentation and https://github.com/marianochaves/pygent for the source code.
|
5
5
|
Author-email: Mariano Chaves <mchaves.software@gmail.com>
|
6
6
|
Project-URL: Documentation, https://marianochaves.github.io/pygent
|
@@ -16,4 +16,6 @@ Provides-Extra: docs
|
|
16
16
|
Requires-Dist: mkdocs; extra == "docs"
|
17
17
|
Provides-Extra: docker
|
18
18
|
Requires-Dist: docker>=7.0.0; extra == "docker"
|
19
|
+
Provides-Extra: ui
|
20
|
+
Requires-Dist: gradio; extra == "ui"
|
19
21
|
Dynamic: license-file
|
@@ -0,0 +1,14 @@
|
|
1
|
+
pygent/__init__.py,sha256=3YOE3tjTGEc987Vz-TqmYwQ4ogLwTmue642Enf4NVBg,360
|
2
|
+
pygent/agent.py,sha256=1CGNB0rUmn-oiZ6HGfbr7fBwB_VtIVMR4xP3fISy_YM,2228
|
3
|
+
pygent/cli.py,sha256=Hz2FZeNMVhxoT5DjCqphXla3TisGJtPEz921LEcpxrA,527
|
4
|
+
pygent/openai_compat.py,sha256=mS6ntl70jpVH3JzfNYEDhg-z7QIQcMqQTuEV5ja7VOo,2173
|
5
|
+
pygent/py.typed,sha256=0Wh72UpGSn4lSGW-u3xMV9kxcBHMdwE15IGUqiJTwqo,52
|
6
|
+
pygent/runtime.py,sha256=33y4jieNeyZ-9nxtVlOmO236u2fDAAv2GaaEWTQDdm8,3173
|
7
|
+
pygent/tools.py,sha256=Ru2_voFgPUVc6YgBTRVByn7vWTxXAXT-loAWFMkXHno,1460
|
8
|
+
pygent/ui.py,sha256=DSW1o3gdhuEdJkyBkJmPE_NUHgvowzMjW2Hs2kGh_4A,1278
|
9
|
+
pygent-0.1.3.dist-info/licenses/LICENSE,sha256=rIktBU2VR4kHzsWul64cbom2zHIgGqYmABoZwSur6T8,1071
|
10
|
+
pygent-0.1.3.dist-info/METADATA,sha256=tyOn6Jgwd70ALAlVa21m7XulzU4nnGCC_KKquKNKsWg,913
|
11
|
+
pygent-0.1.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
12
|
+
pygent-0.1.3.dist-info/entry_points.txt,sha256=b9j216E5UpuMrQWRZrwyEmacNEAYvw1tCKkZqdIVIOc,70
|
13
|
+
pygent-0.1.3.dist-info/top_level.txt,sha256=P26IYsb-ThK5IkGP_bRuGJQ0Q_Y8JCcbYqVpvULdxDw,7
|
14
|
+
pygent-0.1.3.dist-info/RECORD,,
|
pygent-0.1.2.dist-info/RECORD
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
pygent/__init__.py,sha256=3YOE3tjTGEc987Vz-TqmYwQ4ogLwTmue642Enf4NVBg,360
|
2
|
-
pygent/agent.py,sha256=s80JFgtDZ4tNEroh0qIJ0A_8QAiYyORD82R6KsM6vEo,2235
|
3
|
-
pygent/cli.py,sha256=Hz2FZeNMVhxoT5DjCqphXla3TisGJtPEz921LEcpxrA,527
|
4
|
-
pygent/openai_compat.py,sha256=mS6ntl70jpVH3JzfNYEDhg-z7QIQcMqQTuEV5ja7VOo,2173
|
5
|
-
pygent/py.typed,sha256=0Wh72UpGSn4lSGW-u3xMV9kxcBHMdwE15IGUqiJTwqo,52
|
6
|
-
pygent/runtime.py,sha256=33y4jieNeyZ-9nxtVlOmO236u2fDAAv2GaaEWTQDdm8,3173
|
7
|
-
pygent/tools.py,sha256=Ru2_voFgPUVc6YgBTRVByn7vWTxXAXT-loAWFMkXHno,1460
|
8
|
-
pygent-0.1.2.dist-info/licenses/LICENSE,sha256=rIktBU2VR4kHzsWul64cbom2zHIgGqYmABoZwSur6T8,1071
|
9
|
-
pygent-0.1.2.dist-info/METADATA,sha256=utdsiVHvR3fMjqGeNvBNC4oMrD0Ytav6CYyrgAyjnLM,857
|
10
|
-
pygent-0.1.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
11
|
-
pygent-0.1.2.dist-info/entry_points.txt,sha256=ivw-s2f1abmFsbL4173DP1IuMS7sNxQ6gZuDLdu_jKQ,43
|
12
|
-
pygent-0.1.2.dist-info/top_level.txt,sha256=P26IYsb-ThK5IkGP_bRuGJQ0Q_Y8JCcbYqVpvULdxDw,7
|
13
|
-
pygent-0.1.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|