Skip to content

Add support for custom JSON payload in ChatCompletionContentPart - #704

Closed
FanYaning wants to merge 5 commits into
openai:mainfrom
FanYaning:main
Closed

FanYaning wants to merge 5 commits into
openai:mainfrom
FanYaning:main

Conversation

@FanYaning

Copy link
Copy Markdown
Contributor

Fix: #700

        ChatCompletionContentPart textPart = ChatCompletionContentPart.ofText(ChatCompletionContentPartText.builder()
                .text(promptMessage)
                .build());

        String type = visionMessage.startsWith("data:image/") ? "image_url" : "video_url";
        Map<String, JsonValue> part = Map.of(
                "type", JsonValue.from(type),
                type, JsonValue.from(Map.of("url", visionMessage)));

        ChatCompletionContentPart visionPart = ChatCompletionContentPart.ofJson(JsonValue.from(part));

        ChatCompletionCreateParams createParams = ChatCompletionCreateParams.builder()
                .addUserMessageOfArrayOfContentParts(List.of(visionPart, textPart))
                .model(config.getModelV())
                .temperature(config.getTemperatureV())
                .putAllAdditionalBodyProperties(customProps)
                .build();

@FanYaning
FanYaning requested a review from a team as a code owner March 17, 2026 03:08
@Guokeeng

Copy link
Copy Markdown

我也遇到这个问题了,很需要这个提交,怎么4个月了都没人复审呢???

@dpiet-oai

Copy link
Copy Markdown
Contributor

Thanks for the contribution. The request in #700 is already supported through ChatCompletionUserMessageParam.builder().content(JsonValue.from(parts)).build(). We verified that serialization preserves the custom video_url object and adjacent text part. We're closing this PR because no new factory is needed for that use case. This verification covers request serialization only, not the provider's video processing.

@dpiet-oai dpiet-oai closed this Sep 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

how to upload Video Input with openai-java

3 participants