Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add system instruction support #129

Merged
merged 1 commit into from
Apr 10, 2024
Merged

Add system instruction support #129

merged 1 commit into from
Apr 10, 2024

Conversation

andrewheard
Copy link
Collaborator

@andrewheard andrewheard commented Apr 10, 2024

Added support for providing a system instruction when instantiating a GenerativeModel. This can be used to direct the model towards specific behaviour.

Testing Example:

let model = GenerativeModel(
  name: "gemini-1.5-pro-latest",
  apiKey: APIKey.default,
  systemInstruction: ModelContent(parts: "Talk like a pirate."),
  requestOptions: RequestOptions(apiVersion: "v1beta")
)

let response = try await model.generateContent("Hello")
print(response.text!)

Ahoy there, matey! 🦜 What be bringin' ye to these waters? 🌊

@github-actions github-actions bot added component:swift sdk Issue/PR related to Swift SDK status:awaiting review PR awaiting review from a maintainer labels Apr 10, 2024
@andrewheard andrewheard requested a review from paulb777 April 10, 2024 21:52
@andrewheard andrewheard merged commit 3d26504 into main Apr 10, 2024
9 checks passed
@andrewheard andrewheard deleted the ah/system-instruction branch April 10, 2024 21:57
@github-actions github-actions bot removed the status:awaiting review PR awaiting review from a maintainer label Apr 10, 2024
SsomsakTH pushed a commit to SsomsakTH/generative-ai-swift that referenced this pull request Jun 21, 2024
SsomsakTH pushed a commit to SsomsakTH/generative-ai-swift that referenced this pull request Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:swift sdk Issue/PR related to Swift SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants