[router] Harmony Pipeline: Chat Completion & Responses API with MCP Support (#12153)

Co-authored-by: Chang Su <chang.s.su@oracle.com>
This commit is contained in:
Simo Lin
2025-10-29 18:52:56 -07:00
committed by GitHub
co-authored by Chang Su
parent 9ff9fa7f95
commit 03b3e89aea
33 changed files with 5292 additions and 989 deletions
-1
View File
@@ -674,7 +674,6 @@ pub struct ChatMessageDelta {
pub struct ChatStreamChoice {
pub index: u32,
pub delta: ChatMessageDelta,
#[serde(skip_serializing_if = "Option::is_none")]
pub logprobs: Option<ChatLogProbs>,
pub finish_reason: Option<String>,
#[serde(skip_serializing_if = "Option::is_none")]
+16 -1
View File
@@ -21,6 +21,9 @@ use super::common::{
pub struct ResponseTool {
#[serde(rename = "type")]
pub r#type: ResponseToolType,
// Function tool fields (used when type == "function")
#[serde(skip_serializing_if = "Option::is_none")]
pub function: Option<crate::protocols::common::Function>,
// MCP-specific fields (used when type == "mcp")
#[serde(skip_serializing_if = "Option::is_none")]
pub server_url: Option<String>,
@@ -40,6 +43,7 @@ impl Default for ResponseTool {
fn default() -> Self {
Self {
r#type: ResponseToolType::WebSearchPreview,
function: None,
server_url: None,
authorization: None,
server_label: None,
@@ -53,6 +57,7 @@ impl Default for ResponseTool {
#[derive(Debug, Clone, Deserialize, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum ResponseToolType {
Function,
WebSearchPreview,
CodeInterpreter,
Mcp,
@@ -134,6 +139,13 @@ pub enum ResponseInputOutputItem {
#[serde(skip_serializing_if = "Option::is_none")]
status: Option<String>,
},
#[serde(rename = "function_call_output")]
FunctionCallOutput {
call_id: String,
output: String,
#[serde(skip_serializing_if = "Option::is_none")]
status: Option<String>,
},
#[serde(untagged)]
SimpleInputMessage {
content: StringOrContentParts,
@@ -499,7 +511,7 @@ pub struct ResponsesRequest {
pub store: Option<bool>,
/// Whether to stream the response
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub stream: Option<bool>,
/// Temperature for sampling
@@ -678,6 +690,9 @@ impl GenerationRequest for ResponsesRequest {
ResponseInputOutputItem::FunctionToolCall { arguments, .. } => {
Some(arguments.clone())
}
ResponseInputOutputItem::FunctionCallOutput { output, .. } => {
Some(output.clone())
}
})
.collect::<Vec<String>>()
.join(" "),