add orchestrated version of agent in omnitool

This commit is contained in:
yadong-lu
2025-03-10 20:06:13 -07:00
parent f5fcdf40e6
commit 095cd19ce1
3 changed files with 457 additions and 4 deletions

View File

@@ -18,6 +18,7 @@ from tools import ToolResult
from agent.llm_utils.omniparserclient import OmniParserClient
from agent.anthropic_agent import AnthropicActor
from agent.vlm_agent import VLMAgent
from agent.vlm_agent_with_orchestrator import VLMOrchestratedAgent
from executor.anthropic_executor import AnthropicExecutor
BETA_FLAG = "computer-use-2024-10-22"
@@ -74,6 +75,16 @@ def sampling_loop_sync(
max_tokens=max_tokens,
only_n_most_recent_images=only_n_most_recent_images
)
elif model in set(["omniparser + gpt-4o-orchestrated", "omniparser + o1-orchestrated", "omniparser + o3-mini-orchestrated", "omniparser + R1-orchestrated", "omniparser + qwen2.5vl-orchestrated"]):
actor = VLMOrchestratedAgent(
model=model,
provider=provider,
api_key=api_key,
api_response_callback=api_response_callback,
output_callback=output_callback,
max_tokens=max_tokens,
only_n_most_recent_images=only_n_most_recent_images
)
else:
raise ValueError(f"Model {model} not supported")
executor = AnthropicExecutor(
@@ -102,7 +113,7 @@ def sampling_loop_sync(
messages.append({"content": tool_result_content, "role": "user"})
elif model in set(["omniparser + gpt-4o", "omniparser + o1", "omniparser + o3-mini", "omniparser + R1", "omniparser + qwen2.5vl"]):
elif model in set(["omniparser + gpt-4o", "omniparser + o1", "omniparser + o3-mini", "omniparser + R1", "omniparser + qwen2.5vl", "omniparser + gpt-4o-orchestrated", "omniparser + o1-orchestrated", "omniparser + o3-mini-orchestrated", "omniparser + R1-orchestrated", "omniparser + qwen2.5vl-orchestrated"]):
while True:
parsed_screen = omniparser_client()
tools_use_needed, vlm_response_json = actor(messages=messages, parsed_screen=parsed_screen)