@@ -56,9 +56,9 @@ struct GenerativeAIService {
56
56
57
57
// Verify the status code is 200
58
58
guard response. statusCode == 200 else {
59
- Logging . default. error ( " [GoogleGenerativeAI ] The server responded with an error: \( response) " )
59
+ Logging . default. error ( " [FirebaseVertexAI ] The server responded with an error: \( response) " )
60
60
if let responseString = String ( data: data, encoding: . utf8) {
61
- Logging . network. error ( " [GoogleGenerativeAI ] Response payload: \( responseString) " )
61
+ Logging . network. error ( " [FirebaseVertexAI ] Response payload: \( responseString) " )
62
62
}
63
63
64
64
throw parseError ( responseData: data)
@@ -105,13 +105,13 @@ struct GenerativeAIService {
105
105
// Verify the status code is 200
106
106
guard response. statusCode == 200 else {
107
107
Logging . default
108
- . error ( " [GoogleGenerativeAI ] The server responded with an error: \( response) " )
108
+ . error ( " [FirebaseVertexAI ] The server responded with an error: \( response) " )
109
109
var responseBody = " "
110
110
for try await line in stream. lines {
111
111
responseBody += line + " \n "
112
112
}
113
113
114
- Logging . network. error ( " [GoogleGenerativeAI ] Response payload: \( responseBody) " )
114
+ Logging . network. error ( " [FirebaseVertexAI ] Response payload: \( responseBody) " )
115
115
continuation. finish ( throwing: parseError ( responseBody: responseBody) )
116
116
117
117
return
@@ -123,7 +123,7 @@ struct GenerativeAIService {
123
123
let decoder = JSONDecoder ( )
124
124
decoder. keyDecodingStrategy = . convertFromSnakeCase
125
125
for try await line in stream. lines {
126
- Logging . network. debug ( " [GoogleGenerativeAI ] Stream response: \( line) " )
126
+ Logging . network. debug ( " [FirebaseVertexAI ] Stream response: \( line) " )
127
127
128
128
if line. hasPrefix ( " data: " ) {
129
129
// We can assume 5 characters since it's utf-8 encoded, removing `data:`.
@@ -176,7 +176,7 @@ struct GenerativeAIService {
176
176
urlRequest. setValue ( tokenResult. token, forHTTPHeaderField: " X-Firebase-AppCheck " )
177
177
if let error = tokenResult. error {
178
178
Logging . default
179
- . debug ( " [GoogleGenerativeAI ] Failed to fetch AppCheck token. Error: \( error) " )
179
+ . debug ( " [FirebaseVertexAI ] Failed to fetch AppCheck token. Error: \( error) " )
180
180
}
181
181
}
182
182
@@ -200,7 +200,7 @@ struct GenerativeAIService {
200
200
guard let response = urlResponse as? HTTPURLResponse else {
201
201
Logging . default
202
202
. error (
203
- " [GoogleGenerativeAI ] Response wasn't an HTTP response, internal error \( urlResponse) "
203
+ " [FirebaseVertexAI ] Response wasn't an HTTP response, internal error \( urlResponse) "
204
204
)
205
205
throw NSError (
206
206
domain: " com.google.generative-ai " ,
@@ -248,9 +248,9 @@ struct GenerativeAIService {
248
248
return try JSONDecoder ( ) . decode ( type, from: data)
249
249
} catch {
250
250
if let json = String ( data: data, encoding: . utf8) {
251
- Logging . network. error ( " [GoogleGenerativeAI ] JSON response: \( json) " )
251
+ Logging . network. error ( " [FirebaseVertexAI ] JSON response: \( json) " )
252
252
}
253
- Logging . default. error ( " [GoogleGenerativeAI ] Error decoding server JSON: \( error) " )
253
+ Logging . default. error ( " [FirebaseVertexAI ] Error decoding server JSON: \( error) " )
254
254
throw error
255
255
}
256
256
}
@@ -278,7 +278,7 @@ struct GenerativeAIService {
278
278
private func printCURLCommand( from request: URLRequest ) {
279
279
let command = cURLCommand ( from: request)
280
280
Logging . verbose. debug ( """
281
- [GoogleGenerativeAI ] Creating request with the equivalent cURL command:
281
+ [FirebaseVertexAI ] Creating request with the equivalent cURL command:
282
282
----- cURL command -----
283
283
\( command, privacy: . private)
284
284
------------------------
0 commit comments