mlx-code 0.0.32__tar.gz → 0.0.34__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.
- {mlx_code-0.0.32 → mlx_code-0.0.34}/PKG-INFO +2 -2
- {mlx_code-0.0.32 → mlx_code-0.0.34}/README.md +1 -1
- {mlx_code-0.0.32 → mlx_code-0.0.34}/mlx_code/bats.py +1 -2
- {mlx_code-0.0.32 → mlx_code-0.0.34}/mlx_code/main.py +10 -0
- {mlx_code-0.0.32 → mlx_code-0.0.34}/mlx_code/tui.py +11 -2
- {mlx_code-0.0.32 → mlx_code-0.0.34}/mlx_code.egg-info/PKG-INFO +2 -2
- {mlx_code-0.0.32 → mlx_code-0.0.34}/setup.py +1 -1
- {mlx_code-0.0.32 → mlx_code-0.0.34}/LICENSE +0 -0
- {mlx_code-0.0.32 → mlx_code-0.0.34}/mlx_code/__init__.py +0 -0
- {mlx_code-0.0.32 → mlx_code-0.0.34}/mlx_code/apis.py +0 -0
- {mlx_code-0.0.32 → mlx_code-0.0.34}/mlx_code/bare.py +0 -0
- {mlx_code-0.0.32 → mlx_code-0.0.34}/mlx_code/gits.py +0 -0
- {mlx_code-0.0.32 → mlx_code-0.0.34}/mlx_code/lsp_tool.py +0 -0
- {mlx_code-0.0.32 → mlx_code-0.0.34}/mlx_code/mcb.py +0 -0
- {mlx_code-0.0.32 → mlx_code-0.0.34}/mlx_code/mcb_tool.py +0 -0
- {mlx_code-0.0.32 → mlx_code-0.0.34}/mlx_code/repl.py +0 -0
- {mlx_code-0.0.32 → mlx_code-0.0.34}/mlx_code/stream_log.py +0 -0
- {mlx_code-0.0.32 → mlx_code-0.0.34}/mlx_code/tools.py +0 -0
- {mlx_code-0.0.32 → mlx_code-0.0.34}/mlx_code/util.py +0 -0
- {mlx_code-0.0.32 → mlx_code-0.0.34}/mlx_code/view_git.py +0 -0
- {mlx_code-0.0.32 → mlx_code-0.0.34}/mlx_code/view_log.py +0 -0
- {mlx_code-0.0.32 → mlx_code-0.0.34}/mlx_code/web.py +0 -0
- {mlx_code-0.0.32 → mlx_code-0.0.34}/mlx_code.egg-info/SOURCES.txt +0 -0
- {mlx_code-0.0.32 → mlx_code-0.0.34}/mlx_code.egg-info/dependency_links.txt +0 -0
- {mlx_code-0.0.32 → mlx_code-0.0.34}/mlx_code.egg-info/entry_points.txt +0 -0
- {mlx_code-0.0.32 → mlx_code-0.0.34}/mlx_code.egg-info/requires.txt +0 -0
- {mlx_code-0.0.32 → mlx_code-0.0.34}/mlx_code.egg-info/top_level.txt +0 -0
- {mlx_code-0.0.32 → mlx_code-0.0.34}/setup.cfg +0 -0
- {mlx_code-0.0.32 → mlx_code-0.0.34}/tests/__init__.py +0 -0
- {mlx_code-0.0.32 → mlx_code-0.0.34}/tests/test.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mlx-code
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.34
|
|
4
4
|
Summary: Coding Agent for Mac
|
|
5
5
|
Home-page: https://josefalbers.github.io/mlx-code/
|
|
6
6
|
Author: J Joe
|
|
@@ -107,7 +107,7 @@ result = await agent.run('refactor utils.py to use dataclasses')
|
|
|
107
107
|
|
|
108
108
|
```bash
|
|
109
109
|
# ephemeral run (no installation)
|
|
110
|
-
uvx --from mlx-code[all] mlc
|
|
110
|
+
uvx --from "mlx-code[all]" mlc
|
|
111
111
|
|
|
112
112
|
# or install into the current environment
|
|
113
113
|
pip install mlx-code[all]
|
|
@@ -9,6 +9,7 @@ from array import array
|
|
|
9
9
|
from contextlib import asynccontextmanager
|
|
10
10
|
from pathlib import Path
|
|
11
11
|
import mlx.core as mx
|
|
12
|
+
import uvicorn
|
|
12
13
|
from starlette.applications import Starlette
|
|
13
14
|
from starlette.requests import Request
|
|
14
15
|
from starlette.responses import StreamingResponse, JSONResponse
|
|
@@ -296,7 +297,6 @@ def make_batch_app(model_name: str, cache_dir: str='.cache'):
|
|
|
296
297
|
return Starlette(routes=[Route('/v1/models', list_models, methods=['GET']), Route('/v1/messages/count_tokens', count_tokens, methods=['POST']), Route('/v1/chat/completions', generate_endpoint, methods=['POST']), Route('/v1/messages', generate_endpoint, methods=['POST']), Route('/v1/responses', generate_endpoint, methods=['POST']), Route('/v1beta/models/{rest:path}', generate_endpoint, methods=['POST']), Route('/generate', simple_generate, methods=['POST']), Route('/health', health, methods=['GET'])], lifespan=lifespan)
|
|
297
298
|
|
|
298
299
|
class BatchServer:
|
|
299
|
-
import uvicorn
|
|
300
300
|
|
|
301
301
|
def __init__(self, app, host: str, port: int):
|
|
302
302
|
config = uvicorn.Config(app, host=host, port=port, loop='asyncio', log_level='warning')
|
|
@@ -315,5 +315,4 @@ def make_batch_server(host: str, port: int, model, cache_dir: str='.cache') -> B
|
|
|
315
315
|
app = make_batch_app(model, cache_dir=cache_dir)
|
|
316
316
|
return BatchServer(app, host, port)
|
|
317
317
|
if __name__ == '__main__':
|
|
318
|
-
import uvicorn
|
|
319
318
|
uvicorn.run(make_batch_app('mlx-community/Qwen3.5-4B-OptiQ-4bit'), host='0.0.0.0', port=8000)
|
|
@@ -31,6 +31,7 @@ logger = setup_logger('.log.json')
|
|
|
31
31
|
generation_stream = mx.new_thread_local_stream(mx.default_device())
|
|
32
32
|
gen_lock = threading.Lock()
|
|
33
33
|
abort_ev = threading.Event()
|
|
34
|
+
_EXPERIMENTAL = []
|
|
34
35
|
|
|
35
36
|
@dataclass
|
|
36
37
|
class ToolCall:
|
|
@@ -797,6 +798,13 @@ def stream_sse(format_type, seg_gen, msg_id, in_tokens, think_tags=None):
|
|
|
797
798
|
|
|
798
799
|
def make_handler(model_name, cache_dir, system, names, skips, gwt=None, parse_think=True):
|
|
799
800
|
model, tokenizer = mlx_lm.load(model_name)
|
|
801
|
+
if 'zmlx' in _EXPERIMENTAL:
|
|
802
|
+
try:
|
|
803
|
+
from zmlx.patch import patch
|
|
804
|
+
patch(model)
|
|
805
|
+
logger.info('zmlx enabled')
|
|
806
|
+
except:
|
|
807
|
+
logger.error('pip install "zmlx[lm]"')
|
|
800
808
|
pc = PromptCache(model, model_name=model_name, cache_dir=cache_dir)
|
|
801
809
|
if not isinstance(tokenizer, mlx_lm.tokenizer_utils.TokenizerWrapper):
|
|
802
810
|
tokenizer = mlx_lm.tokenizer_utils.TokenizerWrapper(tokenizer)
|
|
@@ -936,8 +944,10 @@ def main():
|
|
|
936
944
|
parser.add_argument('--bare', action='store_true', help='Use simple terminal REPL instead of TUI')
|
|
937
945
|
parser.add_argument('--web', action='store_true', help='Use web UI instead of TUI')
|
|
938
946
|
parser.add_argument('--web-port', type=int, default=None, help='Port for web UI (default: inference port + 80)')
|
|
947
|
+
parser.add_argument('--experimental', nargs='+', default=[], help='List of experimental features to enable')
|
|
939
948
|
args, leash_args = parser.parse_known_args()
|
|
940
949
|
logger.debug(f'args={args!r} leash_args={leash_args!r}')
|
|
950
|
+
_EXPERIMENTAL.extend(args.experimental)
|
|
941
951
|
if args.engine == 'batch' and args.leash not in ('none', 'noapi'):
|
|
942
952
|
parser.error('--engine batch only supports --leash none or --leash noapi for now')
|
|
943
953
|
cache = os.path.abspath(args.cache)
|
|
@@ -147,6 +147,15 @@ class Tab(Vertical):
|
|
|
147
147
|
self._cache_count: int = -1
|
|
148
148
|
self._rendered_cache: Table | None = None
|
|
149
149
|
self._tool_call_buf: str = ''
|
|
150
|
+
self._stream_dirty: bool = False
|
|
151
|
+
|
|
152
|
+
def on_mount(self) -> None:
|
|
153
|
+
self.set_interval(0.1, self._flush_stream)
|
|
154
|
+
|
|
155
|
+
def _flush_stream(self) -> None:
|
|
156
|
+
if self._stream_dirty:
|
|
157
|
+
self.refresh_stream()
|
|
158
|
+
self._stream_dirty = False
|
|
150
159
|
|
|
151
160
|
@property
|
|
152
161
|
def agent(self) -> Agent:
|
|
@@ -224,7 +233,7 @@ class Tab(Vertical):
|
|
|
224
233
|
self._stream_blocks[-1]['text'] += emit
|
|
225
234
|
else:
|
|
226
235
|
self._stream_blocks.append({'type': 'text', 'text': emit})
|
|
227
|
-
self.
|
|
236
|
+
self._stream_dirty = True
|
|
228
237
|
elif et == 'thinking_delta':
|
|
229
238
|
delta = payload.get('delta', '')
|
|
230
239
|
if delta:
|
|
@@ -232,7 +241,7 @@ class Tab(Vertical):
|
|
|
232
241
|
self._stream_blocks[-1]['text'] += delta
|
|
233
242
|
else:
|
|
234
243
|
self._stream_blocks.append({'type': 'thinking', 'text': delta})
|
|
235
|
-
self.
|
|
244
|
+
self._stream_dirty = True
|
|
236
245
|
elif et == 'tool_start':
|
|
237
246
|
self.refresh_stream()
|
|
238
247
|
elif et == 'tool_end':
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mlx-code
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.34
|
|
4
4
|
Summary: Coding Agent for Mac
|
|
5
5
|
Home-page: https://josefalbers.github.io/mlx-code/
|
|
6
6
|
Author: J Joe
|
|
@@ -107,7 +107,7 @@ result = await agent.run('refactor utils.py to use dataclasses')
|
|
|
107
107
|
|
|
108
108
|
```bash
|
|
109
109
|
# ephemeral run (no installation)
|
|
110
|
-
uvx --from mlx-code[all] mlc
|
|
110
|
+
uvx --from "mlx-code[all]" mlc
|
|
111
111
|
|
|
112
112
|
# or install into the current environment
|
|
113
113
|
pip install mlx-code[all]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|