SIGN IN SIGN UP

Simplify prediction API type hinting (#61)

With the addition of GBNF grammar structured response format support,
structured responses are no longer required to contain valid JSON.

Accordingly, type hinting for prediction APIs has been simplified:

* `PredictionResult` is no longer a generic type
* instead, `parsed` is defined as a `str`/`dict` union field
* whether it is a dict or not is now solely determined at runtime
  (based on whether a schema was sent to the server, and the content
  field has been successfully parsed as a JSON response)
* other types that were only generic in the kind of prediction they
  returned are also now no longer generic
* prediction APIs no longer define overloads that attempt to infer
  whether the result will be structured or not (these were already
  inaccurate, as they only considered the `response_format` parameter,
  ignoring the `structured` field in the prediction config)
A
Alyssa Coghlan committed
c81eea047cdd70e26020dbd0be98abc0c866fae3
Parent: 4cfbd6c
Committed by GitHub <noreply@github.com> on 3/21/2025, 3:09:07 PM