@@ -15,8 +15,6 @@ class GoogleProvider(ProviderInterface):
15
15
"""Implements the ProviderInterface for interacting with Google's Vertex AI."""
16
16
17
17
def __init__ (self , ** config ):
18
- """Set up the Google AI client with a project ID."""
19
-
20
18
"""Set up the Google AI client with a project ID."""
21
19
self .project_id = config .get ("project_id" ) or os .getenv ("GOOGLE_PROJECT_ID" )
22
20
self .location = config .get ("region" ) or os .getenv ("GOOGLE_REGION" )
@@ -72,7 +70,7 @@ def chat_completions_create(self, model, messages, **kwargs):
72
70
response = chat .send_message (last_message )
73
71
74
72
# Convert the response to the format expected by the OpenAI API
75
- return self .convert_response_to_openai_format (response )
73
+ return self .normalize_response (response )
76
74
77
75
def convert_openai_to_vertex_ai (self , messages ):
78
76
"""Convert OpenAI messages to Google AI messages."""
@@ -98,8 +96,8 @@ def transform_roles(self, messages):
98
96
message ["role" ] = role
99
97
return messages
100
98
101
- def convert_response_to_openai_format (self , response ):
102
- """Convert Google AI response to OpenAI's ChatCompletionResponse format."""
99
+ def normalize_response (self , response ):
100
+ """Normalize the response from Google AI to match OpenAI's response format."""
103
101
openai_response = ChatCompletionResponse ()
104
102
openai_response .choices [0 ].message .content = (
105
103
response .candidates [0 ].content .parts [0 ].text
0 commit comments