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

Feature suggestion: create a Tool object from a C# method #23

Open doggy8088 opened 7 months ago

doggy8088 commented 7 months ago

When using function calling feature for Gemini API, the Tool must be used.

Here is a thought of mine. Is it possible just simple pass a C# method or lambda or it's method type to the GenerateContent method's tools argument. Your library might be able to convert the method into a Tool object. That will be extremely useful.

Furthermore, it's possibly call that method directly when the Gemini API response with that method calls.

jochenkirstaetter commented 7 months ago

Hi @doggy8088 That sounds like a great idea. I've seen something like this in one of the other .NET-based SDKs where the developer used one or more Attribute marker to handle function calling. I'll put it in the backlog.

Thanks for the suggestion.