Explicit uppercase for tool calls breaks with local LLMs, that expect lowercase values
Environment
- SDK version: 0.1.9
- Python version: 3.10.20
- OS / platform: macOS ARM64 (darwin)
- Install method:
pip install google-antigravity
Description
FunctionDeclaration.from_callable_with_api_option(...) emits JSON Schema with uppercase enum values for type fields ("OBJECT", "STRING", etc.). OpenAI-compatible endpoints require lowercase ("object", "string"). This breaks all custom Python tools when using LocalOpenAIAgentConfig with an OpenAI-compatible local server (Ollama, LM Studio, etc.).
Steps to Reproduce
- Install
google-antigravityvia pip. - Run a local OpenAI-compatible server, e.g. LM Studio at
http://127.0.0.1:1234. - Create a simple custom tool:
def get_temperature(location: str) -> str: return f"The temperature in {location} is 72°F." - Configure the agent:
config = LocalOpenAIAgentConfig( model="google/gemma-4-e2b", base_url="http://127.0.0.1:1234", tools=[get_temperature], ) - Send a prompt that triggers the tool:
"What's the temperature in Mountain View?"
Expected Behavior
The agent calls get_temperature with {"location": "Mountain View"} and returns the result.
Actual Behavior
The local LLM server returns HTTP 400:
{
"error": [
{
"code": "invalid_union_discriminator",
"options": ["object"],
"path": [2, "function", "parameters", "type"],
"message": "Invalid discriminator value. Expected 'object'"
}
]
}
The SDK then surfaces: model output error: model output must contain either output text or tool calls, these cannot both be empty, please try again
Additional Context
- The broken schema originates in
google/antigravity/connections/local/local_connection.py:199-213(callable_to_tool_proto). decl.parameters.model_dump(exclude_none=True)preservesgenai_types.Typeenum values as uppercase strings.- Workaround: wrap tools in
ToolWithSchemawith an explicit lowercase JSON Schema. - Local patch applied in source tree: recursive
_normalize_schema_types()convertsgenai_types.Typevalues to lowercase beforejson.dumps().
Hi I would like to work on this bug , can you assign it to me @chasseuragace
Hi @RounakKumarAgarwal unfortunately we don't take PRs to this repo but super appreciate the energy!
Please let me know how can I contribute engage here? @NTaylorMullen.
Fixed in latest