diff --git a/api/src/utils/clients/ai/litellm/types.rs b/api/src/utils/clients/ai/litellm/types.rs index d444a231e..b9f72e802 100644 --- a/api/src/utils/clients/ai/litellm/types.rs +++ b/api/src/utils/clients/ai/litellm/types.rs @@ -191,6 +191,7 @@ impl Message { pub struct ResponseFormat { #[serde(rename = "type")] pub type_: String, + #[serde(skip_serializing_if = "Option::is_none")] pub json_schema: Option, } diff --git a/api/src/utils/tools/file_tools/search_data_catalog.rs b/api/src/utils/tools/file_tools/search_data_catalog.rs index 2519c3196..531575d7a 100644 --- a/api/src/utils/tools/file_tools/search_data_catalog.rs +++ b/api/src/utils/tools/file_tools/search_data_catalog.rs @@ -99,7 +99,7 @@ impl SearchDataCatalogTool { content: prompt, name: None, }], - temperature: Some(0.0), + stream: Some(false), response_format: Some(ResponseFormat { type_: "json_object".to_string(), json_schema: None, diff --git a/api/src/utils/tools/file_tools/search_files.rs b/api/src/utils/tools/file_tools/search_files.rs index 60c6065a7..2c88b56f5 100644 --- a/api/src/utils/tools/file_tools/search_files.rs +++ b/api/src/utils/tools/file_tools/search_files.rs @@ -97,7 +97,7 @@ impl SearchFilesTool { content: prompt, name: None, }], - temperature: Some(0.0), + stream: Some(false), response_format: Some(ResponseFormat { type_: "json_object".to_string(), json_schema: None, @@ -116,7 +116,10 @@ impl SearchFilesTool { Message::Assistant { content: Some(content), .. - } => content, + } => { + debug!("Received LLM response content: {}", content); + content + } _ => { error!("LLM response missing content"); return Err(anyhow::anyhow!("LLM response missing content")); @@ -125,7 +128,7 @@ impl SearchFilesTool { // Parse into structured response serde_json::from_str(content).map_err(|e| { - warn!(error = %e, "Failed to parse LLM response as JSON"); + warn!(error = %e, content = content, "Failed to parse LLM response as JSON"); anyhow::anyhow!("Failed to parse search results: {}", e) }) }