Add macOS LLM model engine support and environment setup
This commit is contained in:
@@ -151,6 +151,12 @@ def parse_args() -> argparse.Namespace:
|
||||
parser.add_argument(
|
||||
"--list-voices", action="store_true", help="Print macOS system voices and exit."
|
||||
)
|
||||
parser.add_argument(
|
||||
"--llm-engine",
|
||||
choices=["apple", "macos", "claude"],
|
||||
default="apple",
|
||||
help="LLM engine to use: apple/macos for native on-device macOS LLM, claude for Claude Code.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--claude-model",
|
||||
default=DEFAULT_CLAUDE_MODEL,
|
||||
@@ -475,6 +481,23 @@ def build_claude_options(args: argparse.Namespace, vocabulary=None, brain=None)
|
||||
)
|
||||
|
||||
|
||||
def build_llm(args: argparse.Namespace, vocabulary=None, brain=None, observer=None):
|
||||
if args.llm_engine in ("apple", "macos"):
|
||||
from apple_llm import MacOSLLM, probe_apple_llm
|
||||
|
||||
available, reason = probe_apple_llm()
|
||||
logger.info(f"LLM: macOS native model ({reason})")
|
||||
personality = read_personality(args.cwd) or "You are a helpful macOS voice assistant."
|
||||
system_prompt = personality + "\n\n" + VOICE_STYLE
|
||||
return MacOSLLM(system_prompt=system_prompt, observer=observer)
|
||||
|
||||
logger.info("LLM: Claude Code")
|
||||
return ClaudeCodeLLM(
|
||||
options=build_claude_options(args, vocabulary, brain),
|
||||
observer=observer,
|
||||
)
|
||||
|
||||
|
||||
async def main() -> int:
|
||||
args = parse_args()
|
||||
|
||||
@@ -523,10 +546,7 @@ async def main() -> int:
|
||||
if vocabulary:
|
||||
vocabulary.observe(text)
|
||||
|
||||
llm = ClaudeCodeLLM(
|
||||
options=build_claude_options(args, vocabulary, brain),
|
||||
observer=on_reply,
|
||||
)
|
||||
llm = build_llm(args, vocabulary, brain, observer=on_reply)
|
||||
|
||||
tts = build_tts(args)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user