native openai web search ability!
* feat: local passthrough for Responses tools via responses_tools + responses_tool_choice (behind CHATMOCK_ALLOW_RESPONSES_TOOLS)
* feat: gate Responses tools passthrough behind CHATMOCK_ALLOW_RESPONSES_TOOLS (default OFF)
* test(docs): add pytest for Responses tools passthrough (default off), and README usage section
* feat: responses tools hardening (fallback on 400, host allowlist, size guard, tool_choice strings only); tests updated
* feat: enable Responses tools passthrough by default; remove env gate
- Tools forwarded whenever is present
- Keep size guard and optional MCP host allowlist
- Accept strings unconditionally
Tests:
- Update to cover default passthrough and baseline (no responses_tools)
Docs:
- README: update instructions; move Star History to bottom
* chore: clean imports/comments; use gpt-5 in examples and tests
* docs: tighten Responses tools README; fix gpt-5 example\nchore: remove feature-specific test per review; trim comments/imports
* chore: remove __pycache__/ and bytecode; add .gitignore
* chore: add .gitignore for caches and bytecode
* Update README.md
* fix: remove MCP passthrough; allow only web_search in responses_tools
- Reject non-`web_search` types with 400 (`RESPONSES_TOOL_UNSUPPORTED`).
- Drop MCP host allowlist logic and related import.
- Keep size guard via `RESPONSES_TOOLS_MAX_BYTES` and fallback retry without extras.
- Docs: update README to state web_search-only passthrough.
Runtime verified locally with a stubbed upstream:
- OK: `responses_tools: [{"type": "web_search"}]` -> 200.
- BAD: `responses_tools: [{"type": "mcp"}]` -> 400 `RESPONSES_TOOL_UNSUPPORTED`.
* feat: forward Responses web_search tool via Chat Completions; fallback on rejection
- Accept `responses_tools` array and filter to `type: web_search` only.
- Enforce size guard `RESPONSES_TOOLS_MAX_BYTES` (default 32768).
- Fallback: if upstream rejects tools, retry without extras; otherwise return `RESPONSES_TOOLS_REJECTED`.
- README: document web_search-only passthrough and example.
- Headers: hint experimental features in OpenAI-Beta (responses; web-search).
* chore: remove local test-only forcing flag (CHATMOCK_FORCE_WEB_SEARCH)
* fix: restore full routes_openai (web_search-only passthrough + endpoints)
- Undo accidental large deletion from prior cleanup.
- Keep `web_search` passthrough, size guard, and fallback.
- Preserve `/v1/completions` and `/v1/models` endpoints and SSE handling.
* Update upstream.py
* Update upstream.py
* Update README.md
* Update README.md
* Update routes_openai.py
* feat(openai): default-enable web_search; accept preview; quiet retry; rm env knob
- Injects responses_tools=[{"type":"web_search"}] when client omits tools; explicit opt-out via responses_tool_choice:"none".
- Allowlist accepts "web_search" and "web_search_preview"; others rejected with RESPONSES_TOOL_UNSUPPORTED.
- Replaces env max-bytes knob with MAX_TOOLS_BYTES=32768.
- Retry on upstream rejection is silent; logs only under verbose.
* feat(stream): surface web_search_call as tool_calls; aggregate args; verbose-only logs
- Translates Responses web_search_call.* and output_item.done into OpenAI-style delta.tool_calls.
- Aggregates parameters by call_id (query/q, recency/time_range/days, domains/include/include_domains/include, max_results/topn/limit).
- No inference; arguments remain "{}" if upstream provides none. Logs only when verbose.
* feat(responses-tools): web_search passthrough; flag; fallback; Ollama parity; stable indexes
- Add --enable-web-search (default OFF) to inject web_search when requests omit responses_tools
- Allow tool types: web_search and web_search_preview; 32,768-byte cap on serialized responses_tools
- OpenAI /v1/chat/completions: passthrough + retry without extras on upstream rejection; return retry status
- Streaming: function.arguments always JSON; stable tool_calls index per call_id
- Ollama /api/chat: same passthrough + fallback behavior
- README updated to match behavior and limits
* Update README.md
* Update README.md
* Update routes_ollama.py
* Update routes_openai.py
* Update utils.py
---------
Co-authored-by: alexx-ftw <alexx-ftw@users.noreply.github.com>
Co-authored-by: Game_Time <108236317+RayBytes@users.noreply.github.com>
This commit is contained in:
@@ -96,6 +96,7 @@ def cmd_serve(
|
||||
reasoning_compat: str,
|
||||
debug_model: str | None,
|
||||
expose_reasoning_models: bool,
|
||||
default_web_search: bool,
|
||||
) -> int:
|
||||
app = create_app(
|
||||
verbose=verbose,
|
||||
@@ -104,6 +105,7 @@ def cmd_serve(
|
||||
reasoning_compat=reasoning_compat,
|
||||
debug_model=debug_model,
|
||||
expose_reasoning_models=expose_reasoning_models,
|
||||
default_web_search=default_web_search,
|
||||
)
|
||||
|
||||
app.run(host=host, debug=False, use_reloader=False, port=port, threaded=True)
|
||||
@@ -158,6 +160,11 @@ def main() -> None:
|
||||
"This allows choosing effort via model selection in compatible UIs."
|
||||
),
|
||||
)
|
||||
p_serve.add_argument(
|
||||
"--enable-web-search",
|
||||
action="store_true",
|
||||
help="Enable default web_search tool when a request omits responses_tools (off by default)",
|
||||
)
|
||||
|
||||
p_info = sub.add_parser("info", help="Print current stored tokens and derived account id")
|
||||
p_info.add_argument("--json", action="store_true", help="Output raw auth.json contents")
|
||||
@@ -177,6 +184,7 @@ def main() -> None:
|
||||
reasoning_compat=args.reasoning_compat,
|
||||
debug_model=args.debug_model,
|
||||
expose_reasoning_models=args.expose_reasoning_models,
|
||||
default_web_search=args.enable_web_search,
|
||||
)
|
||||
)
|
||||
elif args.command == "info":
|
||||
@@ -218,3 +226,4 @@ def main() -> None:
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user