| import os | |
| from langchain_openai import ChatOpenAI | |
| from browser_use import Browser | |
| from orchestrator.config import AGENT_LLM_API_KEY, AGENT_LLM_MODEL, AGENT_LLM_BASE_URL | |
| def get_llm(): | |
| """ | |
| Returns an instance of ChatOpenAI configured with environment variables. | |
| Make sure the model supports Vision capabilities. | |
| """ | |
| if not AGENT_LLM_API_KEY: | |
| raise ValueError("AGENT_LLM_API_KEY is not set. Please configure it in your environment.") | |
| return ChatOpenAI( | |
| api_key=AGENT_LLM_API_KEY, | |
| model=AGENT_LLM_MODEL, | |
| base_url=AGENT_LLM_BASE_URL, | |
| ) | |
| def get_browser_with_auth(storage_state_path: str | None = None) -> Browser: | |
| """ | |
| Creates a browser-use Browser instance. | |
| """ | |
| # Just instantiate Browser. Since v0.12, complex config is usually handled at the Agent/Context level | |
| # or by passing playwright arguments. Here we just use the default. | |
| return Browser() | |