Agent Zero AI framework
model_config: decouple browser agent model wiring
Alessandro5f235f73f69e
diff --git a/plugins/_browser_agent/extensions/python/_functions/agent/Agent/get_browser_model/start/_10_browser_agent.py b/plugins/_browser_agent/extensions/python/_functions/agent/Agent/get_browser_model/start/_10_browser_agent.pynew file mode 100644index 000000000..57ea73dfb--- /dev/null+++ b/plugins/_browser_agent/extensions/python/_functions/agent/Agent/get_browser_model/start/_10_browser_agent.py@@ -0,0 +1,7 @@+from helpers.extension import Extension+from plugins._browser_agent.helpers.browser_llm import build_browser_model_for_agent++class BrowserModelProvider(Extension):+ def execute(self, data: dict = {}, **kwargs):+ if self.agent:+ data["result"] = build_browser_model_for_agent(self.agent)diff --git a/plugins/_browser_agent/helpers/browser_llm.py b/plugins/_browser_agent/helpers/browser_llm.pyindex 90f289360..dabd6bc60 100644--- a/plugins/_browser_agent/helpers/browser_llm.py+++ b/plugins/_browser_agent/helpers/browser_llm.py@@ -129,3 +129,15 @@ def build_browser_model_from_config(model_config,**kwargs,)++def build_browser_model_for_agent(agent=None) -> BrowserCompatibleChatWrapper:+ """Build and return the browser-use adapter using chat model config."""+ from plugins._model_config.helpers.model_config import (+ get_chat_model_config,+ build_model_config,+ )+ import models++ cfg = get_chat_model_config(agent)+ mc = build_model_config(cfg, models.ModelType.CHAT)+ return build_browser_model_from_config(mc)diff --git a/plugins/_model_config/README.md b/plugins/_model_config/README.mdindex ff218d46d..6426a6e25 100644--- a/plugins/_model_config/README.md+++ b/plugins/_model_config/README.md@@ -21,7 +21,8 @@ This plugin centralizes model selection and model-related settings for the appli- **Per-chat override**- Allows a chat context to store a temporary override or preset reference in context data.- **Model object construction**- - Builds `ModelConfig` objects and the runtime chat, browser, utility, and embedding wrappers used elsewhere in the app.+ - Builds `ModelConfig` objects and the runtime chat, utility, and embedding wrappers used elsewhere in the app.+ - Note: Browser model wiring now lives in the `_browser_agent` plugin.- **API key validation**- Reports configured providers that still require API keys.diff --git a/plugins/_model_config/extensions/python/_functions/agent/Agent/get_browser_model/start/_10_model_config.py b/plugins/_model_config/extensions/python/_functions/agent/Agent/get_browser_model/start/_10_model_config.pydeleted file mode 100644index f4797110b..000000000--- a/plugins/_model_config/extensions/python/_functions/agent/Agent/get_browser_model/start/_10_model_config.py+++ /dev/null@@ -1,8 +0,0 @@-from helpers.extension import Extension-from plugins._model_config.helpers.model_config import build_browser_model---class BrowserModelProvider(Extension):- def execute(self, data: dict = {}, **kwargs):- if self.agent:- data["result"] = build_browser_model(self.agent)diff --git a/plugins/_model_config/helpers/model_config.py b/plugins/_model_config/helpers/model_config.pyindex 81fd4ca73..a209e2cca 100644--- a/plugins/_model_config/helpers/model_config.py+++ b/plugins/_model_config/helpers/model_config.py@@ -189,17 +189,6 @@ def build_utility_model(agent=None):)-def build_browser_model(agent=None):- """Build and return the browser-use adapter using chat model config."""- cfg = get_chat_model_config(agent)- mc = build_model_config(cfg, models.ModelType.CHAT)- from plugins._browser_agent.helpers.browser_llm import (- build_browser_model_from_config,- )-- return build_browser_model_from_config(mc)--def build_embedding_model(agent=None):"""Build and return an embedding model wrapper."""cfg = get_embedding_model_config(agent)