From 0cc8676ad8322c895d93bd5e756017d5bdcb4781 Mon Sep 17 00:00:00 2001 From: Sherlock Holo Date: Fri, 7 Mar 2025 17:34:19 +0800 Subject: [PATCH] fix chat completion image when marshal the detail field to '"detail": null', it will break vllm openai api server --- async-openai/src/types/chat.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/async-openai/src/types/chat.rs b/async-openai/src/types/chat.rs index b60011d0..12dcde63 100644 --- a/async-openai/src/types/chat.rs +++ b/async-openai/src/types/chat.rs @@ -195,6 +195,7 @@ pub struct ImageUrl { /// Either a URL of the image or the base64 encoded image data. pub url: String, /// Specifies the detail level of the image. Learn more in the [Vision guide](https://platform.openai.com/docs/guides/vision/low-or-high-fidelity-image-understanding). + #[serde(skip_serializing_if = "Option::is_none")] pub detail: Option, }