Project Digit: Phase 1 DocumentationCore Engine & CLI Prototyping. Establishing the foundational inference bridge between local hardware and the Qwen2.5-Coder:1.5b LLM via the command line. Section 1: Tasklist
Section 2: System PreparationSetting up the local environment and inference engine.
user@elastic:~$ ollama pull qwen2.5-coder:1.5b
user@elastic:~$ pip install rich ollama Section 3: CLI ImplementationThe core Python script that acts as the bridge between your terminal and the local model.
#!/usr/bin/env python3
import sys
import argparse
from rich.console import Console
from rich.markdown import Markdown
from rich.live import Live
import ollama
def main():
parser = argparse.ArgumentParser(prog="digit")
parser.add_argument("prompt", nargs="+")
args = parser.parse_args()
prompt_text = " ".join(args.prompt)
system_prompt = "You are Digit, a minimalist code librarian and coding assistant. Only explain code, provide examples, or reference documentation. Keep answers concise, highly technical, and accurate. Format output in Markdown."
console = Console()
try:
response = ollama.chat(
model="qwen2.5-coder:1.5b",
messages=[
{"role": "system", "content": system_prompt},
{"role": "user", "content": prompt_text}
],
stream=True
)
full_response = ""
with Live(console=console, refresh_per_second=10) as live:
for chunk in response:
full_response += chunk['message']['content']
live.update(Markdown(full_response))
except Exception as e:
console.print(f"Error: {e}")
if __name__ == "__main__":
main()
Section 4: Execution & TestingFinalizing the installation and testing the CLI.
user@elastic:~$ chmod +x ~/.local/bin/digit
user@elastic:~$ digit explain time.h and when i should use it Optimized for 800x600 resolution. |