File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
FirebaseVertexAI/Sample/FunctionCallingSample/ViewModels Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ class FunctionCallingViewModel: ObservableObject {
116
116
for functionResponse in functionResponses {
117
117
messages. insert ( functionResponse. chatMessage ( ) , at: messages. count - 1 )
118
118
}
119
- responseStream = try chat. sendMessageStream ( functionResponses. modelContent ( ) )
119
+ responseStream = try chat. sendMessageStream ( [ functionResponses. modelContent ( ) ] )
120
120
}
121
121
for try await chunk in responseStream {
122
122
processResponseContent ( content: chunk)
@@ -132,7 +132,7 @@ class FunctionCallingViewModel: ObservableObject {
132
132
for functionResponse in functionResponses {
133
133
messages. insert ( functionResponse. chatMessage ( ) , at: messages. count - 1 )
134
134
}
135
- response = try await chat. sendMessage ( functionResponses. modelContent ( ) )
135
+ response = try await chat. sendMessage ( [ functionResponses. modelContent ( ) ] )
136
136
}
137
137
processResponseContent ( content: response)
138
138
}
@@ -249,7 +249,7 @@ private extension FunctionResponsePart {
249
249
}
250
250
251
251
private extension [ FunctionResponsePart ] {
252
- func modelContent( ) -> [ ModelContent ] {
253
- return self . map { ModelContent ( role: " function " , parts: [ $0 ] ) }
252
+ func modelContent( ) -> ModelContent {
253
+ return ModelContent ( role: " function " , parts: self )
254
254
}
255
255
}
You can’t perform that action at this time.
0 commit comments