Skip to content

Add support for custom JSON payload in ChatCompletionContentPart#704

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

Add support for custom JSON payload in ChatCompletionContentPart#704
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个月了都没人复审呢???

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

2 participants