Skip to content

Add responses api_mode support for OpenAI relay#1

Merged
lsdefine merged 2 commits into
lsdefine:mainfrom
redreamality:fix/oai-responses-api-mode
Mar 1, 2026
Merged

Add responses api_mode support for OpenAI relay#1
lsdefine merged 2 commits into
lsdefine:mainfrom
redreamality:fix/oai-responses-api-mode

Conversation

@redreamality
Copy link
Copy Markdown
Contributor

Summary

  • add �pi_mode support to LLMSession with chat_completions (default) and
    esponses
  • allow �pi_base values that already end with /v1 without double-appending
  • map conversation history to Responses API input format correctly (�ssistant -> output_text)
  • include upstream response body in HTTP error output for easier debugging
  • pass �pi_mode from mykey config in �gentmain
  • document optional �pi_mode in mykey_template

Why

Some OpenAI-compatible relays only support
esponses (not chat/completions).
Second-turn requests failed with HTTP 400 due to wrong content type mapping in history.

Validation

  • local syntax check: python -m py_compile sidercall.py
  • multi-turn smoke test via uv run python:
    • turn1: hi -> normal
    • turn2: continue -> normal
    • turn3: what did I say first? -> returns hi

@lsdefine lsdefine merged commit 3927477 into lsdefine:main Mar 1, 2026
ZZFFLL pushed a commit to ZZFFLL/zfengl-ga that referenced this pull request Apr 30, 2026
…-mode

Add responses api_mode support for OpenAI relay
bendusy pushed a commit to bendusy/GenericAgent that referenced this pull request May 14, 2026
bendusy added a commit to bendusy/GenericAgent that referenced this pull request May 14, 2026
…l calls (lsdefine#1)

Ports NousResearch/hermes-agent agent/tool_guardrails.py (MIT) to detect:
- repeated identical-args tool failures (exact_failure)
- same-tool failures across different args (same_tool_failure)
- idempotent reads returning the same result (no_progress)

Integration is opt-in via env:
- GA_TOOLGUARD=off      disables warnings (default: on)
- GA_TOOLGUARD_HARDSTOP=1 enables block/halt (default: off, warn-only)

Defaults preserve existing behavior: warnings only, no execution interception.
When hard stop is enabled, block/halt synthesizes a tool result and exits the
current task with the guardrail message.

GA-specific tool catalogue:
- idempotent: file_read, web_scan
- mutating  : code_run, file_patch, file_write, web_execute_js,
              update_working_checkpoint, start_long_term_update

Failure classifier handles code_run exit_code semantics; falls back to
"error"/"failed" substring detection in result preview.

18 new unit tests cover signatures, classifier, warn-only flow, hard-stop
thresholds, success-resets-counter, and env config parsing.

Co-authored-by: Ben <ben@M4.local>
bendusy pushed a commit to bendusy/GenericAgent that referenced this pull request May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants