Skip to content

Commit b750378

Browse files
committed
feat(ts-sdk): release v0.0.97
1 parent 7bfb9c4 commit b750378

File tree

5 files changed

+43
-45
lines changed

5 files changed

+43
-45
lines changed

clients/ts-sdk/openapi.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13640,6 +13640,15 @@
1364013640
"image_url": {
1364113641
"type": "string",
1364213642
"description": "Image URL to attach to the message to generate the parameters for the tool function.",
13643+
"deprecated": true,
13644+
"nullable": true
13645+
},
13646+
"image_urls": {
13647+
"type": "array",
13648+
"items": {
13649+
"type": "string"
13650+
},
13651+
"description": "Image URLs to attach to the message to generate the parameters for the tool function.",
1364313652
"nullable": true
1364413653
},
1364513654
"model": {

clients/ts-sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"files": [
1818
"dist"
1919
],
20-
"version": "0.0.96",
20+
"version": "0.0.97",
2121
"license": "MIT",
2222
"scripts": {
2323
"lint": "eslint 'src/**/*.ts'",

clients/ts-sdk/src/types.gen.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2233,8 +2233,13 @@ export type GetToolFunctionParamsReqPayload = {
22332233
audio_input?: (string) | null;
22342234
/**
22352235
* Image URL to attach to the message to generate the parameters for the tool function.
2236+
* @deprecated
22362237
*/
22372238
image_url?: (string) | null;
2239+
/**
2240+
* Image URLs to attach to the message to generate the parameters for the tool function.
2241+
*/
2242+
image_urls?: Array<(string)> | null;
22382243
/**
22392244
* Model name to use for the completion. If not specified, this defaults to the dataset's model.
22402245
*/

server/src/handlers/message_handler.rs

Lines changed: 28 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -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
888874
pub 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

server/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,6 @@ impl Modify for SecurityAddon {
299299
handlers::message_handler::EditMessageReqPayload,
300300
handlers::message_handler::SuggestedQueriesReqPayload,
301301
handlers::message_handler::SuggestedQueriesResponse,
302-
handlers::message_handler::StringOrVec,
303302
handlers::message_handler::ToolFunctionParameterType,
304303
handlers::message_handler::ToolFunctionParameter,
305304
handlers::message_handler::ToolFunction,

0 commit comments

Comments
 (0)