[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:
@@ -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")]
|
||||
|
||||
@@ -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(" "),
|
||||
|
||||
Reference in New Issue
Block a user