https://www.boundaryml.com logo
Hey trying to implement the http timeout
# general
b
Hey trying to implement the http timeout functionality on my gemini clients but seeing
Copy code
Unspecified error code: 400 Request failed with status code: 400 Bad Request, 
{
  "error": {
    "code": 400,
    "message": "Invalid JSON payload received. Unknown name \"http\": Cannot find field.",
    "status": "INVALID_ARGUMENT",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.BadRequest",
        "fieldViolations": [
          {
            "description": "Invalid JSON payload received. Unknown name \"http\": Cannot find field."
          }
        ]
      }
    ]
  }
}


Request options: {"http":{"connect_timeout_ms":500,"time_to_first_token_timeout_ms":500,"idle_timeout_ms":500,"request_timeout_ms":2000},"generation_config":{"temperature":0.0,"seed":42}}
client looks like
Copy code
client<llm> Gemini20FlashLite {
  provider vertex-ai
  options {
    http {
      connect_timeout_ms 500
      time_to_first_token_timeout_ms 500
      idle_timeout_ms 500  
      request_timeout_ms 2000 
    }
    model gemini-2.0-flash-lite-001
    project_id env.PROJECT_ID
    location env.GEMINI_REGION
    generation_config {
      temperature 0.0
      seed 42
    }
  }
}
am I being really dumb?
v
can you check your baml version rq?
b
yup first thing i checked , but i didnt see a newer one live โฏ uv pip show baml-py Name: baml-py Version: 0.211.2
v
can you also check the raw curl?
b
vscode extension also on 0.211.2
Copy code
curl -X POST 'https://us-central1-aiplatform.googleapis.com/v1/projects/{proj}/locations/us-central1/publishers/google/models/gemini-2.0-flash-lite-001:generateContent' -H "authorization: $REDACTED" -H "content-type: application/json" -d "{
  \"generation_config\": {
    \"temperature\": 0.0,
    \"seed\": 42
  },
  \"http\": {
    \"connect_timeout_ms\": 5000,
    \"time_to_first_token_timeout_ms\": 5000,
    \"idle_timeout_ms\": 5000,
    \"request_timeout_ms\": 2000
  },
  \"contents\": [
    {
      \"role\": \"user\",
      \"parts\": [
        {
          \"text\": \"{prompt}\"
        }
      ]
    }
  ]
}"
v
let me check a few things!
i wonder if we missed vertex support here!
hmm, ok, so
google-ai
works:
Copy code
curl -X POST 'https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-lite-001:generateContent' -H "x-goog-api-key: $GOOGLE_API_KEY" -H "content-type: application/json" -d "{
  \"location\": \"us-central1\",
  \"generation_config\": {
    \"temperature\": 0.0,
    \"seed\": 42
  },
  \"contents\": [
    {
      \"role\": \"user\",
      \"parts\": [
        {
          \"text\": \"Extract info from this receipt:\n\nAnswer in JSON using this schema:\n{\n  establishment_name: string,\n  // ISO8601 formatted date\n  date: string,\n  // The total amount of the receipt\n  total: int,\n  currency: string,\n  // The items on the receipt\n  items: [\n    {\n      name: string,\n      price: float,\n      // If not specified, assume 1\n      quantity: int,\n    }\n  ],\n}\"
        }
      ]
    }
  ]
}"
b
the google-ai / vertex mess needs to end
v
yea i agree. i need to check how we can abstract that better or ask google what they actually recommend so we can simplify on our end as well.
b
google recommends nothing lmfao
its so dumb of them
ok well i will let you nooodle, and will implement it soon!
๐Ÿซถ
g
It seems strange to me that our http config (part of the BAML client definition) is getting injected into your raw curl request (as though it were part of the providerโ€™s client definition)
b
yea, maybe a hint, but I also found it odd that i couldnt use the option with a fallback client.. I was thinking i could put it in hte fallback and it would apply to each client in the list
g
Ahh, yes we didnโ€™t communicate this - we havenโ€™t implemented timeouts in fallback clients yet.
b
hey any updates on hte vertex support for this functionality?
checking in here @greg (BAML) if you have any clues!
v
Hey! Sorry about that. Iโ€™m done traveling so you should see an update on this on next release! (One next week!)
I'm investigating this now!
it should be at the bottom of the playground
I've confirmed that on the latest release we do indeed get the right details and don't inject http. We have a minor sync issue where if your local version is more up to date than the VSCode extension, we should show you a warning! https://cdn.discordapp.com/attachments/1431380039378669580/1433559461754048553/Screenshot_2025-10-30_at_1.52.27_PM.png?ex=690521c9&is=6903d049&hm=6e5b88ff144709ac03b62634eb0c4c9e108e5d656a10e310a4098b41e133130f&
for now, the playground is bundled with the LSP hence what likely caused this bug
but as a part of this we've made some improvements: 1. vertex auth (more types of keys allowed + better resiliancy for .json auth) 2. deleting API keys in vscode extension works much better now https://github.com/BoundaryML/baml/pull/2680
b
awesome! so is the solution to update both the pypi baml client and the vscode extension?
v
yep!