https://www.boundaryml.com logo
since upgrading to 217 I am getting this
# general
a
since upgrading to 217 I am getting this error a lot in longer running functions : rror: BamlValidationError(message=LLM Failure: reqwest::Error { kind: Request, url: "xxxxxublishers/google/models/gemini-3-flash-preview:generateContent", source: hyper_util::client::legacy::Error(SendRequest, hyper::Error(Io, Custom { kind: BrokenPipe, error: "stream closed because of a broken pipe" })) } (Unspecified error code: 2) - reqwest::Error { kind: Request, url: "xxxxgemini-3-flash-preview:generateContent", source: hyper_util::client::legacy::Error(SendRequest, hyper::Error(Io, Custom { kind: BrokenPipe, error: "stream closed because of a broken pipe" })) }, raw_output=, prompt=user: Review the list of invoices against the provided document text.. any tricss tips for this ?
a
What were you using before? 0.215?
a
214
a
Are you streaming them?
a
no streaming
a
Do you have a small repro whereit happens often?
a
sorry I am using the async function await in python
let me give you snapshot of code block
Copy code
return await b.ReconcileInvoices(
default_client_mode : sync
is this the issue
a
You have to import the async client if you want the async one
If usng the sync client then dont use await
a
i am already doing that actually from lib.baml_client.baml_client.async_client import b
a
If you do have the full baml file and python file that repros it i can take a look
a
this is private work code I can't share
I can give you my client settings
client CustomGemini3 { provider vertex-ai options { model gemini-3-pro-preview location global project_id env.PROJECT_ID } }
Copy code
retry_policy Exponential {
  max_retries 2
  strategy {
    type exponential_backoff
    delay_ms 300
    multiplier 1.5
    max_delay_ms 10000
  }
}
a
How often does it happen? 100% of the time?
a
50% of the time now
it never happend in 214
i might just rollback for now
a
And downgrading fixes it? Foes the output type contain any unions?
Let me know if you do fix it by rolling back again. We definitely want to fix issues like this. Though it is a bit weird since the error seems network related
a
out put no union at all
v
When using version 0.217, I also encountered this issue once before, with the same error message. However, I always thought it was a network problem, and it hasn't occurred a second time so far.
I also used the Gemini 3 Flash Preview model.
reqwest::Error { kind: Request, url: "https://generativelanguage.googleapis.com/v1beta/models/gemini-3-flash-preview:generateContent", source: hyper_util::client::legacy::Error(SendRequest, hyper::Error(Io, Custom { kind: BrokenPipe, error: "stream closed because of a broken pipe" })) }
a
actually the version I was on that was stable was 210
I am rolling back to 210 as it was the most consistant no time outs at all
a
Ill see if i can repro this friday
Also if you keep getting timeouts even on 210, it is probably not baml
Let us know how it goes today
a
now with version 210 the complex workflow is workging as before
i feel like the timeout issue in the new versions might of have been introduced as a default as the docs stated default timeout is infinite.
a
How long do your requests to gemini last?
And where do you deploy?
a
between 10 and 25 min
again it is a very complex use case
most of the use cases less than 5 min but for the extreme use case that is the range
i deploy on gcp cloud job
but regardless even running locally new versino produced same timeouts
i am fine now with 210 just wanted to give you idea of where i started experiencing issues
a
ok I think i know what the issue is. We introduced timeouts, and the defaults are set to 5min timeout. If every request of yours takes that long it will always timeout. And the other issue is we should give you a 'TimeoutError' but we do not. If you do have time to try 0.218.0 at some point, with this configuration, lmk how it goes! It sets the request timeout to basically 30min
Copy code
client<llm> MyClient {
  provider openai
  options {
    model "gpt-4"
    api_key env.OPENAI_API_KEY
    http {
      connect_timeout_ms 5000      // 5 seconds to connect
      request_timeout_ms 1800000     // 30 mins total
    }
  }
}
so some action items from us is to verify that we get the same type of error for timeouts using Gemini
a
it would be great if the baml docs was updated with this new bahaivor as it still says none
a
Ah yes we can add our defaults there or perhaps we will just increase our default to 30min
You are definitely in the top .1% of output tokens generated from gemini with 30min request latency
g
I've been trying to reproduce this, @arafat . Thanks for your help so far! I'm on 0.218.0 and using the python bindings with the same gemini model as you. What I've found so far: - Manually setting a connection timeout of 10 seconds in the BAML client config results in a timeout error (Request timed out) - Cutting my wifi mid-request after 10 seconds results in a timeout error about 30 seconds after the cut (Request timed out) - Running long queries works, when the response takes less than about 3 minutes - I have trouble making a query that takes longer than 2 minutes. When I ask for long lists of things, the model stops itself and asks me to make a followup request for more items. Your pasted client definition uses gemini-3-pro-preview, which is a different model than flash I think. Your error message mentions flash. So I'll rerun my tests with that model too. Ok - same results when using gemini-3-flash-preview. I have not managed to reproduce your issue. Do you have any tips for keeping the model talking for > 3 minutes?
a
I am passing the model a list of parsed invoices to deduplicate based on the grand total of all the invoices. the list contians 300 invoices with each invoice class model has about 8 fields. this request is what takes the longest. Very nieche use case to be honest with you, I will try to use 218 with the increased timeouts.
g
Very helpful context! That is probably why the model doesn't intentionally stop for you and ask you to resume with a fresh page - you can't do that for deduplication. I will pick this debugging task back up with a similar query!
i
Got the same error but my use case takes around 10seconds, and we suddenly got 4min. Looking on Gemini Studio I saw we hit the Rate Limit, but instead of getting Rate limit error, and continuing to the fallback strategy (other model & provider), it waited for the whole timeout. (Same version 217)
btw is ⁨`time_to_first_token_timeout_ms`⁩ is it for thinking tokens also? or only output?
g
^ any token returned by the llm provider in the main content field. Most providers put thinking tokens into a separate field, so those would not count toward the first-token timeout, but for models that put thinking token in the main response (like DeepSeek R1 with its
<thought>
block), thinking tokens would count toward first-token timeout.
@IdanR Thanks for the report, that's useful context, about the rate limit error.
2 Views