Check response.status() before building the SSE event stream. On non-success
status, parse the response body as GenerateContentResponseError when
possible (returning Error::VertexError), and fall back to Error::HttpStatus
with the status code and raw text. Adds tests for HTTP 400 Vertex error,
non-JSON HTTP 500 error, and successful 200 SSE streaming.
FunctionDeclaration.parameters becomes Option<Value>, and the new
parameters_json_schema field sends the schema as JSON Schema. Vertex
rejects many JSON Schema keywords in parameters ($schema, $ref/$defs,
const, type arrays) but accepts them in parametersJsonSchema. Both
fields are skipped when None, since Vertex rejects a declaration that
sets both.
Calls a function, returns a solid-color PNG as functionResponse.parts
inlineData, and checks that the model names the color. COLOR picks the
color; otherwise it is picked by time.
Adds an optional parts field to FunctionResponseData, serialized as
functionResponse.parts with inlineData, so function responses can carry
images. It is omitted when empty, so existing requests are unchanged.
- Introducues generate_content_stream that returns a Tokio Steam instead
of a Queue. This allows using the standard stream APIs from
tokio-streams.
- Replace future-utils with tokio-streams, mainly due to better
ergonomics for using the filter_map stream combinator.
- The API doesn't always return `probabilityScore` and
`severityScore` for a safety rating, causing the parsing to fail
- This commit makes those fields optional to fix that.
`generate_content()` was parsing the reqwest result to
`GenerateContentResponseResult` instead of
`GenerateContentResponse`, causing error responses to be handled
incorrectly.
This is fixed by ensuring the result string is parsed
into the correct type.
Pinning specific versions in the library makes it harder for
applications to use newer versions o those dependencies. This is fixed
by setting setting only the major version for libraries that have
reached version 1.0.0 and above and major and minor versions for
dependencies that have not reached version 1.0.0 as those can have their
API surface changed across minor versions.