mscraftsman / generative-ai

Gemini AI SDK for .NET and ASP.NET Core enables developers to use Google's state-of-the-art generative AI models to build AI-powered features and applications.
https://mscraftsman.github.io/generative-ai/
Apache License 2.0
55 stars 11 forks source link

#33 - Expose 'State' on FileResource #39

Closed rsmithsa closed 1 month ago

rsmithsa commented 1 month ago

Added the 'State' property to the file resource: [(https://ai.google.dev/api/files#File)] #33

jochenkirstaetter commented 1 month ago

Hi @rsmithsa

Thanks for the addition. However, state is declared as an enumeration and shall be used like that. Unfortunately, there is already an enumeration State related to the status/progress of a tuned model.

The PR should take this into consideration. Thanks.

Cheers, JoKi

jochenkirstaetter commented 1 month ago

OK, it seems that Google has changed the response of tuned model not using state anymore but done. See here: https://ai.google.dev/api/tuning#response-body

jochenkirstaetter commented 1 month ago

Hi @rsmithsa I'm going through the $discovery response and update all types accordingly. It seems there have been quite some additional changes to the API. I'll fix this completely during the weekend with a new minor release coming out as a result.

rsmithsa commented 1 month ago

Apologies, I didn't see you using enums elsewhere. The file response does still use an enum File & State.

This is a slightly different enum to the tuned model - so I added a new 'FileState' enum for this.

It might be worth refactoring the current 'State' enum to something like 'ModelState' but this would be a breaking change.

jochenkirstaetter commented 1 month ago

Hi @rsmithsa Yes, exactly. The $discovery of the API has a few more changes. There's also a new Chunk type which has another State enumeration. I'm working through all this and next release shall have it.

Thanks for the initial pointer and bear a little with me.

Cheers, JoKi

jochenkirstaetter commented 1 month ago

Hi @rsmithsa

I integrated your suggestions into release 1.6.5 See here: https://github.com/mscraftsman/generative-ai/releases/tag/v1.6.5