https://www.boundaryml.com logo
🟡 Expected behavior for reaching max tokens limit
# questions
a
What is the expected behavior for hitting max output tokens? BAML just returns this error
Copy code
Stream ended prematurely without completion marker (likely timeout)
but the stream iterator does not seem to finish gracefully. looking at the specific HTTP response on the dashboard i see the last stream delta was:
Copy code
{
  "type": "message_delta",
  "delta": {
    "stop_reason": "max_tokens",
    "stop_sequence": null
  },
  "usage": {
    "input_tokens": 3,
    "cache_creation_input_tokens": 120,
    "cache_read_input_tokens": 68184,
    "output_tokens": 8192
  }
}
b
Hmm, that’s interesting… that delta format is surprising to me. This seems like an edge case we missed. We’ll look into this soon, thanks for flagging!
a
What version of baml are you on? We did patch something like this
a
We are on 0.214.0 currently
a
a
Ok thanks ill try upgrading. What is the expected behavior in this case?
a
no timeout, but there should be a FinishReasonError. I will take a look at what we do here
a
yeah curious if the iterator is intended to return cleanly in this case or throw
a
but as i mentioned i think we need to check our integ tests
a
cool ok
2 Views