codebind 0.2.0__tar.gz → 0.3.0__tar.gz
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.
- {codebind-0.2.0 → codebind-0.3.0}/PKG-INFO +4 -4
- {codebind-0.2.0 → codebind-0.3.0}/README.md +3 -3
- {codebind-0.2.0 → codebind-0.3.0}/pyproject.toml +1 -1
- {codebind-0.2.0 → codebind-0.3.0}/pyproject.toml.orig +1 -1
- {codebind-0.2.0 → codebind-0.3.0}/src/codebind/session.py +12 -4
- {codebind-0.2.0 → codebind-0.3.0}/LICENSE +0 -0
- {codebind-0.2.0 → codebind-0.3.0}/src/codebind/__init__.py +0 -0
- {codebind-0.2.0 → codebind-0.3.0}/src/codebind/cli.py +0 -0
- {codebind-0.2.0 → codebind-0.3.0}/src/codebind/display.py +0 -0
- {codebind-0.2.0 → codebind-0.3.0}/src/codebind/execution.py +0 -0
- {codebind-0.2.0 → codebind-0.3.0}/src/codebind/extension.py +0 -0
- {codebind-0.2.0 → codebind-0.3.0}/src/codebind/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codebind
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: A frontend-neutral model loop for persistent IPython sessions.
|
|
5
5
|
Keywords: ai,ipython,llm,repl,agents
|
|
6
6
|
Author: Giovanni Gravili
|
|
@@ -51,7 +51,7 @@ It opens standard IPython with `chat` and `Models` in the user namespace. All no
|
|
|
51
51
|
```python
|
|
52
52
|
models = Models({"openai": "OPENAI_API_KEY"})
|
|
53
53
|
|
|
54
|
-
chat.
|
|
54
|
+
chat.send(
|
|
55
55
|
"Inspect this project and tell me what to implement first.",
|
|
56
56
|
models.chat("openai/gpt-5", reasoning_effort="medium"),
|
|
57
57
|
)
|
|
@@ -75,7 +75,7 @@ Load Codebind in a notebook:
|
|
|
75
75
|
|
|
76
76
|
models = Models({"openai": "OPENAI_API_KEY"})
|
|
77
77
|
model = models.chat("openai/gpt-5")
|
|
78
|
-
await chat.
|
|
78
|
+
await chat.asend("Inspect the current notebook state.", model)
|
|
79
79
|
```
|
|
80
80
|
|
|
81
81
|
Codebind publishes cells, assistant Markdown, stdout, tracebacks, and rich results through IPython's MIME display system. The active frontend decides how to render HTML, Markdown, images, SVG, audio, tables, and plain text.
|
|
@@ -94,7 +94,7 @@ authorization = await models.sign_in("openai")
|
|
|
94
94
|
webbrowser.open(authorization.url)
|
|
95
95
|
await authorization.complete()
|
|
96
96
|
|
|
97
|
-
chat.
|
|
97
|
+
chat.send(
|
|
98
98
|
"Inspect this project.",
|
|
99
99
|
models.chat("openai/gpt-5", authorization=authorization),
|
|
100
100
|
)
|
|
@@ -27,7 +27,7 @@ It opens standard IPython with `chat` and `Models` in the user namespace. All no
|
|
|
27
27
|
```python
|
|
28
28
|
models = Models({"openai": "OPENAI_API_KEY"})
|
|
29
29
|
|
|
30
|
-
chat.
|
|
30
|
+
chat.send(
|
|
31
31
|
"Inspect this project and tell me what to implement first.",
|
|
32
32
|
models.chat("openai/gpt-5", reasoning_effort="medium"),
|
|
33
33
|
)
|
|
@@ -51,7 +51,7 @@ Load Codebind in a notebook:
|
|
|
51
51
|
|
|
52
52
|
models = Models({"openai": "OPENAI_API_KEY"})
|
|
53
53
|
model = models.chat("openai/gpt-5")
|
|
54
|
-
await chat.
|
|
54
|
+
await chat.asend("Inspect the current notebook state.", model)
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
Codebind publishes cells, assistant Markdown, stdout, tracebacks, and rich results through IPython's MIME display system. The active frontend decides how to render HTML, Markdown, images, SVG, audio, tables, and plain text.
|
|
@@ -70,7 +70,7 @@ authorization = await models.sign_in("openai")
|
|
|
70
70
|
webbrowser.open(authorization.url)
|
|
71
71
|
await authorization.complete()
|
|
72
72
|
|
|
73
|
-
chat.
|
|
73
|
+
chat.send(
|
|
74
74
|
"Inspect this project.",
|
|
75
75
|
models.chat("openai/gpt-5", authorization=authorization),
|
|
76
76
|
)
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
import asyncio
|
|
5
6
|
import json
|
|
6
7
|
from collections.abc import Mapping, Sequence
|
|
7
8
|
from typing import Any
|
|
@@ -85,8 +86,15 @@ class Session:
|
|
|
85
86
|
if self.instructions:
|
|
86
87
|
self.messages.append(SystemMessage(self.instructions))
|
|
87
88
|
|
|
88
|
-
def
|
|
89
|
-
"""
|
|
89
|
+
def send(self, prompt: str, model: BaseChatModel) -> None:
|
|
90
|
+
"""Send one user message synchronously."""
|
|
91
|
+
try:
|
|
92
|
+
asyncio.get_running_loop()
|
|
93
|
+
except RuntimeError:
|
|
94
|
+
pass
|
|
95
|
+
else:
|
|
96
|
+
raise RuntimeError("send() cannot run inside an active event loop; use await asend().")
|
|
97
|
+
|
|
90
98
|
text = prompt.strip()
|
|
91
99
|
if not text:
|
|
92
100
|
raise ValueError("prompt cannot be empty")
|
|
@@ -117,8 +125,8 @@ class Session:
|
|
|
117
125
|
)
|
|
118
126
|
)
|
|
119
127
|
|
|
120
|
-
async def
|
|
121
|
-
"""
|
|
128
|
+
async def asend(self, prompt: str, model: BaseChatModel) -> None:
|
|
129
|
+
"""Send one user message asynchronously."""
|
|
122
130
|
text = prompt.strip()
|
|
123
131
|
if not text:
|
|
124
132
|
raise ValueError("prompt cannot be empty")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|