Commit Graph

13 Commits

Author SHA1 Message Date
a49d37f03d refactor: address review feedback on retry_delay (#19)
All checks were successful
Rust / check (pull_request) Successful in 2m42s
- Drop the unreachable checked_mul in parse_duration; a fraction of at
  most 9 digits scaled to nanoseconds always fits in a u32.
- Share a vertex_error test helper in error.rs instead of building
  VertexApiError inline.
- Bump version to 0.2.0 for the breaking VertexApiError.details change.
2026-10-28 08:44:53 +00:00
cecc14d31e feat: expose Gemini RetryInfo retry_delay() on VertexApiError and Error (#19)
All checks were successful
Rust / check (pull_request) Successful in 2m40s
VertexApiError.details is now Option<Vec<serde_json::Value>> so that
unknown google.rpc.* detail types (e.g. RetryInfo, QuotaFailure) no
longer break deserialization and fall back to Error::HttpStatus. The
unused ErrorType, ErrorInfoMetadata, FieldViolation and Link types are
removed.

Add VertexApiError::retry_delay() which parses the protobuf duration in a
google.rpc.RetryInfo entry, and Error::retry_delay() which delegates to it.

Closes #19
2026-10-28 08:38:02 +00:00
8d1c9c3bb6 feat: check response status in all GeminiClient methods and add Error::is_retryable() (#10)
Some checks failed
Rust / build (pull_request) Failing after 3s
2026-10-26 19:24:49 +00:00
ba9870277c fix: return error on non-2xx response in stream_generate_content (#3)
Some checks failed
Rust / build (pull_request) Has been cancelled
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.
2026-10-18 22:47:23 +01:00
494aab6d14 feat: add SSE streaming, thinking models, and modernized Part struct
Some checks failed
Rust / build (push) Has been cancelled
2026-09-20 16:42:55 +01:00
d1678bdc37 Define specific error for event stream ended 2025-04-06 08:12:58 +01:00
51d6a27017 Adds streaming generation that returns a streaming
- 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.
2025-04-05 19:18:33 +01:00
ec98297a8a Run cargo clippy --fix 2024-05-01 17:16:04 +01:00
a640d97efb Makes generate content error result into Error 2024-05-01 17:14:32 +01:00
93285e53dd Updates client to use the generateContent endpoint when not streaming 2024-02-23 14:42:51 +00:00
8c42901ddf Deserialization and error handling improvements 2024-02-07 07:43:11 +00:00
450fe84d8b Improves error handling 2024-02-06 21:23:04 +00:00
67c6ba878b Add base code and examples for the Vertex API
- Add base code for the Vertex API with types and a client with helper
  methods for prompting text and conversation.
- Add examples for prompting text and conversation.
2024-02-06 20:50:36 +00:00