Closed MZRCode closed 6 days ago
I tried it in 2 different ways but it couldn't say my name in these 2 ways.
Try something like "Respond like Shakespeare". System Instructions should be injecting the text correctly as a system
role, but perhaps Gemini isn't processing it correctly.
Try something like "Respond like Shakespeare". System Instructions should be injecting the text correctly as a
system
role, but perhaps Gemini isn't processing it correctly.
Unfortunately, that didn't work either.
Looking at Google AI's Gemini documentation, i see that Message is defined as an Object, but you have Message defined as a String. So is Message defined as an Object or a String?
Document i Reviewed: Send chat prompt requests (Gemini)
Ah, it was an issue with the Chat object. It would be nice if you can specify your environment/what parts of a project you are using next time, or at least provide the code in text as it is much harder to sample pieces of information from screenshots 😅.
As for the types, Gemini AI strives to make interaction with the Gemini API as simple as possible. Though Google requires an entire Message object for System Instructions, the only reasonable thing to put there is text (You may notice even Google AI Studio only allows text in system prompts). Thus, Gemini AI will automatically construct the message object while you only have to provide it as a string.
Anywho, this bug has been fixed in v2.2.1, which should be now available on NPM.
Thank you for your contribution!
As a sidenote, providing your name in System Instructions and then directly asking for it makes Gemini refuse to answer, but if you just say "Hello", Gemini will respond with something along the lines of "Hello [Your Name]", so it does in fact work! It seems like some form of weird security measure is in place.
I want to give the user's name as system to inform AI but it gives me the warning "Please use a valid role: user, model.". So how can i send a prompt as system?