8000 llama_cpp server: fix to ChatCompletionRequestMessage · abetlen/llama-cpp-python@1c7cc8c · GitHub
[go: up one dir, main page]

Skip to content

Commit 1c7cc8c

Browse files
committed
llama_cpp server: fix to ChatCompletionRequestMessage
When I generate a client, it breaks because it fails to process the schema of ChatCompletionRequestMessage These fix that: - I think `Union[Literal["user"], Literal["channel"], ...]` is the same as Literal["user", "channel", ...] - Turns out default value `Literal["user"]` isn't JSON serializable, so replace with "user"
1 parent 114c9f3 commit 1c7cc8c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llama_cpp/server/app.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@ def create_embedding(
215215

216216

217217
class ChatCompletionRequestMessage(BaseModel):
218-
role: Union[Literal["system"], Literal["user"], Literal["assistant"]] = Field(
219-
default=Literal["user"], description="The role of the message."
218+
role: Literal["system", "user", "assistant"] = Field(
219+
default="user", description="The role of the message."
220220
)
221221
content: str = Field(default="", description="The content of the message.")
222222

0 commit comments

Comments
 (0)
0