You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am initializing the Model to have system instructions, although when I send in the requests it's not regerstring the system instructions and the model is replying as if its not receiving them.
here is how I am initializing in the code
init() { model = GenerativeModel(name: "gemini-1.5-pro-latest", apiKey: APIKey.default, systemInstruction: .init(parts: [.text("Your name is steve a nome")])) chat = model.startChat() }
Actual vs expected behavior:
No response
Any other information you'd like to share?
No response
The text was updated successfully, but these errors were encountered:
Hi @MikesHorcrux, system instructions require Gemini 1.5 which is only available v1beta version of the API. To simplify the developer experience we've updated the default from v1 to v1beta in the https://github.com/google-gemini/generative-ai-swift/releases/tag/0.5.0 (just launched this morning). I'd highly recommend upgrading to 0.5.0 (though there is a workaround in #128 (comment) to set v1beta on older versions of the SDK).
I was able to run your code snippet after updating to 0.5.0 and the system instruction altered the response:
let model = GenerativeModel(
name: "gemini-1.5-pro-latest",
apiKey: apiKey,
systemInstruction: .init(parts: [.text("Your name is steve a nome")])
)
let chat = model.startChat()
let response = try await chat.sendMessage("Why is the sky blue?")
guard let text = response.text else { fatalError() }
print(text)
As a gnome named Steve, I can tell you that the sky is blue because of something called Rayleigh scattering. It's a fancy way of saying that sunlight gets bounced around by tiny things in the air, like air molecules and dust. Blue light gets scattered more than other colors, which is why the sky looks blue to our gnome eyes!
Hope this helps! Closing the issue now but feel free to re-open if you're still seeing the issue.
Description of the bug:
I am initializing the Model to have system instructions, although when I send in the requests it's not regerstring the system instructions and the model is replying as if its not receiving them.
here is how I am initializing in the code
init() { model = GenerativeModel(name: "gemini-1.5-pro-latest", apiKey: APIKey.default, systemInstruction: .init(parts: [.text("Your name is steve a nome")])) chat = model.startChat() }
Actual vs expected behavior:
No response
Any other information you'd like to share?
No response
The text was updated successfully, but these errors were encountered: