|
9 | 9 | import sys
|
10 | 10 | import threading
|
11 | 11 | import time
|
| 12 | +from typing import Optional |
12 | 13 |
|
13 | 14 | import ramalama.chat as chat
|
14 | 15 | from ramalama.common import (
|
@@ -118,7 +119,7 @@ def __init__(self, model, model_store_path):
|
118 | 119 | self._model_type = type(self).__name__.lower()
|
119 | 120 |
|
120 | 121 | self._model_store_path: str = model_store_path
|
121 |
| - self._model_store: ModelStore | None = None |
| 122 | + self._model_store: Optional[ModelStore] = None |
122 | 123 |
|
123 | 124 | self.default_image = accel_image(CONFIG)
|
124 | 125 |
|
@@ -443,10 +444,10 @@ def _build_mlx_exec_args(self, subcommand: str, model_path: str, args, extra: li
|
443 | 444 | shlex.quote(model_path),
|
444 | 445 | ]
|
445 | 446 |
|
446 |
| - if getattr(args, "temp", None) is not None: |
| 447 | + if getattr(args, "temp", None): |
447 | 448 | exec_args += ["--temp", str(args.temp)]
|
448 | 449 |
|
449 |
| - if getattr(args, "seed", None) is not None: |
| 450 | + if getattr(args, "seed", None): |
450 | 451 | exec_args += ["--seed", str(args.seed)]
|
451 | 452 |
|
452 | 453 | if getattr(args, "context", None):
|
@@ -476,12 +477,12 @@ def _mlx_generate_response(self, model_path, prompt, args, *, return_response=Fa
|
476 | 477 | from ramalama.engine import dry_run
|
477 | 478 |
|
478 | 479 | dry_run(exec_args)
|
479 |
| - return None if return_response else None |
| 480 | + return |
480 | 481 |
|
481 | 482 | # For single-prompt mode, use exec_cmd
|
482 | 483 | if not return_response:
|
483 | 484 | exec_cmd(exec_args, stdout2null=False)
|
484 |
| - return None |
| 485 | + return |
485 | 486 |
|
486 | 487 | # For interactive mode, we need to capture the response
|
487 | 488 | # Consume stderr concurrently to avoid deadlocks if its buffer fills.
|
|
0 commit comments