Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix(app): configure GPT-5 chat tools

Ezra Elletteafcaacebdbb4
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/pi.rs b/apps/screenpipe-app-tauri/src-tauri/src/pi.rs
index 2f9649687..832e534f2 100644
--- a/apps/screenpipe-app-tauri/src-tauri/src/pi.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/pi.rs
@@ -1525,6 +1525,24 @@ fn model_supports_reasoning(provider: &str, model: &str) -> bool {
}
}
+/// GPT-5.5 and GPT-5.6 reject function tools on OpenAI's Chat Completions
+/// endpoint unless `reasoning_effort` is explicitly `none`. Pi receives the
+/// model metadata we generate here, so map every selectable thinking level to
+/// `none` for this narrow endpoint/model combination. This preserves Pi's
+/// tool loop without guessing about other OpenAI-compatible providers.
+fn requires_openai_chat_tools_reasoning_none(base_url: &str, wire_api: &str, model: &str) -> bool {
+ let model = model.to_ascii_lowercase();
+ let is_affected_model = ["gpt-5.5", "gpt-5.6"]
+ .iter()
+ .any(|prefix| model == *prefix || model.starts_with(&format!("{prefix}-")));
+
+ wire_api == "openai-completions"
+ && base_url
+ .trim_end_matches('/')
+ .eq_ignore_ascii_case("https://api.openai.com/v1")
+ && is_affected_model
+}
+
/// Claude's newer reasoning models reject the legacy
/// `thinking: { type: "enabled", budget_tokens: ... }` request shape. Pi needs
/// this compatibility hint for models supplied through our generated provider
@@ -1646,6 +1664,21 @@ async fn build_models_json(
if requires_max_completion_tokens && wire_api == "openai-completions" {
compat.insert("maxTokensField".into(), json!("max_completion_tokens"));
}
+ if requires_openai_chat_tools_reasoning_none(&base_url, wire_api, &resolved_model) {
+ compat.insert("supportsReasoningEffort".into(), json!(true));
+ model_def.insert(
+ "thinkingLevelMap".into(),
+ json!({
+ "off": "none",
+ "minimal": "none",
+ "low": "none",
+ "medium": "none",
+ "high": "none",
+ "xhigh": "none",
+ "max": "none",
+ }),
+ );
+ }
if wire_api == "anthropic-messages"
&& anthropic_model_requires_adaptive_thinking(&resolved_model)
{
@@ -5631,6 +5664,44 @@ error: InstallFailed extracting tarball"#;
assert_eq!(model["compat"]["maxTokensField"], "max_completion_tokens");
}
+ #[tokio::test]
+ async fn test_build_models_json_openai_gpt55_maps_reasoning_to_none_for_tools() {
+ for provider in ["openai", "custom"] {
+ let mut pc = make_provider_config(provider, "gpt-5.5");
+ pc.url = "https://api.openai.com/v1".to_string();
+ let config = build_models_json(None, Some(&pc)).await;
+ let provider_name = if provider == "openai" {
+ "openai-byok"
+ } else {
+ "custom"
+ };
+ let model = &config["providers"][provider_name]["models"][0];
+
+ assert_eq!(
+ model["reasoning"], true,
+ "{provider} remains a reasoning model"
+ );
+ assert_eq!(model["compat"]["supportsReasoningEffort"], true);
+ for level in ["off", "minimal", "low", "medium", "high", "xhigh", "max"] {
+ assert_eq!(
+ model["thinkingLevelMap"][level], "none",
+ "{provider} {level}"
+ );
+ }
+ }
+ }
+
+ #[tokio::test]
+ async fn test_build_models_json_does_not_override_reasoning_for_other_custom_endpoints() {
+ let mut pc = make_provider_config("custom", "gpt-5.5");
+ pc.url = "https://example.com/v1".to_string();
+ let config = build_models_json(None, Some(&pc)).await;
+ let model = &config["providers"]["custom"]["models"][0];
+
+ assert!(model.get("thinkingLevelMap").is_none());
+ assert!(model["compat"].get("supportsReasoningEffort").is_none());
+ }
+
#[tokio::test]
async fn test_build_models_json_o3_model_forces_max_completion_tokens() {
let mut pc = make_provider_config("custom", "o3-mini");