@@ -869,20 +869,6 @@ pub async fn get_suggested_queries(
869869 Ok ( HttpResponse :: Ok ( ) . json ( SuggestedQueriesResponse { queries } ) )
870870}
871871
872- #[ derive( Deserialize , Serialize , Debug , ToSchema , Clone ) ]
873- /// Enum allowing for a single URL or a list of URLs
874- #[ schema( example = "https://example.com/jacket.jpg" ) ]
875- pub enum StringOrVec {
876- /// A single URL of an image
877- #[ serde( rename = "string" ) ]
878- #[ schema( title = "string" ) ]
879- String ( String ) ,
880- /// A list of URLs of images
881- #[ serde( rename = "string[]" ) ]
882- #[ schema( title = "string[]" ) ]
883- Vec ( Vec < String > ) ,
884- }
885-
886872#[ derive( Deserialize , Serialize , Debug , ToSchema ) ]
887873/// Type of a given parameter for a LLM tool call
888874pub enum ToolFunctionParameterType {
@@ -961,7 +947,10 @@ pub struct GetToolFunctionParamsReqPayload {
961947 /// Text of the user's message to the assistant which will be used to generate the parameters for the tool function.
962948 pub user_message_text : Option < String > ,
963949 /// Image URL to attach to the message to generate the parameters for the tool function.
964- pub image_url : Option < StringOrVec > ,
950+ #[ deprecated( note = "Use image_urls instead" ) ]
951+ pub image_url : Option < String > ,
952+ /// Image URLs to attach to the message to generate the parameters for the tool function.
953+ pub image_urls : Option < Vec < String > > ,
965954 /// The base64 encoded audio input of the user message to attach to the topic and then generate an assistant message in response to.
966955 pub audio_input : Option < String > ,
967956 /// Function to get the parameters for.
@@ -1052,34 +1041,30 @@ pub async fn get_tool_function_params(
10521041 r#type: "text" . to_string( ) ,
10531042 text: message_content. clone( ) ,
10541043 } ) ] ;
1055- if let Some ( image_url_or_uls) = data. image_url . clone ( ) {
1056- match image_url_or_uls {
1057- StringOrVec :: String ( image_url) => {
1058- message_content_parts. insert (
1059- 0 ,
1060- ChatMessageContentPart :: Image ( ChatMessageImageContentPart {
1061- r#type : "image_url" . to_string ( ) ,
1062- image_url : ImageUrlType {
1063- url : image_url,
1064- detail : None ,
1065- } ,
1066- } ) ,
1067- ) ;
1068- }
1069- StringOrVec :: Vec ( image_urls) => {
1070- for image_url in image_urls. iter ( ) {
1071- message_content_parts. insert (
1072- 0 ,
1073- ChatMessageContentPart :: Image ( ChatMessageImageContentPart {
1074- r#type : "image_url" . to_string ( ) ,
1075- image_url : ImageUrlType {
1076- url : image_url. clone ( ) ,
1077- detail : None ,
1078- } ,
1079- } ) ,
1080- ) ;
1081- }
1082- }
1044+ if let Some ( image_url) = data. image_url . clone ( ) {
1045+ message_content_parts. insert (
1046+ 0 ,
1047+ ChatMessageContentPart :: Image ( ChatMessageImageContentPart {
1048+ r#type : "image_url" . to_string ( ) ,
1049+ image_url : ImageUrlType {
1050+ url : image_url,
1051+ detail : None ,
1052+ } ,
1053+ } ) ,
1054+ ) ;
1055+ }
1056+ if let Some ( image_urls) = data. image_urls . clone ( ) {
1057+ for image_url in image_urls. iter ( ) {
1058+ message_content_parts. insert (
1059+ 0 ,
1060+ ChatMessageContentPart :: Image ( ChatMessageImageContentPart {
1061+ r#type : "image_url" . to_string ( ) ,
1062+ image_url : ImageUrlType {
1063+ url : image_url. clone ( ) ,
1064+ detail : None ,
1065+ } ,
1066+ } ) ,
1067+ ) ;
10831068 }
10841069 }
10851070
0 commit comments