Projects
KılıçV2 Assistant
Desktop Automation & LLM
KılıçV2 AI Assistant
A Jarvis-like desktop companion executing direct actions on the Windows ecosystem. Engineered with a provider abstraction layout enabling hot-swaps between OpenAI, Gemini, Groq, or local Ollama engines via environment variables.
Abstraction
Utilizes Python's `Protocol` to standardize backend inference engines into a single unified type signature.
Automation
Translates natural language descriptions down to Windows subsystem calls and app orchestration.
Resilience
Guarantees execution safety with `EchoBrain` fallback loops during API timeout thresholds.
Core Core Brain Architecture (brain.py)
from __future__ import annotations
from dataclasses import dataclass
from typing import Protocol
from .settings import env, env_int
SYSTEM_PROMPT = (
"Sen KILIÇ adında bir Windows masaüstü asistanısın. "
"Türkçe konuş, kısa ama net ol, gereksiz tekrar yapma..."
)
class Brain(Protocol):
def generate(self, prompt: str, history: list[dict[str, str]] | None = None) -> str:
"""Generates textual output for the given input."""
@dataclass(slots=True)
class OpenAIBrain:
api_key: str
model: str = "gpt-4o-mini"
max_tokens: int = 256
def generate(self, prompt: str, history: list[dict[str, str]] | None = None) -> str:
from openai import OpenAI
client = OpenAI(api_key=self.api_key)
messages = [{"role": "system", "content": SYSTEM_PROMPT}]
if history: messages.extend(history)
messages.append({"role": "user", "content": prompt})
response = client.chat.completions.create(
model=self.model, messages=messages, max_tokens=self.max_tokens
)
return response.choices[0].message.content.strip()
def create_brain() -> Brain:
provider = env("KILIC_LLM_PROVIDER", default="groq").lower()
# Dynamic API Selection Logic...
Design Pattern
Polymorphic Core Abstraction
The `Brain(Protocol)` architecture decouples orchestrator components from concrete vendor dependencies. Combined with `slots=True`, it optimizes instance instantiation speeds at microsecond scales.
OS Automation
Deterministic Intent Matching
When users issue task actions, intents filter through native system bindings before hitting LLM contexts. If no immediate macro matches, the pipeline shifts execution context up to the active cloud brain.
Edge Execution
Cloud vs Offline Local Shifting
Supports high-throughput cloud endpoints like Groq and Gemini alongside localized offline `Ollama (llama3.1)` loops, guaranteeing total operational privacy and zero inference bills.
System Integration
Deep OS Loop Instrumentation & Fallback Safety Layers
KılıçV2 transitions from a basic chat interface into an agentic workflow capable of continuous ambient computer control. The rigorous configuration inside `SYSTEM_PROMPT` restrains models from emitting redundant affirmative verbiage, forcing direct actionable command generation instead. Antihallucination parameters force "I don't know" boundaries when queries lack sufficient environmental tracking.
The `create_brain()` initialization utility dynamic-checks global configuration flags at boot. If network connections degrade or credentials rot, the defensive `EchoBrain` entity intervenes to hold the desktop agent loop steady within a protected local state without risking stack fatal exceptions.