oclaw/tests/test_gemini_sse_transport.py
oliver 420abac9f1 refactor: root-package imports (svc/runtime/interfaces) and fix PYTHONPATH
- Rename platform/ to svc/ to avoid shadowing stdlib platform.
- Replace from oclaw.* with from svc/runtime/interfaces; update -m CLI paths.
- tests/conftest: prepend repo root to sys.path (no parent-folder package name).
- CI: paths and offline_eval script under repo root.
- Ops scripts: PYTHONPATH must be repo root for python -m runtime.* (fixes gateway/WhatsApp sidecar startup).
- Fix default oclaw.json path in tabular/file attachment limits; stabilize attachment test config.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-13 14:51:17 +08:00

30 lines
947 B
Python

from __future__ import annotations
import os
from svc.llm.transports.google_gemini_sse import GoogleGeminiChatModel
def test_gemini_tool_decl_uses_parameters_json_schema() -> None:
m = GoogleGeminiChatModel(model="gemini-3.1-pro", api_key="x", base_url="http://gw")
decls = m._tool_decls_from_openai_tools(
[
{
"type": "function",
"function": {
"name": "query_route",
"description": "d",
"parameters": {"type": "object", "properties": {"destination": {"type": "string"}}},
},
}
]
)
assert decls and "parametersJsonSchema" in decls[0]
assert "parameters" not in decls[0]
def test_gemini_thinking_config_env_off() -> None:
os.environ["AIA_GEMINI_THINKING"] = "off"
cfg = GoogleGeminiChatModel._thinking_config_from_env()
assert cfg == {"includeThoughts": False}