mirror of
https://github.com/tinyhumansai/openhuman.git
synced 2026-07-27 21:08:00 +00:00
fix(inference): cap extraction max_tokens + classify provider 402 to stop the retry/Sentry storm (#3616) (#3617)
Co-authored-by: Steven Enamakel <enamakel@tinyhumans.ai>
This commit is contained in:
co-authored by
Steven Enamakel
parent
5b80f25cd4
commit
445b11afc2
@@ -2183,6 +2183,7 @@ async fn inference_provider_trait_defaults_cover_prompt_guided_paths() {
|
||||
messages: &[ChatMessage::user("need docs")],
|
||||
tools: Some(&[tool_spec.clone()]),
|
||||
stream: None,
|
||||
max_tokens: None,
|
||||
},
|
||||
"agentic-v1",
|
||||
0.4,
|
||||
@@ -2198,6 +2199,7 @@ async fn inference_provider_trait_defaults_cover_prompt_guided_paths() {
|
||||
messages: &[ChatMessage::user("plain")],
|
||||
tools: None,
|
||||
stream: None,
|
||||
max_tokens: None,
|
||||
},
|
||||
"agentic-v1",
|
||||
0.5,
|
||||
@@ -2283,6 +2285,7 @@ async fn inference_openai_compatible_provider_covers_native_streaming_and_fallba
|
||||
],
|
||||
tools: Some(&[tool_spec.clone(), tool_spec.clone()]),
|
||||
stream: Some(&delta_tx),
|
||||
max_tokens: None,
|
||||
},
|
||||
"stream-native",
|
||||
0.9,
|
||||
@@ -2322,6 +2325,7 @@ async fn inference_openai_compatible_provider_covers_native_streaming_and_fallba
|
||||
messages: &[ChatMessage::user("json encoded tool call")],
|
||||
tools: None,
|
||||
stream: None,
|
||||
max_tokens: None,
|
||||
},
|
||||
"tool-content-json",
|
||||
0.2,
|
||||
@@ -4429,6 +4433,7 @@ async fn inference_router_provider_covers_hint_tier_and_passthrough_routing() {
|
||||
messages: &[ChatMessage::user("fallback")],
|
||||
tools: None,
|
||||
stream: None,
|
||||
max_tokens: None,
|
||||
},
|
||||
"reasoning-v1",
|
||||
0.4,
|
||||
@@ -4548,6 +4553,7 @@ async fn inference_reliable_provider_covers_retry_fallback_and_aggregate_errors(
|
||||
messages: &[ChatMessage::user("fail")],
|
||||
tools: None,
|
||||
stream: None,
|
||||
max_tokens: None,
|
||||
},
|
||||
"missing-model",
|
||||
0.0,
|
||||
|
||||
@@ -141,6 +141,7 @@ async fn compatible_native_leftovers_cover_tool_history_function_call_and_stream
|
||||
],
|
||||
tools: Some(&tools),
|
||||
stream: None,
|
||||
max_tokens: None,
|
||||
},
|
||||
"function-call-model",
|
||||
0.4,
|
||||
@@ -165,6 +166,7 @@ async fn compatible_native_leftovers_cover_tool_history_function_call_and_stream
|
||||
messages: &[ChatMessage::user("content json")],
|
||||
tools: Some(&tools),
|
||||
stream: None,
|
||||
max_tokens: None,
|
||||
},
|
||||
"content-json-tools",
|
||||
0.4,
|
||||
@@ -186,6 +188,7 @@ async fn compatible_native_leftovers_cover_tool_history_function_call_and_stream
|
||||
messages: &[ChatMessage::user("stream ordering")],
|
||||
tools: Some(&tools),
|
||||
stream: Some(&tx),
|
||||
max_tokens: None,
|
||||
},
|
||||
"stream-out-of-order-tool",
|
||||
0.4,
|
||||
|
||||
@@ -154,6 +154,7 @@ async fn openai_compatible_matrix_covers_auth_requests_responses_and_streaming()
|
||||
],
|
||||
tools: Some(&tools),
|
||||
stream: None,
|
||||
max_tokens: None,
|
||||
},
|
||||
"native-tools",
|
||||
0.2,
|
||||
@@ -181,6 +182,7 @@ async fn openai_compatible_matrix_covers_auth_requests_responses_and_streaming()
|
||||
messages: &[ChatMessage::user("stream")],
|
||||
tools: Some(&tools),
|
||||
stream: Some(&tx),
|
||||
max_tokens: None,
|
||||
},
|
||||
"stream-sse",
|
||||
0.3,
|
||||
@@ -212,6 +214,7 @@ async fn openai_compatible_matrix_covers_auth_requests_responses_and_streaming()
|
||||
messages: &[ChatMessage::user("json stream")],
|
||||
tools: None,
|
||||
stream: Some(&json_tx),
|
||||
max_tokens: None,
|
||||
},
|
||||
"stream-json",
|
||||
0.3,
|
||||
@@ -229,6 +232,7 @@ async fn openai_compatible_matrix_covers_auth_requests_responses_and_streaming()
|
||||
messages: &[ChatMessage::user("retry without tools")],
|
||||
tools: Some(&tools),
|
||||
stream: Some(&retry_tx),
|
||||
max_tokens: None,
|
||||
},
|
||||
"stream-tools-unsupported",
|
||||
0.3,
|
||||
@@ -350,6 +354,7 @@ async fn compatible_error_matrix_covers_status_malformed_and_no_fallback_paths()
|
||||
messages: &[ChatMessage::user("stream fail")],
|
||||
tools: None,
|
||||
stream: Some(&sse_tx),
|
||||
max_tokens: None,
|
||||
},
|
||||
"stream-status-error",
|
||||
0.1,
|
||||
@@ -407,6 +412,7 @@ async fn ollama_compatible_matrix_covers_authless_chat_and_streaming_errors() {
|
||||
messages: &[ChatMessage::user("ollama stream")],
|
||||
tools: None,
|
||||
stream: Some(&tx),
|
||||
max_tokens: None,
|
||||
},
|
||||
"ollama-stream",
|
||||
0.0,
|
||||
|
||||
@@ -151,6 +151,7 @@ async fn compatible_provider_covers_retry_headers_responses_and_parse_errors() {
|
||||
],
|
||||
tools: Some(&tools),
|
||||
stream: Some(&tx),
|
||||
max_tokens: None,
|
||||
},
|
||||
"stream-tools-unsupported",
|
||||
0.2,
|
||||
|
||||
@@ -412,6 +412,7 @@ async fn reliable_provider_covers_chat_tools_streaming_and_context_bail_edges()
|
||||
messages: &[ChatMessage::user("retry me")],
|
||||
tools: None,
|
||||
stream: None,
|
||||
max_tokens: None,
|
||||
},
|
||||
"retry-model",
|
||||
0.2,
|
||||
|
||||
@@ -112,6 +112,7 @@ async fn compatible_provider_covers_chat_responses_streaming_tools_and_errors()
|
||||
messages: &[ChatMessage::user("use a tool")],
|
||||
tools: Some(&tools),
|
||||
stream: None,
|
||||
max_tokens: None,
|
||||
},
|
||||
"tool-model",
|
||||
0.1,
|
||||
@@ -135,6 +136,7 @@ async fn compatible_provider_covers_chat_responses_streaming_tools_and_errors()
|
||||
messages: &[ChatMessage::user("stream it")],
|
||||
tools: Some(&tools),
|
||||
stream: Some(&tx),
|
||||
max_tokens: None,
|
||||
},
|
||||
"stream-model",
|
||||
0.1,
|
||||
|
||||
@@ -111,6 +111,7 @@ async fn compatible_streaming_covers_tool_deltas_json_fallback_and_retry_without
|
||||
messages: &messages,
|
||||
tools: Some(&tools),
|
||||
stream: Some(&delta_tx),
|
||||
max_tokens: None,
|
||||
},
|
||||
"stream-tools",
|
||||
0.4,
|
||||
@@ -154,6 +155,7 @@ async fn compatible_streaming_covers_tool_deltas_json_fallback_and_retry_without
|
||||
messages: &[ChatMessage::user("json stream fallback")],
|
||||
tools: None,
|
||||
stream: Some(&json_tx),
|
||||
max_tokens: None,
|
||||
},
|
||||
"json-stream",
|
||||
0.2,
|
||||
@@ -170,6 +172,7 @@ async fn compatible_streaming_covers_tool_deltas_json_fallback_and_retry_without
|
||||
messages: &[ChatMessage::user("retry without tools")],
|
||||
tools: Some(&[tool_spec("lookup")]),
|
||||
stream: Some(&retry_tx),
|
||||
max_tokens: None,
|
||||
},
|
||||
"tool-retry",
|
||||
0.2,
|
||||
|
||||
@@ -362,6 +362,7 @@ async fn openai_compatible_provider_covers_auth_temperature_tool_fallback_and_re
|
||||
messages: &messages,
|
||||
tools: Some(&[tool.clone(), tool]),
|
||||
stream: None,
|
||||
max_tokens: None,
|
||||
},
|
||||
"gpt-5-mini",
|
||||
0.6,
|
||||
@@ -383,6 +384,7 @@ async fn openai_compatible_provider_covers_auth_temperature_tool_fallback_and_re
|
||||
messages: &messages,
|
||||
tools: None,
|
||||
stream: None,
|
||||
max_tokens: None,
|
||||
},
|
||||
"gpt-5-mini",
|
||||
0.6,
|
||||
@@ -450,6 +452,7 @@ async fn openai_compatible_provider_streaming_json_fallback_aggregates_response(
|
||||
messages: &messages,
|
||||
tools: None,
|
||||
stream: Some(&tx),
|
||||
max_tokens: None,
|
||||
},
|
||||
"stream-model",
|
||||
0.7,
|
||||
|
||||
Reference in New Issue
Block a user