Closed BartRennes closed 1 month ago
Hello @BartRennes
Yes, there is active development and maintenance of the package. Thanks for reporting the issues, I'm going to have a look into it.
It seems that the referred image URL has been removed by Google AI Studio. I found the image already in a public Google Storage and I'm going to add it to the repository here for easy access.
The examples are found in the tests folder.
As for the request with large files, the file shall be uploaded using the File API to retrieve a temporary URL (valid for 48 hours) which is then passed in as media to the actual request.
Again, let me check the tests and see what has been changed on the Gemini API.
Thank you for your fast answer, i found how to use it, but a documentation should be great ;) Thank you for your work.
Just checked the README to help you with the questions first. The API key is only needed to initially configure the model. Any further communication with Gemini API is through that model instance which has the API key. No need to provide it to each request.
var model = new GenerativeModel(apiKey: apiKey, model: Model.GeminiVisionPro);
var request = new GenerateContentRequest(prompt);
await request.AddMedia("https://github.com/mscraftsman/generative-ai/blob/main/tests/Mscc.GenerativeAI/payload/timetable.png");
var response = await model.GenerateContent(request);
The image timetable.png
used in the example can be found here in the repository below tests/Mscc.GenerativeAI/payload: https://github.com/mscraftsman/generative-ai/blob/main/tests/Mscc.GenerativeAI/payload/timetable.png
Hope this helps.
Cheers, JoKi
Thank you for your fast answer, i found how to use it, but a documentation should be great ;) Thank you for your work.
Wonderful! Please, what did you change to make it work? This would help me to update the README quickly. Or perhaps you fancy to provide me with a PR?
Cheers, JoKi
Hi @BartRennes
Thanks again for flagging this. I updated the image URL in the README and the tests to refer to the correct image instead of an HTTP 404.
Dear,
I'm testing your work and i got a lot of problem out of the box! All examples on main page are not working with outdated functions or simply error. For example: Text-and-image input var model = new GenerativeModel(apiKey: apiKey, model: Model.GeminiVisionPro); await request.AddMedia("https://ai.google.dev/static/docs/images/timetable.png"); -> The property apiKey is no more available. How does AddMedia work? Any documentation or working sample?
Use Gemini 1.5 with large files var response = await model.GenerateContent(request); -> The line generate an error 404: System.Net.Http.HttpRequestException : 'Response status code does not indicate success: 404 (Not Found).'
Is it still updated?
Best Regards