Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Workaround for system messages that contain a list of dicts#1214

Merged
jhrozek merged 1 commit into
mainstacklok/codegate:mainfrom
anthropic_system_message_formatstacklok/codegate:anthropic_system_message_formatCopy head branch name to clipboard
Mar 5, 2025
Merged

Workaround for system messages that contain a list of dicts#1214
jhrozek merged 1 commit into
mainstacklok/codegate:mainfrom
anthropic_system_message_formatstacklok/codegate:anthropic_system_message_formatCopy head branch name to clipboard

Conversation

@jhrozek

@jhrozek jhrozek commented Mar 4, 2025

Copy link
Copy Markdown
Contributor

In the litellm ChatCompletionMessage that we use a system message is
defined as follows:

class OpenAIChatCompletionSystemMessage(TypedDict, total=False):
    role: Required[Literal["system"]]
    content: Required[Union[str, List]]
    name: str

So content can either be a string or a list. Our secret encryption code only
handled the string case. Since both cases will properly be handled by the
soon-to-be-coming rewrite, let's just add a workaround so that e.g. Cline with
Anthropic keeps working.

With the no-more-litellm branch, everything works as expected.

Fixes: #1207

In the litellm `ChatCompletionMessage` that we use a system message is
defined as follows:
```
class OpenAIChatCompletionSystemMessage(TypedDict, total=False):
    role: Required[Literal["system"]]
    content: Required[Union[str, List]]
    name: str
```

So content can either be a string or a list. Our secret encryption code only
handled the string case. Since both cases will properly be handled by the
soon-to-be-coming rewrite, let's just add a workaround so that e.g. Cline with
Anthropic keeps working.

With the no-more-litellm branch, everything works as expected.

Fixes: #1207
@jhrozek jhrozek merged commit 599d8f6 into main Mar 5, 2025
@jhrozek jhrozek deleted the anthropic_system_message_format branch March 5, 2025 08:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cline with anthropic is broken on main

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.