File tree 2 files changed +20
-0
lines changed
2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
20
20
- Updated STT and TTS services with language options that match the supported
21
21
languages for each service.
22
22
23
+ ### Fixed
24
+
25
+ - Fixed Google Gemini message handling to properly convert appended messages to Gemini's required format
26
+
23
27
## [ 0.0.49] - 2024-11-17
24
28
25
29
### Added
Original file line number Diff line number Diff line change @@ -332,6 +332,22 @@ def set_messages(self, messages: List):
332
332
self ._messages [:] = messages
333
333
self ._restructure_from_openai_messages ()
334
334
335
+ def add_messages (self , messages : List ):
336
+ # Convert each message individually
337
+ converted_messages = []
338
+ for msg in messages :
339
+ if isinstance (msg , glm .Content ):
340
+ # Already in Gemini format
341
+ converted_messages .append (msg )
342
+ else :
343
+ # Convert from standard format to Gemini format
344
+ converted = self .from_standard_message (msg )
345
+ if converted is not None :
346
+ converted_messages .append (converted )
347
+
348
+ # Add the converted messages to our existing messages
349
+ self ._messages .extend (converted_messages )
350
+
335
351
def get_messages_for_logging (self ):
336
352
msgs = []
337
353
for message in self .messages :
You can’t perform that action at this time.
0 commit comments