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 in Vertex AI #12749

Merged
merged 1 commit into from
Apr 11, 2024

Conversation

andrewheard
Copy link
Contributor

Added support for providing a system instruction when instantiating a GenerativeModel in Vertex AI. This can be used to direct the model towards specific behaviour. This is a port of google-gemini/generative-ai-swift#129.

Testing Example:

let model = VertexAI.vertexAI().generativeModel(
  modelName: "gemini-1.5-pro-preview-0409",
  systemInstruction: ModelContent(parts: "Talk like a pirate.")
)

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

Ahoy there, matey! 👋 What brings ye to these waters? 🦜 Is there loot to be plundered or a hearty tale to be told? 💰 Speak yer mind, me hearty! 🗣️

#no-changelog

@andrewheard andrewheard requested a review from paulb777 April 11, 2024 01:10
@andrewheard andrewheard merged commit c7784f5 into vertex-ai Apr 11, 2024
42 checks passed
@andrewheard andrewheard deleted the ah/vertex-sys-instruction branch April 11, 2024 13:52
@firebase firebase locked and limited conversation to collaborators May 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants