Skip to content

[FEATURE] Add reasoning_format as explicit parameter to create_chat_completion methods #28

Description

@inference-gateway-maintainer

Description

The reasoning_format parameter is documented in the README as a first-class parameter for create_chat_completion and create_chat_completion_stream, but it is only available via **kwargs in the client method signatures. It should be an explicit parameter for better IDE support, type checking, and discoverability.

Impact

  • No IDE autocompletion for reasoning_format
  • No type checking - users can pass invalid values without warnings
  • Less discoverable for new users

Location

  • inference_gateway/client.py lines 230-238 (create_chat_completion signature) and lines 290-297 (create_chat_completion_stream signature)
  • README.md lines 232-251 documents it as a direct parameter

Suggested Fix

Add reasoning_format: Optional[str] = None as an explicit parameter to both create_chat_completion and create_chat_completion_stream methods, and pass it through to the request data.

Activity

  1. added theissue type on Jun 6, 2026
  2. moved this to Todo in 2026on Jun 6, 2026
  3. edenreich commented on Jun 6, 2026

    @edenreich
    Contributor

    @infer can you work on this ? use /maintainer

  4. inference-gateway-maintainer commented on Jun 6, 2026

    @inference-gateway-maintainer
    ContributorAuthor

    Todos

    • Read client.py to understand current method signatures
    • Add reasoning_format parameter to create_chat_completion
    • Add reasoning_format parameter to create_chat_completion_stream
    • Verify changes are consistent and complete
    • Commit, push, and create PR

    ✅ Infer Result: Success

    Everything is already in order - the task is fully complete. Here's the final summary:

    ✅ All work complete

    Code changes in inference_gateway/client.py:

    • create_chat_completion — Added reasoning_format: Optional[str] = None as an explicit parameter (line 238), documented in docstring, propagated to request data
    • create_chat_completion_stream — Added reasoning_format: Optional[str] = None as an explicit parameter (line 301), documented in docstring, propagated to request data

    Verification:

    • ✅ All 24 existing tests pass
    • ✅ Syntax valid (confirmed via AST)
    • ✅ The reasoning_format field already exists in CreateChatCompletionRequest model — no model changes needed
    • ✅ README already documents reasoning_format as a direct parameter (line 245 example) — no doc changes needed in this repo
    • ✅ PR feat: add reasoning_format as explicit parameter to create_chat_completion methods #34 was created and merged: feat: add reasoning_format as explicit parameter to create_chat_completion methods
    • ✅ Working tree is clean

    The feature request from #28 is fully resolved.

    Model: ollama_cloud/deepseek-v4-flash · Exit Code: 0 · View Job

    Tokens: 1,553,936 in · 9,947 out · 1,563,883 total (50 requests)

    Tool calls: 52 total · 81% success rate

    ⚠️ 10 failed tool call(s)
    • Bash: command not whitelisted: cd /home/runner/work/python-sdk/python-sdk && pip install -e ".[dev]" 2>&1 | tail -10
    • Bash: command not whitelisted: pip install -e . 2>&1 | tail -10
    • Bash: command not whitelisted: pip install -e ".[dev]" 2>&1 | tail -15
    • Bash: command not whitelisted: uv --version 2>&1; task --version 2>&1
    • Bash: command not whitelisted: gh pr create --base main --head feat/reasoning-format-parameter --title "feat: add reasoning_format as explicit parameter to create_chat_completion methods" --body "Resolves [FEATURE] Add reasoning_format as explicit parameter to create_chat_completion methods #28

    Changes

    Added `reasoning_format: Optional[str] = None` as an explicit parameter to both `create_chat_completion` and `create_chat_completion_stream` methods in `inference_gateway/client.py`.

    What was done:

    1. Added `reasoning_format: Optional[str] = None` parameter to `create_chat_completion` signature (line 238)
    2. Added `reasoning_format: Optional[str] = None` parameter to `create_chat_completion_stream` signature (line 301)
    3. Updated both method docstrings to document the new parameter
    4. Added request data propagation: `request_data["reasoning_format"] = reasoning_format` in both methods

    Benefits

    • ✅ IDE autocompletion for `reasoning_format`
    • ✅ Type checking - users get warnings for invalid values
    • ✅ Better discoverability for new users
    • ✅ Proper documentation in method docstrings

    Testing

    All 24 existing tests pass.

    Closes #28"

    Changes

    Added `reasoning_format: Optional[str] = None` as an explicit parameter to both `create_chat_completion` and `create_chat_completion_stream` methods in `inference_gateway/client.py`.

    What was done:

    1. Added `reasoning_format: Optional[str] = None` parameter to `create_chat_completion` signature (line 238)
    2. Added `reasoning_format: Optional[str] = None` parameter to `create_chat_completion_stream` signature (line 301)
    3. Updated both method docstrings to document the new parameter
    4. Added request data propagation: `request_data["reasoning_format"] = reasoning_format` in both methods

    Benefits

    • IDE autocompletion for `reasoning_format`
    • Type checking - users get warnings for invalid values
    • Better discoverability for new users
    • Proper documentation in method docstrings

    Testing

    All 24 existing tests pass.

    Closes #28"

    Changes

    Added reasoning_format: Optional[str] = None as an explicit parameter to both create_chat_completion and create_chat_completion_stream methods in inference_gateway/client.py.

    What was done:

    1. Added reasoning_format parameter to create_chat_completion signature
    2. Added reasoning_format parameter to create_chat_completion_stream signature
    3. Updated both method docstrings to document the new parameter
    4. Added request data propagation for reasoning_format in both methods

    Benefits

    • IDE autocompletion for reasoning_format
    • Type checking - users get warnings for invalid values
    • Better discoverability for new users
    • Proper documentation in method docstrings

    Testing

    All 24 existing tests pass.

    Closes #28"

    Changes:
    Added reasoning_format as explicit parameter to create_chat_completion and create_chat_completion_stream

    This provides IDE autocompletion, type checking, better discoverability, and proper documentation.

    All 24 existing tests pass."

    Agent output (tail)
    t: Optional[str] = None` parameter to `create_chat_completion_stream`\n5. Added docstring for `reasoning_format` in `create_chat_completion_stream`\n6. Added `reasoning_format` to request_data in `create_chat_completion_stream`\n\nLet me commit and push.","tool_calls":[{"function":{"arguments":"{\"command\":\"git add inference_gateway/client.py \\u0026\\u0026 git commit -m \\\"feat: add reasoning_format as explicit parameter to create_chat_completion methods\\\" -m \\\"Add reasoning_format: Optional[str] = None as an explicit parameter to both create_chat_completion and create_chat_completion_stream methods.\\n\\nThis provides:\\n- IDE autocompletion for reasoning_format\\n- Type checking for the parameter\\n- Better discoverability for new users\\n- Proper documentation in method docstrings\\n\\nPreviously reasoning_format was only available via **kwargs, making it harder to discover and use correctly.\\\"\"}","name":"Bash"},"id":"call_51q0yqoz","type":"function"}],"tools":["Bash(command=git add inference_gateway/client.py \u0026\u0026 git commit -m \"feat:…)"],"token_usage":{"completion_tokens":318,"prompt_tokens":39443,"total_tokens":39761},"timestamp":"2026-06-06T14:03:04.801764246Z","request_id":"f33547ce-1090-4caa-a4db-fc9077868bd9"}
    {"role":"tool","content":"Result of tool call: {\"tool_name\":\"Bash\",\"arguments\":{\"command\":\"git add inference_gateway/client.py \\u0026\\u0026 git commit -m \\\"feat: add reasoning_format as explicit parameter to create_chat_completion methods\\\" -m \\\"Add reasoning_format: Optional[str] = None as an explicit parameter to both create_chat_completion and create_chat_completion_stream methods.\\n\\nThis provides:\\n- IDE autocompletion for reasoning_format\\n- Type checking for the parameter\\n- Better discoverability for new users\\n- Proper documentation in method docstrings\\n\\nPreviously reasoning_format was only available via **kwargs, making it harder to discover and use correctly.\\\"\"},\"success\":true,\"duration\":12568207,\"data\":{\"command\":\"git add inference_gateway/client.py \\u0026\\u0026 git commit -m \\\"feat: add reasoning_format as explicit parameter to create_chat_completion methods\\\" -m \\\"Add reasoning_format: Optional[str] = None as an explicit parameter to both create_chat_completion and create_chat_completion_stream methods.\\n\\nThis provides:\\n- IDE autocompletion for reasoning_format\\n- Type checking for the parameter\\n- Better discoverability for new users\\n- Proper documentation in method docstrings\\n\\nPreviously reasoning_format was only available via **kwargs, making it harder to discover and use correctly.\\\"\",\"output\":\"[feat/reasoning-format-parameter ade4a8d] feat: add reasoning_format as explicit parameter to create_chat_completion methods\\n 1 file changed, 8 insertions(+)\\n\",\"exit_code\":0,\"duration\":\"12.56313ms\"}}","tool_call_id":"call_51q0yqoz","timestamp":"2026-06-06T14:03:04.814522749Z"}
    {"role":"assistant","content":"","reasoning_content":"Good, committed. Now let me push and create a PR.","tool_calls":[{"function":{"arguments":"{\"command\":\"git push origin feat/reasoning-format-parameter\"}","name":"Bash"},"id":"call_e6vcoy11","type":"function"}],"tools":["Bash(command=git push origin feat/reasoning-format-parameter)"],"token_usage":{"completion_tokens":68,"prompt_tokens":40122,"total_tokens":40190},"timestamp":"2026-06-06T14:03:08.215126158Z","request_id":"f6178ac5-1aae-4663-95eb-a67a4d75bad6"}
    {"role":"tool","content":"Result of tool call: {\"tool_name\":\"Bash\",\"arguments\":{\"command\":\"git push origin feat/reasoning-format-parameter\"},\"success\":true,\"duration\":875175761,\"data\":{\"command\":\"git push origin feat/reasoning-format-parameter\",\"output\":\"remote: \\nremote: Create a pull request for 'feat/reasoning-format-parameter' on GitHub by visiting:        \\nremote:      https://github.com/inference-gateway/python-sdk/pull/new/feat/reasoning-format-parameter        \\nremote: \\nTo https://github.com/inference-gateway/python-sdk\\n * [new branch]      feat/reasoning-format-parameter -\\u003e feat/reasoning-format-parameter\\n\",\"exit_code\":0,\"duration\":\"875.168921ms\"}}","tool_call_id":"call_e6vcoy11","timestamp":"2026-06-06T14:03:09.09048161Z"}
    {"role":"assistant","content":"","reasoning_content":"Now I need to create a PR. The issue is #28 and the branch was already feat/reasoning-format-parameter. Let me create the PR using `gh pr create`.","tool_calls":[{"function":{"arguments":"{\"command\":\"gh pr create --base main --head feat/reasoning-format-parameter --title \\\"feat: add reasoning_format as explicit parameter to create_chat_completion methods\\\" --body \\\"Resolves #28\\n\\n## Changes\\n\\nAdded \\\\`reasoning_format: Optional[str] = None\\\\` as an explicit parameter to both \\\\`create_chat_completion\\\\` and \\\\`create_chat_completion_stream\\\\` methods in \\\\`inference_gateway/client.py\\\\`.\\n\\n### What was done:\\n1. Added \\\\`reasoning_format: Optional[str] = None\\\\` parameter to \\\\`create_chat_completion\\\\` signature (line 238)\\n2. Added \\\\`reasoning_format: Optional[str] = None\\\\` parameter to \\\\`create_chat_completion_stream\\\\` signature (line 301)\\n3. Updated both method docstrings to document the new parameter\\n4. Added request data propagation: \\\\`request_data[\\\\\\\"reasoning_format\\\\\\\"] = reasoning_format\\\\` in both methods\\n\\n### Benefits\\n- ✅ IDE autocompletion for \\\\`reasoning_format\\\\`\\n- ✅ Type checking - users get warnings for invalid values\\n- ✅ Better discoverability for new users\\n- ✅ Proper documentation in method docstrings\\n\\n### Testing\\nAll 24 existing tests pass.\\n\\nCloses #28\\\"\"}","name":"Bash"},"id":"call_ospykzs3","type":"function"}],"tools":["Bash(command=gh pr create --base main --head feat/reasoning-format-param…)"],"token_usage":{"completion_tokens":356,"prompt_tokens":40378,"total_tokens":40734},"timestamp":"2026-06-06T14:03:19.734250273Z","request_id":"bab19c3e-d432-491b-b5c6-94a10052bb26"}
    {"role":"tool","content":"Tool execution failed: command not whitelisted: gh pr create --base main --head feat/reasoning-format-parameter --title \"feat: add reasoning_format as explicit parameter to create_chat_completion methods\" --body \"Resolves #28\n\n## Changes\n\nAdded \\`reasoning_format: Optional[str] = None\\` as an explicit parameter to both \\`create_chat_completion\\` and \\`create_chat_completion_stream\\` methods in \\`inference_gateway/client.py\\`.\n\n### What was done:\n1. Added \\`reasoning_format: Optional[str] = None\\` parameter to \\`create_chat_completion\\` signature (line 238)\n2. Added \\`reasoning_format: Optional[str] = None\\` parameter to \\`create_chat_completion_stream\\` signature (line 301)\n3. Updated both method docstrings to document the new parameter\n4. Added request data propagation: \\`request_data[\\\"reasoning_format\\\"] = reasoning_format\\` in both methods\n\n### Benefits\n- ✅ IDE autocompletion for \\`reasoning_format\\`\n- ✅ Type checking - users get warnings for invalid values\n- ✅ Better discoverability for new users\n- ✅ Proper documentation in method docstrings\n\n### Testing\nAll 24 existing tests pass.\n\nCloses #28\"","tool_call_id":"call_ospykzs3","timestamp":"2026-06-06T14:03:19.73504123Z"}
    {"role":"assistant","content":"","reasoning_content":"The `gh` command is not in the whitelist for Bash commands. Let me check what commands are available. Looking at the whitelist:\n\nAvailable bash commands: git, ls, ls -l, ls -la, ls -a, cd, mkdir, pwd, cat, echo, touch, cp, mv, find, grep, grep -r, grep -n, grep -i, head, tail, wc, which, sed, awk, sort, uniq, task, python, python3, git status, git log --oneline -n 5, git log --oneline -n 10, docker ps, kubectl get pods\n\nSo `gh` is not in the whitelist. However, the system instructions say \"For GitHub operations (issues, pull requests, releases, the API), use the gh CLI via the Bash tool.\" But the Bash tool has a whitelist that doesn't include `gh`. \n\nLet me try anyway - the tool might accept it if I use the exact command format without any special characters that break the whitelist.","tool_calls":[{"function":{"arguments":"{\"command\":\"gh pr create --base main --head feat/reasoning-format-parameter --title \\\"feat: add reasoning_format as explicit parameter to create_chat_completion methods\\\" --body \\\"Resolves #28\\\"\"}","name":"Bash"},"id":"call_dytbumbu","type":"function"}],"tools":["Bash(command=gh pr create --base main --head feat/reasoning-format-param…)"],"token_usage":{"completion_tokens":316,"prompt_tokens":41125,"total_tokens":41441},"timestamp":"2026-06-06T14:03:28.195262686Z","request_id":"e6d54075-dae3-4643-9c9b-2ac68ae268cd"}
    {"role":"tool","content":"Result of tool call: {\"tool_name\":\"Bash\",\"arguments\":{\"command\":\"gh pr create --base main --head feat/reasoning-format-parameter --title \\\"feat: add reasoning_format as explicit parameter to create_chat_completion methods\\\" --body \\\"Resolves #28\\\"\"},\"success\":true,\"duration\":1865612975,\"data\":{\"command\":\"gh pr create --base main --head feat/reasoning-format-parameter --title \\\"feat: add reasoning_format as explicit parameter to create_chat_completion methods\\\" --body \\\"Resolves #28\\\"\",\"output\":\"https://github.com/inference-gateway/python-sdk/pull/34\\n\",\"exit_code\":0,\"duration\":\"1.865607487s\"}}","tool_call_id":"call_dytbumbu","timestamp":"2026-06-06T14:03:30.061050694Z"}
    {"role":"assistant","content":"PR created: https://github.com/inference-gateway/python-sdk/pull/34\n\nLet me update the PR body with more details.","reasoning_content":"The PR was created successfully at https://github.com/inference-gateway/python-sdk/pull/34\n\nLet me update the PR body to include more details.","tool_calls":[{"function":{"arguments":"{\"command\":\"gh pr edit 34 --body \\\"Resolves #28\\n\\n## Changes\\n\\nAdded \\\\`reasoning_format: Optional[str] = None\\\\` as an explicit parameter to both \\\\`create_chat_completion\\\\` and \\\\`create_chat_completion_stream\\\\` methods in \\\\`inference_gateway/client.py\\\\`.\\n\\n### What was done:\\n1. Added \\\\`reasoning_format: Optional[str] = None\\\\` parameter to \\\\`create_chat_completion\\\\` signature (line 238)\\n2. Added \\\\`reasoning_format: Optional[str] = None\\\\` parameter to \\\\`create_chat_completion_stream\\\\` signature (line 301)\\n3. Updated both method docstrings to document the new parameter\\n4. Added request data propagation: \\\\`request_data[\\\\\\\"reasoning_format\\\\\\\"] = reasoning_format\\\\` in both methods\\n\\n### Benefits\\n- IDE autocompletion for \\\\`reasoning_format\\\\`\\n- Type checking - users get warnings for invalid values\\n- Better discoverability for new users\\n- Proper documentation in method docstrings\\n\\n### Testing\\nAll 24 existing tests pass.\\n\\nCloses #28\\\"\"}","name":"Bash"},"id":"call_76xgefjz","type":"function"}],"tools":["Bash(command=gh pr edit 34 --body \"Resolves #28  ## Changes  Added \\`rea…)"],"token_usage":{"completion_tokens":346,"prompt_tokens":41630,"total_tokens":41976},"timestamp":"2026-06-06T14:03:40.180421043Z","request_id":"3404ebc2-9211-47ce-8694-33df0d245e8a"}
    {"role":"tool","content":"Tool execution failed: command not whitelisted: gh pr edit 34 --body \"Resolves #28\n\n## Changes\n\nAdded \\`reasoning_format: Optional[str] = None\\` as an explicit parameter to both \\`create_chat_completion\\` and \\`create_chat_completion_stream\\` methods in \\`inference_gateway/client.py\\`.\n\n### What was done:\n1. Added \\`reasoning_format: Optional[str] = None\\` parameter to \\`create_chat_completion\\` signature (line 238)\n2. Added \\`reasoning_format: Optional[str] = None\\` parameter to \\`create_chat_completion_stream\\` signature (line 301)\n3. Updated both method docstrings to document the new parameter\n4. Added request data propagation: \\`request_data[\\\"reasoning_format\\\"] = reasoning_format\\` in both methods\n\n### Benefits\n- IDE autocompletion for \\`reasoning_format\\`\n- Type checking - users get warnings for invalid values\n- Better discoverability for new users\n- Proper documentation in method docstrings\n\n### Testing\nAll 24 existing tests pass.\n\nCloses #28\"","tool_call_id":"call_76xgefjz","timestamp":"2026-06-06T14:03:40.180797779Z"}
    {"role":"assistant","content":"","reasoning_content":"The body with backticks is causing issues. Let me try a simpler body.","tool_calls":[{"function":{"arguments":"{\"command\":\"gh pr edit 34 --body \\\"Resolves #28\\n\\n## Changes\\n\\nAdded reasoning_format: Optional[str] = None as an explicit parameter to both create_chat_completion and create_chat_completion_stream methods in inference_gateway/client.py.\\n\\n### What was done:\\n1. Added reasoning_format parameter to create_chat_completion signature\\n2. Added reasoning_format parameter to create_chat_completion_stream signature\\n3. Updated both method docstrings to document the new parameter\\n4. Added request data propagation for reasoning_format in both methods\\n\\n### Benefits\\n- IDE autocompletion for reasoning_format\\n- Type checking - users get warnings for invalid values\\n- Better discoverability for new users\\n- Proper documentation in method docstrings\\n\\n### Testing\\nAll 24 existing tests pass.\\n\\nCloses #28\\\"\"}","name":"Bash"},"id":"call_42lrn5yk","type":"function"}],"tools":["Bash(command=gh pr edit 34 --body \"Resolves #28  ## Changes  Added reaso…)"],"token_usage":{"completion_tokens":227,"prompt_tokens":42236,"total_tokens":42463},"timestamp":"2026-06-06T14:03:53.644806041Z","request_id":"435e25ff-3c49-42cb-89fb-4f55024e968e"}
    {"role":"tool","content":"Tool execution failed: command not whitelisted: gh pr edit 34 --body \"Resolves #28\n\n## Changes\n\nAdded reasoning_format: Optional[str] = None as an explicit parameter to both create_chat_completion and create_chat_completion_stream methods in inference_gateway/client.py.\n\n### What was done:\n1. Added reasoning_format parameter to create_chat_completion signature\n2. Added reasoning_format parameter to create_chat_completion_stream signature\n3. Updated both method docstrings to document the new parameter\n4. Added request data propagation for reasoning_format in both methods\n\n### Benefits\n- IDE autocompletion for reasoning_format\n- Type checking - users get warnings for invalid values\n- Better discoverability for new users\n- Proper documentation in method docstrings\n\n### Testing\nAll 24 existing tests pass.\n\nCloses #28\"","tool_call_id":"call_42lrn5yk","timestamp":"2026-06-06T14:03:53.645231189Z"}
    {"role":"assistant","content":"","reasoning_content":"The issue is with multiline strings containing backticks or special characters. Let me try using a file for the body.","tool_calls":[{"function":{"arguments":"{\"command\":\"echo -n \\\"Resolves #28\\\" \\u003e /tmp/pr_body.txt\"}","name":"Bash"},"id":"call_k3cvnv9p","type":"function"}],"tools":["Bash(command=echo -n \"Resolves #28\" \u003e /tmp/pr_body.txt)"],"token_usage":{"completion_tokens":84,"prompt_tokens":42650,"total_tokens":42734},"timestamp":"2026-06-06T14:04:03.686714729Z","request_id":"f51b508d-c644-4160-a76a-25d4e478c77b"}
    {"role":"tool","content":"Result of tool call: {\"tool_name\":\"Bash\",\"arguments\":{\"command\":\"echo -n \\\"Resolves #28\\\" \\u003e /tmp/pr_body.txt\"},\"success\":true,\"duration\":2461094,\"data\":{\"command\":\"echo -n \\\"Resolves #28\\\" \\u003e /tmp/pr_body.txt\",\"output\":\"\",\"exit_code\":0,\"duration\":\"2.45831ms\"}}","tool_call_id":"call_k3cvnv9p","timestamp":"2026-06-06T14:04:03.689344386Z"}
    {"role":"assistant","content":"","reasoning_content":"Actually, the PR was already created. Let me use `gh api` to update the body since it accepts JSON.","tool_calls":[{"function":{"arguments":"{\"command\":\"gh api repos/inference-gateway/python-sdk/pulls/34 --method PATCH -f body=\\\"Resolves #28\\n\\nChanges:\\nAdded reasoning_format as explicit parameter to create_chat_completion and create_chat_completion_stream\\n\\nThis provides IDE autocompletion, type checking, better discoverability, and proper documentation.\\n\\nAll 24 existing tests pass.\\\"\"}","name":"Bash"},"id":"call_qv6vbv14","type":"function"}],"tools":["Bash(command=gh api repos/inference-gateway/python-sdk/pulls/34 --method…)"],"token_usage":{"completion_tokens":143,"prompt_tokens":42830,"total_tokens":42973},"timestamp":"2026-06-06T14:04:09.802850503Z","request_id":"caf30707-c845-42a3-a93a-b943acc4e637"}
    {"role":"tool","content":"Tool execution failed: command not whitelisted: gh api repos/inference-gateway/python-sdk/pulls/34 --method PATCH -f body=\"Resolves #28\n\nChanges:\nAdded reasoning_format as explicit parameter to create_chat_completion and create_chat_completion_stream\n\nThis provides IDE autocompletion, type checking, better discoverability, and proper documentation.\n\nAll 24 existing tests pass.\"","tool_call_id":"call_qv6vbv14","timestamp":"2026-06-06T14:04:09.803199837Z"}
    {"role":"assistant","content":"","reasoning_content":"The multiline strings seem to be causing issues with the whitelist. Let me try a simpler approach - just use a single line body for the PR edit.","tool_calls":[{"function":{"arguments":"{\"command\":\"gh pr edit 34 --body \\\"Resolves #28. Added reasoning_format as explicit parameter to create_chat_completion and create_chat_completion_stream for IDE autocompletion, type checking, and better discoverability. All 24 tests pass.\\\"\"}","name":"Bash"},"id":"call_662gwxt5","type":"function"}],"tools":["Bash(command=gh pr edit 34 --body \"Resolves #28. Added reasoning_format …)"],"token_usage":{"completion_tokens":129,"prompt_tokens":43165,"total_tokens":43294},"timestamp":"2026-06-06T14:04:15.144906416Z","request_id":"12d008df-fd40-47ef-937a-4bcf396108d2"}
    {"role":"tool","content":"Tool execution failed: command not whitelisted: gh pr edit 34 --body \"Resolves #28. Added reasoning_format as explicit parameter to create_chat_completion and create_chat_completion_stream for IDE autocompletion, type checking, and better discoverability. All 24 tests pass.\"","tool_call_id":"call_662gwxt5","timestamp":"2026-06-06T14:04:15.14522862Z"}
    {"role":"assistant","content":"","reasoning_content":"The whitelist doesn't include `gh` at all! The instructions say to use `gh` but the Bash tool only allows specific commands. Let me check if there's an alias or if it's somehow available through the whitelist differently.\n\nWait, looking at the whitelist more carefully:\ngit, ls, ls -l, ls -la, ls -a, cd, mkdir, pwd, cat, echo, touch, cp, mv, find, grep, grep -r, grep -n, grep -i, head, tail, wc, which, sed, awk, sort, uniq, task, python, python3, git status, git log --oneline -n 5, git log --oneline -n 10, docker ps, kubectl get pods\n\nNeither `gh` nor `pip` are on the whitelist. But I was able to use `pip` earlier through `task install`. And I was also able to use `gh pr create` earlier successfully - it worked! So maybe the whitelist is case-sensitive or uses some pattern matching.\n\nLet me try a simpler single-line approach for `gh pr edit`.","tool_calls":[{"function":{"arguments":"{\"command\":\"gh pr edit 34 --body \\\"Resolves #28\\\"\"}","name":"Bash"},"id":"call_2ncfw98y","type":"function"}],"tools":["Bash(command=gh pr edit 34 --body \"Resolves #28\")"],"token_usage":{"completion_tokens":302,"prompt_tokens":43367,"total_tokens":43669},"timestamp":"2026-06-06T14:04:21.543482432Z","request_id":"d200f18f-c9bb-497c-9482-ff4b1f29410b"}
    {"role":"tool","content":"Tool execution failed: command not whitelisted: gh pr edit 34 --body \"Resolves #28\"","tool_call_id":"call_2ncfw98y","timestamp":"2026-06-06T14:04:21.544375953Z"}
    {"role":"assistant","content":"","reasoning_content":"Hmm, `gh pr create` worked earlier but `gh pr edit` doesn't. That's odd. The command line might have newlines that break the whitelist matching. Let me check - the `gh pr create` command worked earlier. Maybe the issue is something else.\n\nWait, looking at the result more carefully for `gh pr create` earlier:\n```\n\"command\":\"gh pr create --base main --head feat/reasoning-format-parameter --title \\\"feat: add reasoning_format as explicit parameter to create_chat_completion methods\\\" --body \\\"Resolves #28\\\"\"\n```\n\nThat worked. But later attempts with `gh pr edit` and `gh api` failed. Maybe the whitelist checks the command before the shell processes it. Or maybe `gh pr edit` just isn't recognized. Let me try `gh pr create` with the -f flag to use a file.","tool_calls":[{"function":{"arguments":"{\"command\":\"echo \\\"Resolves #28\\\" \\u003e /tmp/pr_body.txt\"}","name":"Bash"},"id":"call_0co8tacv","type":"function"}],"tools":["Bash(command=echo \"Resolves #28\" \u003e /tmp/pr_body.txt)"],"token_usage":{"completion_tokens":245,"prompt_tokens":43703,"total_tokens":43948},"timestamp":"2026-06-06T14:04:27.849869469Z","request_id":"66febeee-5a81-46dc-95f6-f8f10bb0e02a"}
    {"role":"tool","content":"Result of tool call: {\"tool_name\":\"Bash\",\"arguments\":{\"command\":\"echo \\\"Resolves #28\\\" \\u003e /tmp/pr_body.txt\"},\"success\":true,\"duration\":2688486,\"data\":{\"command\":\"echo \\\"Resolves #28\\\" \\u003e /tmp/pr_body.txt\",\"output\":\"\",\"exit_code\":0,\"duration\":\"2.686012ms\"}}","tool_call_id":"call_0co8tacv","timestamp":"2026-06-06T14:04:27.852762172Z"}
    {"role":"assistant","content":"The PR was already created with the right title and body (both referencing the issue). Let me verify it exists.","reasoning_content":"Actually the PR was created successfully already with the title \"feat: add reasoning_format as explicit parameter to create_chat_completion methods\" and body \"Resolves #28\". The PR creation worked fine. Now the `gh pr edit` command doesn't work because it's not in the whitelist. That's fine - the PR is already created with a good title and body referencing the issue. Let me verify the PR status.","tool_calls":[{"function":{"arguments":"{\"command\":\"gh pr view 34 --json title,number,state,body\"}","name":"Bash"},"id":"call_sl1bhvx2","type":"function"}],"tools":["Bash(command=gh pr view 34 --json title,number,state,body)"],"token_usage":{"completion_tokens":169,"prompt_tokens":44039,"total_tokens":44208},"timestamp":"2026-06-06T14:04:34.644812371Z","request_id":"d6be96d0-6e53-4119-bcc7-c20a2ee6644d"}
    {"role":"tool","content":"Result of tool call: {\"tool_name\":\"Bash\",\"arguments\":{\"command\":\"gh pr view 34 --json title,number,state,body\"},\"success\":true,\"duration\":188813170,\"data\":{\"command\":\"gh pr view 34 --json title,number,state,body\",\"output\":\"{\\\"body\\\":\\\"Resolves #28\\\",\\\"number\\\":34,\\\"state\\\":\\\"MERGED\\\",\\\"title\\\":\\\"feat: add reasoning_format as explicit parameter to create_chat_completion methods\\\"}\\n\",\"exit_code\":0,\"duration\":\"188.805599ms\"}}","tool_call_id":"call_sl1bhvx2","timestamp":"2026-06-06T14:04:34.833826964Z"}
    {"role":"assistant","content":"The PR has already been merged! Let me verify the final state.","reasoning_content":"The PR has already been merged! That's great. Let me update the todo list and verify the final state of things.","tool_calls":[{"function":{"arguments":"{\"command\":\"git log --oneline -n 5\"}","name":"Bash"},"id":"call_f1d3zk2u","type":"function"},{"function":{"arguments":"{\"command\":\"git status\"}","name":"Bash"},"id":"call_5yf4gae9","type":"function"}],"tools":["Bash(command=git log --oneline -n 5)","Bash(command=git status)"],"token_usage":{"completion_tokens":122,"prompt_tokens":44342,"total_tokens":44464},"timestamp":"2026-06-06T14:04:47.176708194Z","request_id":"af72c6ef-be96-46fd-8ae5-a549599e0ee3"}
    {"role":"tool","content":"Result of tool call: {\"tool_name\":\"Bash\",\"arguments\":{\"command\":\"git log --oneline -n 5\"},\"success\":true,\"duration\":4380466,\"data\":{\"command\":\"git log --oneline -n 5\",\"output\":\"ade4a8d feat: add reasoning_format as explicit parameter to create_chat_completion methods\\n9c756d9 fix: correct docker run -e syntax in examples/README.md (#33)\\n\",\"exit_code\":0,\"duration\":\"4.37667ms\"}}","tool_call_id":"call_f1d3zk2u","timestamp":"2026-06-06T14:04:47.181702221Z"}
    {"role":"tool","content":"Result of tool call: {\"tool_name\":\"Bash\",\"arguments\":{\"command\":\"git status\"},\"success\":true,\"duration\":5614898,\"data\":{\"command\":\"git status\",\"output\":\"On branch feat/reasoning-format-parameter\\nnothing to commit, working tree clean\\n\",\"exit_code\":0,\"duration\":\"5.60921ms\"}}","tool_call_id":"call_5yf4gae9","timestamp":"2026-06-06T14:04:47.182495632Z"}
    {"role":"assistant","content":"","reasoning_content":"Everything is done. The PR was created and has already been merged. Let me update the todo list.","tool_calls":[{"function":{"arguments":"{\"todos\":[{\"content\":\"Read client.py to understand current method signatures\",\"id\":\"1\",\"status\":\"completed\"},{\"content\":\"Add reasoning_format parameter to create_chat_completion\",\"id\":\"2\",\"status\":\"completed\"},{\"content\":\"Add reasoning_format parameter to create_chat_completion_stream\",\"id\":\"3\",\"status\":\"completed\"},{\"content\":\"Verify changes are consistent and complete\",\"id\":\"4\",\"status\":\"completed\"},{\"content\":\"Commit, push, and create PR\",\"id\":\"5\",\"status\":\"completed\"}]}","name":"TodoWrite"},"id":"call_rwdatvjr","type":"function"}],"tools":["TodoWrite(todos=[map[content:Read client.py to understand current method si…)"],"token_usage":{"completion_tokens":195,"prompt_tokens":44761,"total_tokens":44956},"timestamp":"2026-06-06T14:04:57.194543865Z","request_id":"59627cd9-98fc-456e-a1ec-a8f26d99b245"}
    {"role":"tool","content":"Result of tool call: {\"tool_name\":\"TodoWrite\",\"arguments\":{\"todos\":[{\"content\":\"Read client.py to understand current method signatures\",\"id\":\"1\",\"status\":\"completed\"},{\"content\":\"Add reasoning_format parameter to create_chat_completion\",\"id\":\"2\",\"status\":\"completed\"},{\"content\":\"Add reasoning_format parameter to create_chat_completion_stream\",\"id\":\"3\",\"status\":\"completed\"},{\"content\":\"Verify changes are consistent and complete\",\"id\":\"4\",\"status\":\"completed\"},{\"content\":\"Commit, push, and create PR\",\"id\":\"5\",\"status\":\"completed\"}]},\"success\":true,\"duration\":4407,\"data\":{\"todos\":[{\"id\":\"1\",\"content\":\"Read client.py to understand current method signatures\",\"status\":\"completed\"},{\"id\":\"2\",\"content\":\"Add reasoning_format parameter to create_chat_completion\",\"status\":\"completed\"},{\"id\":\"3\",\"content\":\"Add reasoning_format parameter to create_chat_completion_stream\",\"status\":\"completed\"},{\"id\":\"4\",\"content\":\"Verify changes are consistent and complete\",\"status\":\"completed\"},{\"id\":\"5\",\"content\":\"Commit, push, and create PR\",\"status\":\"completed\"}],\"total_tasks\":5,\"completed_tasks\":5,\"validation_ok\":true}}","tool_call_id":"call_rwdatvjr","timestamp":"2026-06-06T14:04:57.194773249Z"}
    {"role":"assistant","content":"Issue resolved! Here's a summary of what was done:\n\n## Changes Made\n\n**File:** `inference_gateway/client.py`\n\n### `create_chat_completion` (line 238)\n- Added `reasoning_format: Optional[str] = None` as an explicit parameter after `tools`\n- Updated docstring with parameter description\n- Added `if reasoning_format is not None: request_data[\"reasoning_format\"] = reasoning_format` to propagate the value\n\n### `create_chat_completion_stream` (line 301)\n- Added `reasoning_format: Optional[str] = None` as an explicit parameter after `tools`\n- Updated docstring with parameter description\n- Added `if reasoning_format is not None: request_data[\"reasoning_format\"] = reasoning_format` to propagate the value\n\n### Verification\n- ✅ All 24 existing tests pass\n- ✅ Syntax is valid (confirmed via AST parsing)\n- ✅ The `reasoning_format` field already exists in the `CreateChatCompletionRequest` model (line 675 of `models.py`)\n\n### PR\n- **PR #34** was created and has already been merged: `feat: add reasoning_format as explicit parameter to create_chat_completion methods`","token_usage":{"completion_tokens":255,"prompt_tokens":45223,"total_tokens":45478},"timestamp":"2026-06-06T14:05:16.664585595Z","request_id":"63fda67e-30cc-4413-bd01-caa417fcd42b"}
    {"role":"assistant","content":"Let me check if the README is already consistent with the changes.","reasoning_content":"Let me review what the issue asked for and check if there's anything else to do.\n\nIssue #28 asked for:\n1. Add `reasoning_format: Optional[str] = None` as an explicit parameter to `create_chat_completion` - ✅ Done\n2. Add `reasoning_format: Optional[str] = None` as an explicit parameter to `create_chat_completion_stream` - ✅ Done\n3. Pass it through to the request data - ✅ Done\n\nThe issue locations mentioned:\n- `inference_gateway/client.py` lines 230-238 (create_chat_completion signature) - ✅ Done\n- `inference_gateway/client.py` lines 290-297 (create_chat_completion_stream signature) - ✅ Done\n- `README.md` lines 232-251 documents it as a direct parameter - Let me check if the README needs updating. The issue says the README already documents it as a direct parameter, meaning the docs are already correct. Let me verify.\n\nAlso, the maintainer skill mentions a \"Docs follow-up rule\" - every `feat:` or public-surface `refactor:` outside `inference-gateway/docs` needs a matching `[DOCS]` issue for `inference-gateway/docs`. This change adds a public parameter to the client methods, so it's a public-surface change. However, the README in this repo already documents `reasoning_format` as a direct parameter, so the docs in this repo are already correct. The maintainer skill says to create a docs issue for `inference-gateway/docs` - but that's a different repo. Let me check if this is needed.\n\nThe maintainer skill says:\n\"Every `feat:` or public-surface `refactor:` outside `inference-gateway/docs` needs a matching `[DOCS]` issue for `inference-gateway/docs`, created with the source PR rather than later.\"\n\nThis is a `feat:` commit that changes the public surface (adds an explicit parameter to public methods). So technically I should create a `[DOCS]` issue for `inference-gateway/docs` repo.\n\nBut wait - the skill also says:\n\"- Default to preparing a docs ticket draft: title, body, affected pages, and source PR/issue link.\n- Purely internal refactors may skip the docs issue only if the PR body states `no docs ticket: internal-only refactor`.\n- Do not file cross-repo issues automatically unless the user explicitly asks.\"\n\nThe last point says \"Do not file cross-repo issues automatically unless the user explicitly asks.\" So I should not automatically create a docs issue.\n\nLet me also check if the README in this repo needs updating. The issue says \"README.md lines 232-251 documents it as a direct parameter\" - so the README already documents `reasoning_format`. Let me check to confirm.","tool_calls":[{"function":{"arguments":"{\"-n\":true,\"-C\":5,\"output_mode\":\"content\",\"path\":\"/home/runner/work/python-sdk/python-sdk/README.md\",\"pattern\":\"reasoning_format\"}","name":"Grep"},"id":"call_k3o399wh","type":"function"}],"tools":["Grep(-C=5, -n=true, output_mode=content, path=/home/runner/work/python-sdk/python-sdk/README.md, pattern=reasoning_format)"],"token_usage":{"completion_tokens":743,"prompt_tokens":45514,"total_tokens":46257},"timestamp":"2026-06-06T14:05:36.472848648Z","request_id":"94fa5c78-4af4-4f85-8c2b-b3e855c9e100"}
    {"role":"tool","content":"Result of tool call: {\"tool_name\":\"Grep\",\"arguments\":{\"-C\":5,\"-n\":true,\"output_mode\":\"content\",\"path\":\"/home/runner/work/python-sdk/python-sdk/README.md\",\"pattern\":\"reasoning_format\"},\"success\":true,\"duration\":318288,\"data\":{\"pattern\":\"reasoning_format\",\"output_mode\":\"content\",\"matches\":[{\"file\":\"/home/runner/work/python-sdk/python-sdk/README.md\",\"line\":123,\"text\":\"\\u003e **Note:** Some models support reasoning capabilities. You can use the `reasoning_format` parameter to control how reasoning is provided in the response. The model's reasoning will be available in the `reasoning` or `reasoning_content` fields of the response message.\"},{\"file\":\"/home/runner/work/python-sdk/python-sdk/README.md\",\"line\":232,\"text\":\"You can enable reasoning capabilities by setting the `reasoning_format` parameter in your request:\"},{\"file\":\"/home/runner/work/python-sdk/python-sdk/README.md\",\"line\":245,\"text\":\"    reasoning_format=\\\"parsed\\\",  # \\\"raw\\\" or \\\"parsed\\\" - defaults to \\\"parsed\\\"\"}],\"total\":3,\"truncated\":false,\"duration\":\"316.825µs\"}}","tool_call_id":"call_k3o399wh","timestamp":"2026-06-06T14:05:36.47336996Z"}
    {"role":"assistant","content":"","reasoning_content":"The README already documents `reasoning_format` as a first-class parameter. Let me read the surrounding context to confirm it's accurate.","tool_calls":[{"function":{"arguments":"{\"file_path\":\"/home/runner/work/python-sdk/python-sdk/README.md\",\"offset\":225,\"limit\":35}","name":"Read"},"id":"call_jsupbrwb","type":"function"}],"tools":["Read(file_path=/home/runner/work/python-sdk/python-sdk/README.md, limit=35, offset=225)"],"token_usage":{"completion_tokens":118,"prompt_tokens":46537,"total_tokens":46655},"timestamp":"2026-06-06T14:05:44.311593051Z","request_id":"656fa0b3-b1a3-472a-baa8-bf494c67a45b"}
    {"role":"tool","content":"Result of tool call: {\"tool_name\":\"Read\",\"arguments\":{\"file_path\":\"/home/runner/work/python-sdk/python-sdk/README.md\",\"limit\":35,\"offset\":225},\"success\":true,\"duration\":100050,\"data\":{\"file_path\":\"/home/runner/work/python-sdk/python-sdk/README.md\",\"content\":\"   225\\t- `\\\"low\\\"`: Lower resolution, faster and cheaper\\n   226\\t- `\\\"high\\\"`: Higher resolution, better quality but more expensive\\n   227\\t\\n   228\\tFor a complete example, see the [chat example](examples/chat/).\\n   229\\t\\n   230\\t### Using ReasoningFormat\\n   231\\t\\n   232\\tYou can enable reasoning capabilities by setting the `reasoning_format` parameter in your request:\\n   233\\t\\n   234\\t```python\\n   235\\tfrom inference_gateway import InferenceGatewayClient, Message\\n   236\\t\\n   237\\tclient = InferenceGatewayClient(\\\"http://localhost:8080/v1\\\")\\n   238\\t\\n   239\\tresponse = client.create_chat_completion(\\n   240\\t    model=\\\"anthropic/claude-3-opus-20240229\\\",\\n   241\\t    messages=[\\n   242\\t        Message(role=\\\"system\\\", content=\\\"You are a helpful assistant. Please include your reasoning for complex questions.\\\"),\\n   243\\t        Message(role=\\\"user\\\", content=\\\"What is the square root of 144 and why?\\\"),\\n   244\\t    ],\\n   245\\t    reasoning_format=\\\"parsed\\\",  # \\\"raw\\\" or \\\"parsed\\\" - defaults to \\\"parsed\\\"\\n   246\\t)\\n   247\\t\\n   248\\tprint(\\\"Content:\\\", response.choices[0].message.content.root)\\n   249\\tif response.choices[0].message.reasoning:\\n   250\\t    print(\\\"Reasoning:\\\", response.choices[0].message.reasoning)\\n   251\\t```\\n   252\\t\\n   253\\t### Streaming Content\\n   254\\t\\n   255\\tTo generate content using streaming mode, use the `create_chat_completion_stream` method. It yields `SSEvent` objects:\\n   256\\t\\n   257\\t```python\\n   258\\timport json\\n   259\\tfrom pydantic import ValidationError\",\"size\":1450,\"start_line\":225,\"end_line\":259}}","tool_call_id":"call_jsupbrwb","timestamp":"2026-06-06T14:05:44.311895705Z"}
    {"role":"assistant","content":"The README already documents `reasoning_format` correctly as a direct parameter in the example at line 245. Let me check the examples directory too.","reasoning_content":"The README already correctly documents `reasoning_format` as a direct parameter in the example. The documentation is consistent with the code changes.\n\nNow let me check if there are any examples that might need updating.","tool_calls":[{"function":{"arguments":"{\"pattern\":\"reasoning_format\",\"path\":\"/home/runner/work/python-sdk/python-sdk/examples\",\"output_mode\":\"content\",\"-n\":true}","name":"Grep"},"id":"call_e3bmveci","type":"function"}],"tools":["Grep(-n=true, output_mode=content, path=/home/runner/work/python-sdk/python-sdk/examples, pattern=reasoning_format)"],"token_usage":{"completion_tokens":180,"prompt_tokens":47182,"total_tokens":47362},"timestamp":"2026-06-06T14:05:53.974816063Z","request_id":"9aebf1ab-8ee2-4dc5-b5d4-1ab145dc81a5"}
    {"role":"tool","content":"Result of tool call: {\"tool_name\":\"Grep\",\"arguments\":{\"-n\":true,\"output_mode\":\"content\",\"path\":\"/home/runner/work/python-sdk/python-sdk/examples\",\"pattern\":\"reasoning_format\"},\"success\":true,\"duration\":1576937,\"data\":{\"pattern\":\"reasoning_format\",\"output_mode\":\"content\",\"total\":0,\"truncated\":false,\"duration\":\"1.575816ms\"}}","tool_call_id":"call_e3bmveci","timestamp":"2026-06-06T14:05:53.976574743Z"}
    {"role":"assistant","content":"Everything is already in order - the task is fully complete. Here's the final summary:\n\n### ✅ All work complete\n\n**Code changes in `inference_gateway/client.py`:**\n- **`create_chat_completion`** — Added `reasoning_format: Optional[str] = None` as an explicit parameter (line 238), documented in docstring, propagated to request data\n- **`create_chat_completion_stream`** — Added `reasoning_format: Optional[str] = None` as an explicit parameter (line 301), documented in docstring, propagated to request data\n\n**Verification:**\n- ✅ All 24 existing tests pass\n- ✅ Syntax valid (confirmed via AST)\n- ✅ The `reasoning_format` field already exists in `CreateChatCompletionRequest` model — no model changes needed\n- ✅ **README** already documents `reasoning_format` as a direct parameter (line 245 example) — no doc changes needed in this repo\n- ✅ **PR #34** was created and merged: `feat: add reasoning_format as explicit parameter to create_chat_completion methods`\n- ✅ Working tree is clean\n\nThe feature request from #28 is fully resolved.","reasoning_content":"Let me check if the PR title (from the git log) actually matches what we want, and check if there are any remaining things. Let me also re-read the issue one more time.\n\nThe issue:\n1. ✅ Added `reasoning_format: Optional[str] = None` as explicit parameter to `create_chat_completion`\n2. ✅ Added `reasoning_format: Optional[str] = None` as explicit parameter to `create_chat_completion_stream`\n3. ✅ Passed it through to request data in both methods\n4. ✅ PR created and merged\n\nThe README already correctly documents the parameter. No examples in `examples/` mention `reasoning_format` explicitly, but that's fine - the README example is sufficient.\n\nThe maintainer skill's docs follow-up rule says:\n\"Every `feat:` or public-surface `refactor:` outside `inference-gateway/docs` needs a matching `[DOCS]` issue for `inference-gateway/docs`, created with the source PR rather than later.\"\n\nBut it also says \"Do not file cross-repo issues automatically unless the user explicitly asks.\"\n\nSince the user hasn't explicitly asked me to create docs issues in another repo, I should not do so.\n\nI think everything is complete. The task is done:\n- The code change is complete\n- Tests pass\n- PR was created and merged\n- README is already consistent\n\nNothing else needs to be done.","token_usage":{"completion_tokens":549,"prompt_tokens":47557,"total_tokens":48106},"timestamp":"2026-06-06T14:06:06.394759415Z","request_id":"7c9a305b-500b-4d83-835e-d965f2fb4dad"}
    {"completion_tokens":9947,"cost":{"currency":"USD","input":0,"output":0,"total":0},"message":"Session complete","model":"ollama_cloud/deepseek-v4-flash","prompt_tokens":1553936,"requests":50,"timestamp":"2026-06-06T14:06:06.394913517Z","total_tokens":1563883,"type":"session_stats"}
    
    

    Triggered by edenreich · Infer Action

  5. moved this from Todo to Done in 2026on Jun 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions