mirror of
https://github.com/huggingface/text-generation-inference.git
synced 2025-09-11 12:24:53 +00:00
fix: prefer tool call vector over object
This commit is contained in:
parent
0d72af5ab0
commit
7ad4a62458
@ -433,7 +433,7 @@ impl ChatCompletion {
|
||||
created: u64,
|
||||
details: Details,
|
||||
return_logprobs: bool,
|
||||
tool_calls: Option<ToolCall>,
|
||||
tool_calls: Option<Vec<ChatCompletionMessageToolCall>>,
|
||||
) -> Self {
|
||||
Self {
|
||||
id: String::new(),
|
||||
@ -764,7 +764,7 @@ pub(crate) struct ChatTemplateInputs<'a> {
|
||||
}
|
||||
|
||||
#[derive(Clone, Deserialize, Serialize, ToSchema, Default, Debug)]
|
||||
pub(crate) struct ToolCall {
|
||||
pub(crate) struct ChatCompletionMessageToolCall {
|
||||
pub id: u32,
|
||||
pub r#type: String,
|
||||
pub function: FunctionDefinition,
|
||||
@ -781,7 +781,7 @@ pub(crate) struct Message {
|
||||
#[schema(example = "\"David\"")]
|
||||
pub name: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub tool_calls: Option<ToolCall>,
|
||||
pub tool_calls: Option<Vec<ChatCompletionMessageToolCall>>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, ToSchema)]
|
||||
|
@ -14,7 +14,7 @@ use crate::{
|
||||
ChatRequest, CompatGenerateRequest, Completion, CompletionComplete, CompletionCompleteChunk,
|
||||
CompletionRequest, VertexRequest, VertexResponse,
|
||||
};
|
||||
use crate::{FunctionDefinition, FunctionRef, FunctionsMap, Properties, ToolCall, ToolType, Tools};
|
||||
use crate::{FunctionDefinition, FunctionRef, FunctionsMap, Properties, ChatCompletionMessageToolCall, ToolType, Tools};
|
||||
use axum::extract::Extension;
|
||||
use axum::http::{HeaderMap, Method, StatusCode};
|
||||
use axum::response::sse::{Event, KeepAlive, Sse};
|
||||
@ -942,7 +942,7 @@ async fn chat_completions(
|
||||
)
|
||||
})?;
|
||||
|
||||
let tool_call = Some(ToolCall {
|
||||
let tool_calls = vec![ChatCompletionMessageToolCall {
|
||||
id: 0,
|
||||
r#type: "function".to_string(),
|
||||
function: FunctionDefinition {
|
||||
@ -963,8 +963,8 @@ async fn chat_completions(
|
||||
|f| Ok(f.clone()),
|
||||
)?,
|
||||
},
|
||||
});
|
||||
(tool_call, None)
|
||||
}];
|
||||
(Some(tool_calls), None)
|
||||
} else {
|
||||
(None, Some(generation.generated_text))
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user