dotnet-gemini-sdk
dotnet-gemini-sdk copied to clipboard
Is there any way to use user-defined API_KEY ?
Hi, Users will provide their own keys to call Google Gemini Api.
Is there any way to do that?
Regards,
Hi @anhhtca !
Sorry for late response.
Currently we register the api key in the gemini client add
services.AddGeminiClient(config =>
{
config.ApiKey = "YOUR_GOOGLE_GEMINI_API_KEY";
config.ImageBaseUrl = "CURRENTLY_IMAGE_BASE_URL";
config.TextBaseUrl = "CURRENTLY_IMAGE_BASE_URL";
});
You want to change it after registering the instance?
I am using below as config.TextBaseUrl https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent
and when i try to call TextPrompt method of the client I get below error:
System.Exception: Unexpected error occurred. ---> System.Net.Http.HttpRequestException: { "error": { "code": 400, "message": "* GenerateContentRequest.model: unexpected model name format\n", "status": "INVALID_ARGUMENT" } }
Please help in explaining what I may be doing wrong?
Hi @NitinRawat26 which model you're using? Can you provide the details of request?