File tree 2 files changed +12
-3
lines changed
2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ public final class GenerativeModel {
64
64
safetySettings: [ SafetySetting ] ? = nil ,
65
65
tools: [ Tool ] ? = nil ,
66
66
toolConfig: ToolConfig ? = nil ,
67
- systemInstruction: String ,
67
+ systemInstruction: String ... ,
68
68
requestOptions: RequestOptions = RequestOptions ( ) ) {
69
69
self . init (
70
70
name: name,
@@ -73,7 +73,10 @@ public final class GenerativeModel {
73
73
safetySettings: safetySettings,
74
74
tools: tools,
75
75
toolConfig: toolConfig,
76
- systemInstruction: ModelContent ( role: " system " , parts: systemInstruction) ,
76
+ systemInstruction: ModelContent (
77
+ role: " system " ,
78
+ parts: systemInstruction. map { ModelContent . Part. text ( $0) }
79
+ ) ,
77
80
requestOptions: requestOptions,
78
81
urlSession: . shared
79
82
)
Original file line number Diff line number Diff line change @@ -53,7 +53,13 @@ final class GoogleGenerativeAITests: XCTestCase {
53
53
let _ = GenerativeModel (
54
54
name: " gemini-1.5-pro-latest " ,
55
55
apiKey: " API_KEY " ,
56
- systemInstruction: " Talk like a pirate "
56
+ systemInstruction: " Talk like a pirate. "
57
+ )
58
+
59
+ let _ = GenerativeModel (
60
+ name: " gemini-1.5-pro-latest " ,
61
+ apiKey: " API_KEY " ,
62
+ systemInstruction: " Talk like a pirate. " , " Your name is Francis Drake. "
57
63
)
58
64
59
65
// All arguments passed.
You can’t perform that action at this time.
0 commit comments