google-gemini / generative-ai-swift

The official Swift library for the Google Gemini API
https://ai.google.dev/gemini-api/docs/get-started/tutorial?lang=swift
Apache License 2.0
864 stars 131 forks source link

Allow for a simpler way to set system instructions #149

Closed peterfriese closed 2 months ago

peterfriese commented 2 months ago

This change allows developers to write

model = GenerativeModel(name: "gemini-1.0-pro", apiKey: APIKey.default, systemInstruction: "Talk like a pirate")

instead of

model = GenerativeModel(name: "gemini-1.0-pro", apiKey: APIKey.default, systemInstruction: ModelContent(role: "system", parts: "Talk like a pirate"))
andrewheard commented 2 months ago

Since this isn't a breaking change, I think it would be reasonable to do a quick 0.5.1 patch to make sure our new docs will match the latest release. So I wouldn't forget, I updated the version in #150.