alpiecode 2.0.8__tar.gz → 3.0.0__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.
- {alpiecode-2.0.8 → alpiecode-3.0.0}/PKG-INFO +1 -1
- {alpiecode-2.0.8 → alpiecode-3.0.0}/pyproject.toml +1 -1
- {alpiecode-2.0.8 → alpiecode-3.0.0}/src/alpiecode.egg-info/PKG-INFO +1 -1
- {alpiecode-2.0.8 → alpiecode-3.0.0}/src/codeagent/agent.py +9 -10
- {alpiecode-2.0.8 → alpiecode-3.0.0}/src/codeagent/backends/openai_backend.py +39 -9
- {alpiecode-2.0.8 → alpiecode-3.0.0}/src/codeagent/cli.py +5 -2
- {alpiecode-2.0.8 → alpiecode-3.0.0}/src/codeagent/config.py +17 -16
- {alpiecode-2.0.8 → alpiecode-3.0.0}/src/codeagent/doctor.py +4 -3
- {alpiecode-2.0.8 → alpiecode-3.0.0}/README.md +0 -0
- {alpiecode-2.0.8 → alpiecode-3.0.0}/setup.cfg +0 -0
- {alpiecode-2.0.8 → alpiecode-3.0.0}/src/alpiecode/__init__.py +0 -0
- {alpiecode-2.0.8 → alpiecode-3.0.0}/src/alpiecode.egg-info/SOURCES.txt +0 -0
- {alpiecode-2.0.8 → alpiecode-3.0.0}/src/alpiecode.egg-info/dependency_links.txt +0 -0
- {alpiecode-2.0.8 → alpiecode-3.0.0}/src/alpiecode.egg-info/entry_points.txt +0 -0
- {alpiecode-2.0.8 → alpiecode-3.0.0}/src/alpiecode.egg-info/requires.txt +0 -0
- {alpiecode-2.0.8 → alpiecode-3.0.0}/src/alpiecode.egg-info/top_level.txt +0 -0
- {alpiecode-2.0.8 → alpiecode-3.0.0}/src/codeagent/__init__.py +0 -0
- {alpiecode-2.0.8 → alpiecode-3.0.0}/src/codeagent/backends/__init__.py +0 -0
- {alpiecode-2.0.8 → alpiecode-3.0.0}/src/codeagent/backends/base.py +0 -0
- {alpiecode-2.0.8 → alpiecode-3.0.0}/src/codeagent/backends/local_backend.py +0 -0
- {alpiecode-2.0.8 → alpiecode-3.0.0}/src/codeagent/cache.py +0 -0
- {alpiecode-2.0.8 → alpiecode-3.0.0}/src/codeagent/client.py +0 -0
- {alpiecode-2.0.8 → alpiecode-3.0.0}/src/codeagent/compaction.py +0 -0
- {alpiecode-2.0.8 → alpiecode-3.0.0}/src/codeagent/context.py +0 -0
- {alpiecode-2.0.8 → alpiecode-3.0.0}/src/codeagent/executor.py +0 -0
- {alpiecode-2.0.8 → alpiecode-3.0.0}/src/codeagent/extension/alpiecode.vsix +0 -0
- {alpiecode-2.0.8 → alpiecode-3.0.0}/src/codeagent/github.py +0 -0
- {alpiecode-2.0.8 → alpiecode-3.0.0}/src/codeagent/guardian.py +0 -0
- {alpiecode-2.0.8 → alpiecode-3.0.0}/src/codeagent/ipython_ext.py +0 -0
- {alpiecode-2.0.8 → alpiecode-3.0.0}/src/codeagent/local_model.py +0 -0
- {alpiecode-2.0.8 → alpiecode-3.0.0}/src/codeagent/media.py +0 -0
- {alpiecode-2.0.8 → alpiecode-3.0.0}/src/codeagent/memory.py +0 -0
- {alpiecode-2.0.8 → alpiecode-3.0.0}/src/codeagent/orchestrator.py +0 -0
- {alpiecode-2.0.8 → alpiecode-3.0.0}/src/codeagent/prompt.py +0 -0
- {alpiecode-2.0.8 → alpiecode-3.0.0}/src/codeagent/server.py +0 -0
- {alpiecode-2.0.8 → alpiecode-3.0.0}/src/codeagent/session.py +0 -0
- {alpiecode-2.0.8 → alpiecode-3.0.0}/src/codeagent/tools.py +0 -0
- {alpiecode-2.0.8 → alpiecode-3.0.0}/src/codeagent/updater.py +0 -0
- {alpiecode-2.0.8 → alpiecode-3.0.0}/src/codeagent/vscode_installer.py +0 -0
|
@@ -208,14 +208,13 @@ def run_agent(
|
|
|
208
208
|
console.print(f"📺 URL: {url}", style="cyan")
|
|
209
209
|
console.print(f"📂 Workdir: {workdir}", style="dim")
|
|
210
210
|
if not data["is_offline"]:
|
|
211
|
-
console.print(f"🌐 Mode: [bold green]ONLINE[/bold green]
|
|
212
|
-
console.print(f"🤖 Model:
|
|
211
|
+
console.print(f"🌐 Mode: [bold green]ONLINE[/bold green]", style="dim")
|
|
212
|
+
console.print(f"🤖 Model: [bold cyan]alpie_9b[/bold cyan]", style="dim")
|
|
213
213
|
else:
|
|
214
|
-
console.print(f"🧠 Mode: [bold yellow]OFFLINE[/bold yellow]
|
|
215
|
-
console.print(f"
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
console.print(f"🔧 Tools: {data['tool_count']} available", style="dim")
|
|
214
|
+
console.print(f"🧠 Mode: [bold yellow]OFFLINE[/bold yellow]", style="dim")
|
|
215
|
+
console.print(f"🤖 Model: [bold cyan]alpie_9b (Local GGUF)[/bold cyan]", style="dim")
|
|
216
|
+
if cfg.enable_thinking:
|
|
217
|
+
console.print(f"🧠 Reasoning: [bold green]ON[/bold green]", style="dim")
|
|
219
218
|
else:
|
|
220
219
|
console.rule("Agent Started")
|
|
221
220
|
console.print(f"📋 Task: {task.splitlines()[0]}")
|
|
@@ -294,12 +293,12 @@ def run_chat(workdir: Path, cfg: Config, verbose: bool = True) -> None:
|
|
|
294
293
|
|
|
295
294
|
if HAS_RICH:
|
|
296
295
|
console.print()
|
|
296
|
+
mode_line = "🌐 Mode: [bold green]ONLINE[/bold green]\n🤖 Model: [bold cyan]alpie_9b[/bold cyan]" if not is_offline else "🧠 Mode: [bold yellow]OFFLINE[/bold yellow]\n🤖 Model: [bold cyan]alpie_9b (Local GGUF)[/bold cyan]"
|
|
297
297
|
console.print(
|
|
298
298
|
Panel(
|
|
299
|
-
"[bold cyan]AlpieCode[/bold cyan] interactive mode\n"
|
|
299
|
+
f"[bold cyan]AlpieCode[/bold cyan] interactive mode\n"
|
|
300
300
|
f"📂 Working in: [cyan]{workdir}[/cyan]\n"
|
|
301
|
-
|
|
302
|
-
+ f"🔧 Tools: [cyan]{len(active_tools)} available[/cyan]\n\n"
|
|
301
|
+
f"{mode_line}\n\n"
|
|
303
302
|
"Type your request, or [bold red]exit[/bold red] / [bold red]quit[/bold red] to stop.",
|
|
304
303
|
title="💬 Chat Mode",
|
|
305
304
|
border_style="blue",
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"""
|
|
2
|
-
OpenAI-compatible API inference backend.
|
|
2
|
+
OpenAI-compatible API inference backend with smart model resolution.
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
5
|
from typing import Any, List, Optional
|
|
6
|
-
from openai import OpenAI
|
|
6
|
+
from openai import OpenAI, NotFoundError
|
|
7
7
|
|
|
8
8
|
from ..config import Config, get_shared_http_client, is_server_reachable
|
|
9
9
|
from .base import ChatResponse, ToolCall
|
|
@@ -15,6 +15,7 @@ class OpenAIBackend:
|
|
|
15
15
|
def __init__(self, cfg: Config):
|
|
16
16
|
self._cfg = cfg
|
|
17
17
|
self._client: Optional[OpenAI] = None
|
|
18
|
+
self._resolved_model: Optional[str] = None
|
|
18
19
|
|
|
19
20
|
@property
|
|
20
21
|
def name(self) -> str:
|
|
@@ -37,27 +38,57 @@ class OpenAIBackend:
|
|
|
37
38
|
)
|
|
38
39
|
return self._client
|
|
39
40
|
|
|
41
|
+
def _get_available_model(self, client: OpenAI) -> str:
|
|
42
|
+
"""Auto-discover the served model name from /v1/models."""
|
|
43
|
+
if self._resolved_model:
|
|
44
|
+
return self._resolved_model
|
|
45
|
+
try:
|
|
46
|
+
models_list = client.models.list()
|
|
47
|
+
if models_list.data:
|
|
48
|
+
for m in models_list.data:
|
|
49
|
+
if m.id == self._cfg.model or getattr(m, "root", None) == self._cfg.model:
|
|
50
|
+
self._resolved_model = m.id
|
|
51
|
+
return self._resolved_model
|
|
52
|
+
self._resolved_model = models_list.data[0].id
|
|
53
|
+
return self._resolved_model
|
|
54
|
+
except Exception:
|
|
55
|
+
pass
|
|
56
|
+
return self._cfg.model
|
|
57
|
+
|
|
40
58
|
def chat_completion(
|
|
41
59
|
self,
|
|
42
60
|
messages: List[dict],
|
|
43
61
|
tools: Optional[List[dict]] = None,
|
|
44
|
-
temperature: float =
|
|
45
|
-
max_tokens: int =
|
|
62
|
+
temperature: Optional[float] = None,
|
|
63
|
+
max_tokens: Optional[int] = None,
|
|
46
64
|
enable_thinking: bool = True,
|
|
47
65
|
) -> ChatResponse:
|
|
66
|
+
temp = temperature if temperature is not None else getattr(self._cfg, "temperature", 0.1)
|
|
67
|
+
m_tokens = max_tokens if max_tokens is not None else getattr(self._cfg, "max_tokens", 8192)
|
|
68
|
+
|
|
48
69
|
client = self._ensure_client()
|
|
70
|
+
model_name = self._get_available_model(client)
|
|
71
|
+
|
|
49
72
|
params = {
|
|
50
|
-
"model":
|
|
73
|
+
"model": model_name,
|
|
51
74
|
"messages": messages,
|
|
52
|
-
"temperature":
|
|
53
|
-
"max_tokens":
|
|
75
|
+
"temperature": temp,
|
|
76
|
+
"max_tokens": m_tokens,
|
|
54
77
|
"extra_body": {"chat_template_kwargs": {"enable_thinking": enable_thinking}},
|
|
55
78
|
}
|
|
56
79
|
if tools:
|
|
57
80
|
params["tools"] = tools
|
|
58
81
|
params["tool_choice"] = "auto"
|
|
59
82
|
|
|
60
|
-
|
|
83
|
+
try:
|
|
84
|
+
resp = client.chat.completions.create(**params)
|
|
85
|
+
except NotFoundError:
|
|
86
|
+
# Model name mismatch -> re-discover model
|
|
87
|
+
self._resolved_model = None
|
|
88
|
+
model_name = self._get_available_model(client)
|
|
89
|
+
params["model"] = model_name
|
|
90
|
+
resp = client.chat.completions.create(**params)
|
|
91
|
+
|
|
61
92
|
msg = resp.choices[0].message
|
|
62
93
|
|
|
63
94
|
tool_calls = None
|
|
@@ -69,7 +100,6 @@ class OpenAIBackend:
|
|
|
69
100
|
args = json.loads(tc.function.arguments or "{}")
|
|
70
101
|
except (json.JSONDecodeError, TypeError):
|
|
71
102
|
args = {}
|
|
72
|
-
# Defensive: ensure args is always a dict (model sometimes returns lists or strings)
|
|
73
103
|
if not isinstance(args, dict):
|
|
74
104
|
args = {}
|
|
75
105
|
tool_calls.append(
|
|
@@ -74,7 +74,8 @@ def main():
|
|
|
74
74
|
common.add_argument("--url", default=None, help="YouTube URL for video analysis")
|
|
75
75
|
common.add_argument("--github", default=None, help="GitHub repository (e.g. owner/repo or URL) for open-source analysis")
|
|
76
76
|
common.add_argument("--max-turns", type=int, default=None, help="Override max turns")
|
|
77
|
-
common.add_argument("--
|
|
77
|
+
common.add_argument("--thinking", "--reasoning", dest="thinking", action="store_true", help="Enable VLM reasoning mode")
|
|
78
|
+
common.add_argument("--no-thinking", "--non-thinking", dest="no_thinking", action="store_true", help="Disable VLM reasoning mode")
|
|
78
79
|
common.add_argument("--no-update", action="store_true", help="Skip automatic update check")
|
|
79
80
|
common.add_argument("--quiet", action="store_true", help="Suppress per-turn logging")
|
|
80
81
|
|
|
@@ -149,7 +150,9 @@ def main():
|
|
|
149
150
|
|
|
150
151
|
cfg = load_config()
|
|
151
152
|
|
|
152
|
-
if getattr(args, "
|
|
153
|
+
if getattr(args, "thinking", False):
|
|
154
|
+
cfg.enable_thinking = True
|
|
155
|
+
elif getattr(args, "no_thinking", False):
|
|
153
156
|
cfg.enable_thinking = False
|
|
154
157
|
|
|
155
158
|
if args.command == "run":
|
|
@@ -18,19 +18,19 @@ CONFIG_DIR = Path.home() / ".alpiecode"
|
|
|
18
18
|
CONFIG_PATH = CONFIG_DIR / "config.json"
|
|
19
19
|
|
|
20
20
|
# Config version — bump this when defaults change to trigger auto-migration
|
|
21
|
-
CONFIG_VERSION =
|
|
21
|
+
CONFIG_VERSION = 5 # v5: model alpie_9b, reasoning OFF by default, clean display
|
|
22
22
|
|
|
23
23
|
DEFAULTS = {
|
|
24
|
-
"base_url": "http://
|
|
25
|
-
"model": "
|
|
24
|
+
"base_url": "http://20.245.200.125:8000/v1", # Primary endpoint
|
|
25
|
+
"model": "alpie_9b",
|
|
26
26
|
"model_repo": "169Pi/Alpie_learn_prototype_GGUF_NEW",
|
|
27
27
|
"api_key": "not-needed",
|
|
28
28
|
"hf_token": None,
|
|
29
29
|
"max_turns": 50,
|
|
30
|
-
"temperature": 0.
|
|
31
|
-
"max_tokens":
|
|
32
|
-
"enable_thinking":
|
|
33
|
-
"n_ctx": 32768, # 32k context window
|
|
30
|
+
"temperature": 0.1,
|
|
31
|
+
"max_tokens": 8192,
|
|
32
|
+
"enable_thinking": False, # Reasoning OFF by default
|
|
33
|
+
"n_ctx": 32768, # 32k context window
|
|
34
34
|
"n_gpu_layers": None, # None = auto-detect GPU
|
|
35
35
|
"config_version": CONFIG_VERSION,
|
|
36
36
|
}
|
|
@@ -84,14 +84,14 @@ def get_shared_http_client():
|
|
|
84
84
|
@dataclass
|
|
85
85
|
class Config:
|
|
86
86
|
base_url: Optional[str] = None
|
|
87
|
-
model: str = "
|
|
87
|
+
model: str = "alpie_9b" # Server API model name (vLLM)
|
|
88
88
|
model_repo: str = "169Pi/Alpie_learn_prototype_GGUF_NEW" # HuggingFace repo for offline GGUF
|
|
89
89
|
api_key: str = "not-needed"
|
|
90
90
|
hf_token: Optional[str] = None
|
|
91
91
|
max_turns: int = 50
|
|
92
|
-
temperature: float = 0.
|
|
93
|
-
max_tokens: int =
|
|
94
|
-
enable_thinking: bool =
|
|
92
|
+
temperature: float = 0.1
|
|
93
|
+
max_tokens: int = 8192
|
|
94
|
+
enable_thinking: bool = False
|
|
95
95
|
n_ctx: int = 32768
|
|
96
96
|
n_gpu_layers: Optional[int] = None
|
|
97
97
|
|
|
@@ -111,11 +111,12 @@ def load_config() -> Config:
|
|
|
111
111
|
# v1 → v2: n_ctx was 16384, upgrade to 32768
|
|
112
112
|
if saved_data.get("n_ctx") == 16384:
|
|
113
113
|
data["n_ctx"] = 32768
|
|
114
|
-
#
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
114
|
+
# v4 → v5: model alpie_9b, reasoning OFF default
|
|
115
|
+
data["base_url"] = "http://20.245.200.125:8000/v1"
|
|
116
|
+
data["model"] = "alpie_9b"
|
|
117
|
+
data["enable_thinking"] = False
|
|
118
|
+
data["temperature"] = 0.1
|
|
119
|
+
data["max_tokens"] = 8192
|
|
119
120
|
data["config_version"] = CONFIG_VERSION
|
|
120
121
|
needs_save = True
|
|
121
122
|
except Exception:
|
|
@@ -152,15 +152,16 @@ def run_doctor() -> int:
|
|
|
152
152
|
|
|
153
153
|
remote_ok, remote_msg = _check_remote_latency(cfg.base_url)
|
|
154
154
|
if remote_ok:
|
|
155
|
-
print(f" {_colorize('✅', 'green')}
|
|
155
|
+
print(f" {_colorize('✅', 'green')} Primary Endpoint: {cfg.base_url} — {remote_msg}")
|
|
156
156
|
print(f" {_colorize('✅', 'green')} Model Target: {cfg.model}")
|
|
157
157
|
passed_checks += 2
|
|
158
158
|
else:
|
|
159
|
-
print(f" {_colorize('⚠️ ', 'yellow')}
|
|
160
|
-
print(f" {_colorize('ℹ️ ', 'blue')}
|
|
159
|
+
print(f" {_colorize('⚠️ ', 'yellow')} Primary Endpoint: {cfg.base_url} — {remote_msg}")
|
|
160
|
+
print(f" {_colorize('ℹ️ ', 'blue')} Local fallback ready with: {cfg.model_repo}")
|
|
161
161
|
passed_checks += 1
|
|
162
162
|
total_checks += 2
|
|
163
163
|
|
|
164
|
+
|
|
164
165
|
# 4. Development Compilers & Runtimes
|
|
165
166
|
print()
|
|
166
167
|
print(_colorize(" 🧰 Development Tools & Compilers", "cyan"))
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|