Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: include image urls when they are provided #3085

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions server/src/operators/message_operator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -764,12 +764,6 @@ pub async fn stream_response(
.filter_map(|image| image.clone())
.collect::<Vec<_>>()
})
.chain(
create_message_req_payload
.image_urls
.clone()
.unwrap_or_default(),
)
.collect();

// replace the last message with the last message with evidence
Expand Down Expand Up @@ -802,7 +796,24 @@ pub async fn stream_response(
})
.collect();

if !images.is_empty() {
if let Some(image_urls) = create_message_req_payload.image_urls.clone() {
open_ai_messages.push(ChatMessage::User {
name: None,
content: ChatMessageContent::ImageUrl(
image_urls
.iter()
.map(|url| ImageUrl {
r#type: "image_url".to_string(),
text: None,
image_url: ImageUrlType {
url: url.to_string(),
detail: None,
},
})
.collect(),
),
});
} else if !images.is_empty() {
if let Some(LLMOptions {
image_config: Some(ref image_config),
..
Expand Down