Skip to content

Commit

Permalink
fix: system message
Browse files Browse the repository at this point in the history
  • Loading branch information
dartpain committed Jan 19, 2025
1 parent 4a331db commit a741388
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions application/llm/google_ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ def _raw_gen(
if formatting == "openai":
messages = self._clean_messages_google(messages)
config = types.GenerateContentConfig()
if messages[0].role == "system":
config.system_instruction = messages[0].parts[0].text
messages = messages[1:]

Check warning on line 76 in application/llm/google_ai.py

View check run for this annotation

Codecov / codecov/patch

application/llm/google_ai.py#L70-L76

Added lines #L70 - L76 were not covered by tests

if tools:
cleaned_tools = self._clean_tools_format(tools)
Expand Down Expand Up @@ -101,6 +104,9 @@ def _raw_gen_stream(
if formatting == "openai":
cleaned_messages = self._clean_messages_google(messages)
config = types.GenerateContentConfig()
if messages[0].role == "system":
config.system_instruction = messages[0].parts[0].text
messages = messages[1:]

Check warning on line 109 in application/llm/google_ai.py

View check run for this annotation

Codecov / codecov/patch

application/llm/google_ai.py#L103-L109

Added lines #L103 - L109 were not covered by tests

if tools:
cleaned_tools = self._clean_tools_format(tools)
Expand Down

0 comments on commit a741388

Please sign in to comment.