change ToolCall id to string

This commit is contained in:
Bao Phan 2024-05-14 13:18:28 +07:00
parent b789b0b67c
commit 6436f83a95
2 changed files with 5 additions and 4 deletions

View File

@ -882,7 +882,7 @@ pub(crate) struct ChatTemplateInputs<'a> {
#[derive(Clone, Deserialize, Serialize, ToSchema, Default, Debug)]
pub(crate) struct ToolCall {
pub id: u32,
pub id: String,
pub r#type: String,
pub function: FunctionDefinition,
}
@ -955,13 +955,15 @@ pub(crate) struct Message {
pub role: String,
#[serde(skip_serializing_if = "Option::is_none")]
#[schema(example = "My name is David and I")]
#[serde(deserialize_with = "message_content_serde::deserialize")]
#[serde(default, deserialize_with = "message_content_serde::deserialize")]
pub content: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[schema(example = "\"David\"")]
pub name: Option<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub tool_calls: Option<Vec<ToolCall>>,
#[serde(default, skip_serializing_if = "Option::is_none")]
#[schema(example = "\"get_weather\"")]
pub tool_call_id: Option<String>,
}

View File

@ -988,7 +988,6 @@ async fn chat_completions(
) -> Result<Response, (StatusCode, Json<ErrorResponse>)> {
let span = tracing::Span::current();
metrics::increment_counter!("tgi_request_count");
let ChatRequest {
logprobs,
max_tokens,
@ -1160,7 +1159,7 @@ async fn chat_completions(
)
})?;
let tool_calls = vec![ToolCall {
id: 0,
id: "0".to_string(),
r#type: "function".to_string(),
function: FunctionDefinition {
description: None,