feat!: Full code can now be generated by an external model and shared with the AI tool (Claude Code / Codex etc)!

model definitions now support a new `allow_code_generation` flag, only to be used with higher reasoning models such as GPT-5-Pro and-Gemini 2.5-Pro

 When `true`, the `chat` tool can now request the external model to generate a full implementation / update / instructions etc and then share the implementation with the calling agent.

 This effectively allows us to utilize more powerful models such as GPT-5-Pro to generate code for us or entire implementations (which are either API-only or part of the $200 Pro plan from within the ChatGPT app)
This commit is contained in:
Fahad
2025-10-07 18:49:13 +04:00
parent 04f7ce5b03
commit ece8a5ebed
29 changed files with 1008 additions and 122 deletions

View File

@@ -4,6 +4,8 @@ Test per-tool model default selection functionality
import json
import os
import shutil
import tempfile
from unittest.mock import MagicMock, patch
import pytest
@@ -290,7 +292,13 @@ class TestAutoModeErrorMessages:
mock_get_provider_for.return_value = None
tool = ChatTool()
result = await tool.execute({"prompt": "test", "model": "auto"})
temp_dir = tempfile.mkdtemp()
try:
result = await tool.execute(
{"prompt": "test", "model": "auto", "working_directory": temp_dir}
)
finally:
shutil.rmtree(temp_dir, ignore_errors=True)
assert len(result) == 1
# The SimpleTool will wrap the error message
@@ -418,7 +426,13 @@ class TestRuntimeModelSelection:
mock_get_provider.return_value = None
tool = ChatTool()
result = await tool.execute({"prompt": "test", "model": "gpt-5-turbo"})
temp_dir = tempfile.mkdtemp()
try:
result = await tool.execute(
{"prompt": "test", "model": "gpt-5-turbo", "working_directory": temp_dir}
)
finally:
shutil.rmtree(temp_dir, ignore_errors=True)
# Should require model selection
assert len(result) == 1
@@ -515,7 +529,11 @@ class TestUnavailableModelFallback:
mock_get_model_provider.return_value = mock_provider
tool = ChatTool()
result = await tool.execute({"prompt": "test"}) # No model specified
temp_dir = tempfile.mkdtemp()
try:
result = await tool.execute({"prompt": "test", "working_directory": temp_dir})
finally:
shutil.rmtree(temp_dir, ignore_errors=True)
# Should work normally, not require model parameter
assert len(result) == 1