Rebase onto upstream (a4d95fd) #12

Closed
wylab wants to merge 144 commits from rebase-onto-upstream into main
2 changed files with 28 additions and 0 deletions
Showing only changes of commit e6ebb65e12 - Show all commits
+11
View File
@@ -0,0 +1,11 @@
FROM birdxs/nanobot:latest
# Copy full project (pyproject.toml + source)
COPY pyproject.toml README.md LICENSE /app/
COPY nanobot/ /app/nanobot/
# Install with all dependencies
RUN uv pip install --system --no-cache --reinstall /app
ENTRYPOINT ["nanobot"]
CMD ["status"]
+17
View File
@@ -44,6 +44,20 @@ class AnthropicOAuthProvider(LLMProvider):
return f"{self.api_base.rstrip('/')}/v1/messages"
return self.ANTHROPIC_API_URL
# Short aliases that need dated suffixes for the API
MODEL_ALIASES: dict[str, str] = {
"claude-sonnet-4": "claude-sonnet-4-20250514",
"claude-opus-4": "claude-opus-4-20250514",
"claude-haiku-3-5": "claude-haiku-4-5-20241022",
"claude-sonnet-4-5": "claude-sonnet-4-5-20250929",
"claude-opus-4-5": "claude-opus-4-5-20250929",
"claude-opus-4-6": "claude-opus-4-6",
}
def _resolve_model_alias(self, model: str) -> str:
"""Resolve short model aliases to full dated IDs."""
return self.MODEL_ALIASES.get(model, model)
async def _get_client(self) -> httpx.AsyncClient:
"""Get or create async HTTP client."""
if self._client is None:
@@ -142,6 +156,9 @@ class AnthropicOAuthProvider(LLMProvider):
if "/" in model:
model = model.split("/")[-1]
# Resolve short aliases to dated model IDs (API requires dated suffixes)
model = self._resolve_model_alias(model)
system, prepared_messages = self._prepare_messages(messages)
anthropic_tools = self._convert_tools_to_anthropic(tools)