Skip to content

Commit

Permalink
Make system instruction accept variadic String...
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewheard committed Apr 30, 2024
1 parent dc00663 commit 3cd85e4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Sources/GoogleAI/GenerativeModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public final class GenerativeModel {
safetySettings: [SafetySetting]? = nil,
tools: [Tool]? = nil,
toolConfig: ToolConfig? = nil,
systemInstruction: String,
systemInstruction: String...,
requestOptions: RequestOptions = RequestOptions()) {
self.init(
name: name,
Expand All @@ -73,7 +73,10 @@ public final class GenerativeModel {
safetySettings: safetySettings,
tools: tools,
toolConfig: toolConfig,
systemInstruction: ModelContent(role: "system", parts: systemInstruction),
systemInstruction: ModelContent(
role: "system",
parts: systemInstruction.map { ModelContent.Part.text($0) }
),
requestOptions: requestOptions,
urlSession: .shared
)
Expand Down

0 comments on commit 3cd85e4

Please sign in to comment.