// Either run as a standard text request or a stream generate content request
// let client = Client::new(env::var("API_KEY").unwrap().to_string());
// UNCOMMENT THIS SECTION
let client = Client::new_from_model_reponse_type(
google_generative_ai_rs::v1::gemini::Model::GeminiPro,
env::var("API_KEY").unwrap().to_string(),
google_generative_ai_rs::v1::gemini::ResponseType::StreamGenerateContent,
);
Expected behavior
It should support 'streamGenerateContent' as expected, as per the Vertex AI endpoint and as per cURL
Version (please complete the following information):
Version 0.1.5
Additional context
Using cURL works fine for the Public API endpoint.
curl https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:streamGenerateContent?key=${API_KEY} \
-H 'Content-Type: application/json' \
--no-buffer \
-d '{ "contents":[{"parts":[{"text": "Write long a story about a magic backpack."}]}]}'
Describe the bug The public Gemini API supports streamed API responses. See: Stream Generate Content in API docs.
When using a 'streamGenerateContent' generates a '403' error on Public Gemini API.
To Reproduce In
examples/test_request.rs
Expected behavior It should support 'streamGenerateContent' as expected, as per the Vertex AI endpoint and as per
cURL
Version (please complete the following information):
Additional context Using
cURL
works fine for the Public API endpoint.