diff --git a/docker-compose.local.yml b/docker-compose.local.yml new file mode 100644 index 000000000..028ba6eee --- /dev/null +++ b/docker-compose.local.yml @@ -0,0 +1,27 @@ +services: + postgres: + image: pgvector/pgvector:pg17 + container_name: honcho-postgres + ports: + - "127.0.0.1:5433:5432" + environment: + - POSTGRES_DB=honcho + - POSTGRES_USER=honcho + - POSTGRES_PASSWORD=honcho + volumes: + - honcho-postgres-data:/var/lib/postgresql/data + restart: unless-stopped + healthcheck: + test: ["CMD-SHELL", "pg_isready -U honcho -d honcho"] + interval: 60s + timeout: 5s + retries: 5 + start_period: 30s + +volumes: + honcho-postgres-data: + driver: local + driver_opts: + type: none + o: bind + device: /Users/headless/docker-volumes/honcho-postgres diff --git a/src/utils/clients.py b/src/utils/clients.py index 1c042bff5..4bedfcb76 100644 --- a/src/utils/clients.py +++ b/src/utils/clients.py @@ -102,7 +102,17 @@ def _is_tool_use_message(msg: dict[str, Any]) -> bool: return True # OpenAI format: tool_calls field on assistant message - return bool(msg.get("tool_calls")) + if msg.get("tool_calls"): + return True + + # Google format: parts list with function_call entries + parts = msg.get("parts") + if isinstance(parts, list): + for part in parts: + if isinstance(part, dict) and "function_call" in part: + return True + + return False def _is_tool_result_message(msg: dict[str, Any]) -> bool: @@ -115,7 +125,17 @@ def _is_tool_result_message(msg: dict[str, Any]) -> bool: return True # OpenAI format: role is "tool" - return msg.get("role") == "tool" + if msg.get("role") == "tool": + return True + + # Google format: parts list with function_response entries + parts = msg.get("parts") + if isinstance(parts, list): + for part in parts: + if isinstance(part, dict) and "function_response" in part: + return True + + return False def _group_into_units(messages: list[dict[str, Any]]) -> list[list[dict[str, Any]]]: