Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,9 @@ prompt and may publish prefix checkpoints for other requests. Responses and Mess
## Transport and admission

Generation uses HTTP JSON or `stream: true` with SSE. WebSockets, background
execution, and hosted tools are unsupported. Anthropic requests require
`anthropic-version: 2023-06-01`.
execution, and hosted tools are unsupported; `GET /v1/responses` (including
WebSocket upgrade requests) returns HTTP 400 (`invalid_request_error`).
Anthropic requests require `anthropic-version: 2023-06-01`.

When a serving key is configured, OpenAI routes use `Authorization: Bearer KEY`.
Anthropic routes also accept `x-api-key: KEY`; supplying both headers requires
Expand Down Expand Up @@ -576,7 +577,9 @@ emit a success terminator. Responses also supports text custom tools by presenti
JSON `{ "input": string }` function to the model and restoring the custom call on
output. Anthropic's `type: "custom"` uses its ordinary `input_schema` contract.
Responses namespaces become unique `namespace__name` names in the model template
and regain their namespace on output; ambiguous names are rejected.
and regain their namespace on output; ambiguous names and duplicate namespace
declarations are rejected with HTTP 400, and empty namespace wrappers emit no
entry in `response.tools`.

Responses custom tools may specify Lark or regex grammars. Helios compiles them
before admission, includes their contract in the model's tool description, and
Expand Down Expand Up @@ -741,6 +744,13 @@ lifecycle events with increasing sequence numbers. Success ends in
`max_output_tokens`; generation failures end in `response.failed`. Responses SSE
does not use an OpenAI Chat `[DONE]` sentinel.

Response objects in buffered responses and SSE lifecycle events echo the
request's declared `tools` and `text.format` (defaulting to `{"type":"text"}`
when `text.format` is omitted or `null`). `function_call_output` and
`custom_tool_call_output` items honor an optional boolean `is_error` flag
(defaulting to `false` when omitted or `null`), applying the same failed
tool-result lowering as Chat Completions and Messages.

Readable reasoning is returned as `reasoning_text` content with an empty summary.
Opaque encrypted-only histories are rejected. Helios does not fabricate hosted
provider reasoning signatures or encrypted continuation state.
Expand Down
22 changes: 21 additions & 1 deletion helios/src/server/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub(super) async fn no_websocket() -> Response {
error(
Protocol::Responses,
StatusCode::BAD_REQUEST,
"WebSockets are not supported; use POST /v1/responses with HTTP/SSE",
"GET /v1/responses and WebSocket transport are not supported; use POST /v1/responses with HTTP JSON or SSE",
)
}
fn rejection(
Expand Down Expand Up @@ -368,6 +368,7 @@ pub(super) async fn generate(
observation.include_usage,
decoded.metadata,
);
encoder.set_text_format(decoded.text_format);
encoder.set_logprobs(
decoded.request.options.logprobs.clone(),
state.frontend.clone(),
Expand Down Expand Up @@ -701,4 +702,23 @@ mod tests {
StatusCode::BAD_REQUEST
);
}

#[tokio::test]
async fn get_responses_returns_bad_request_with_http_json_and_sse_guidance() {
let response = no_websocket().await;
assert_eq!(response.status(), StatusCode::BAD_REQUEST);
let bytes = axum::body::to_bytes(response.into_body(), 4096).await.unwrap();
let body: Value = serde_json::from_slice(&bytes).unwrap();
assert_eq!(
body,
json!({
"error": {
"type": "invalid_request_error",
"message": "GET /v1/responses and WebSocket transport are not supported; use POST /v1/responses with HTTP JSON or SSE",
"param": null,
"code": "invalid_request_error"
}
})
);
}
}
1 change: 1 addition & 0 deletions helios/src/server/inference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ pub enum Part {
pub struct Tool {
pub name: String,
pub namespace: Option<String>,
pub namespace_description: Option<String>,
pub description: String,
pub parameters: Value,
/// Whether the client declared `parameters`; `parameters` holds an empty
Expand Down
Loading
Loading