mirror of
https://github.com/openai/codex.git
synced 2026-05-04 13:21:54 +03:00
2026-03-12 Switch the repo-source Python SDK real coverage over to a pinned runtime-package flow backed by GitHub release artifacts instead of PATH or explicit binary overrides. - add sdk/python/_runtime_setup.py to download the release codex archive for a requested CODEX_PYTHON_RUNTIME_VERSION, stage a temporary codex-cli-bin package, and install it into a target Python environment with cleanup - refactor real integration tests to run repo-source SDK code against an isolated site-packages target that contains the staged codex-cli-bin runtime - update examples and notebook bootstrap to install and use the runtime package, and stop consulting CODEX_PYTHON_SDK_CODEX_BIN or PATH - switch the failing turn-run and model-selection examples to runtime-compatible model selection for the pinned release binary - keep the main SDK runtime resolution model unchanged: explicit codex_bin or installed codex-cli-bin Validation: - python3 -m pytest sdk/python/tests - RUN_REAL_CODEX_TESTS=1 CODEX_PYTHON_RUNTIME_VERSION=0.115.0-alpha.11 python3 -m pytest sdk/python/tests/test_real_app_server_integration.py Co-authored-by: Codex <noreply@openai.com>
29 lines
978 B
Python
29 lines
978 B
Python
import sys
|
|
from pathlib import Path
|
|
|
|
_EXAMPLES_ROOT = Path(__file__).resolve().parents[1]
|
|
if str(_EXAMPLES_ROOT) not in sys.path:
|
|
sys.path.insert(0, str(_EXAMPLES_ROOT))
|
|
|
|
from _bootstrap import ensure_local_sdk_src, runtime_config
|
|
|
|
ensure_local_sdk_src()
|
|
|
|
from codex_app_server import Codex, TextInput
|
|
|
|
with Codex(config=runtime_config()) as codex:
|
|
thread = codex.thread_start(model="gpt-5.4", config={"model_reasoning_effort": "high"})
|
|
result = thread.turn(TextInput("Give 3 bullets about SIMD.")).run()
|
|
|
|
print("thread_id:", result.thread_id)
|
|
print("turn_id:", result.turn_id)
|
|
print("status:", result.status)
|
|
if result.error is not None:
|
|
print("error:", result.error)
|
|
print("text:", result.text)
|
|
print("items.count:", len(result.items))
|
|
if result.usage is None:
|
|
raise RuntimeError("missing usage for completed turn")
|
|
print("usage.thread_id:", result.usage.thread_id)
|
|
print("usage.turn_id:", result.usage.turn_id)
|