Skip to content

Commit fe9e831

Browse files
committed
refactor!: make agents more composable
- add `NullReporter` and `NULL_REPORTER` to `askui.reporting` - make Claude 4 available to `AndroidVisionAgent` - extract common base class `AgentBase` from `VisionAgent` and `AndroidVisionAgent` - make all settings for llm apis (messages / chat completions / responses) and agents configurable through environment variables BREAKING CHANGE: - remove `exceptions.AskUiApiError` and `AskUiApiRequestFailedError` (unused) - remove old ways of configuring (env vars and `*Settings` classes) Inference and Anthropic APIs / models except `ASKUI_TOKEN`, `ASKUI_WORKSPACE_ID` and `ASKUI_INFERENCE_ENDPOINT`, and `ANTHROPIC_API_KEY` (still work as before) - extend `ActModel.act` by 2 new parameters `tools` and `settings`
1 parent 978f472 commit fe9e831

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1540
-1958
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ Here's how to create and use custom models:
287287
import functools
288288
from askui import (
289289
ActModel,
290+
ActSettings,
290291
GetModel,
291292
LocateModel,
292293
Locator,
@@ -310,6 +311,8 @@ class MyActModel(ActModel):
310311
messages: list[MessageParam],
311312
model_choice: str,
312313
on_message: OnMessageCb | None = None,
314+
tools: list[Tool] | None = None,
315+
settings: ActSettings | None = None,
313316
) -> None:
314317
# Implement custom act logic, e.g.:
315318
# - Use a different AI model
@@ -389,6 +392,8 @@ class DynamicActModel(ActModel):
389392
messages: list[MessageParam],
390393
model_choice: str,
391394
on_message: OnMessageCb | None = None,
395+
tools: list[Tool] | None = None,
396+
settings: ActSettings | None = None,
392397
) -> None:
393398
pass
394399

src/askui/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,15 @@
3131
ToolUseBlockParam,
3232
UrlImageSourceParam,
3333
)
34+
from .models.shared.settings import ActSettings, MessageSettings
3435
from .models.types.response_schemas import ResponseSchema, ResponseSchemaBase
3536
from .retry import ConfigurableRetry, Retry
3637
from .tools import ModifierKey, PcKey
3738
from .utils.image_utils import ImageSource, Img
3839

3940
__all__ = [
4041
"ActModel",
42+
"ActSettings",
4143
"Base64ImageSourceParam",
4244
"CacheControlEphemeralParam",
4345
"CitationCharLocationParam",
@@ -52,6 +54,7 @@
5254
"LocateModel",
5355
"Locator",
5456
"MessageParam",
57+
"MessageSettings",
5558
"Model",
5659
"ModelChoice",
5760
"ModelComposition",

0 commit comments

Comments
 (0)