codex-ai 0.2.4__tar.gz → 0.2.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- codex_ai-0.2.6/.agents/rules/graphify.md +9 -0
- codex_ai-0.2.6/.agents/skills/codex-ai-development/SKILL.md +14 -0
- codex_ai-0.2.6/.agents/skills/codex-ai-development/references/architecture.md +10 -0
- codex_ai-0.2.6/AGENTS.md +13 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/CHANGELOG.md +31 -0
- codex_ai-0.2.6/CLAUDE.md +9 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/PKG-INFO +58 -10
- {codex_ai-0.2.4 → codex_ai-0.2.6}/README.md +52 -4
- codex_ai-0.2.6/docs/en/agent-skill.md +31 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/docs/en/architecture/providers/README.md +18 -4
- {codex_ai-0.2.4 → codex_ai-0.2.6}/docs/en/architecture/providers/data_flow.md +35 -2
- codex_ai-0.2.6/docs/ru/agent-skill.md +31 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/docs/ru/architecture/providers/README.md +18 -4
- {codex_ai-0.2.4 → codex_ai-0.2.6}/docs/ru/architecture/providers/data_flow.md +35 -2
- {codex_ai-0.2.4 → codex_ai-0.2.6}/mkdocs.yml +2 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/pyproject.toml +2 -2
- {codex_ai-0.2.4 → codex_ai-0.2.6}/src/codex_ai/__init__.py +4 -0
- codex_ai-0.2.6/src/codex_ai/agent_skills/__init__.py +1 -0
- codex_ai-0.2.6/src/codex_ai/agent_skills/__main__.py +4 -0
- codex_ai-0.2.6/src/codex_ai/agent_skills/cli.py +39 -0
- codex_ai-0.2.6/src/codex_ai/agent_skills/fs_transaction.py +174 -0
- codex_ai-0.2.6/src/codex_ai/agent_skills/manifest_rules.py +153 -0
- codex_ai-0.2.6/src/codex_ai/agent_skills/orchestrator.py +228 -0
- codex_ai-0.2.6/src/codex_ai/agent_skills/resources/SKILL.md +14 -0
- codex_ai-0.2.6/src/codex_ai/agent_skills/resources/__init__.py +1 -0
- codex_ai-0.2.6/src/codex_ai/agent_skills/resources/references/installation.md +7 -0
- codex_ai-0.2.6/src/codex_ai/agent_skills/resources/references/legacy-router.md +19 -0
- codex_ai-0.2.6/src/codex_ai/agent_skills/resources/references/providers.md +35 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/src/codex_ai/core/__init__.py +4 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/src/codex_ai/core/dispatcher.py +3 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/src/codex_ai/core/protocol.py +22 -1
- {codex_ai-0.2.4 → codex_ai-0.2.6}/src/codex_ai/providers/__init__.py +1 -1
- {codex_ai-0.2.4 → codex_ai-0.2.6}/src/codex_ai/providers/gemini.py +41 -5
- codex_ai-0.2.6/src/codex_ai/providers/openai.py +265 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/tests/integration/test_providers_integration.py +3 -3
- codex_ai-0.2.6/tests/unit/agent_skills/test_installer.py +240 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/tests/unit/core/test_dispatcher.py +12 -3
- {codex_ai-0.2.4 → codex_ai-0.2.6}/tests/unit/core/test_protocol.py +9 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/tests/unit/providers/test_gemini_provider.py +29 -0
- codex_ai-0.2.6/tests/unit/providers/test_openai_provider.py +272 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/tests/unit/test_public_api.py +1 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/uv.lock +171 -132
- codex_ai-0.2.4/src/codex_ai/providers/openai.py +0 -138
- codex_ai-0.2.4/tests/unit/providers/test_openai_provider.py +0 -283
- {codex_ai-0.2.4 → codex_ai-0.2.6}/.github/workflows/ci.yml +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/.github/workflows/docs.yml +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/.github/workflows/publish.yml +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/.gitignore +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/.nojekyll +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/.pre-commit-config.yaml +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/.python-version +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/.secrets.baseline +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/LICENSE +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/docs/changelog.md +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/docs/en/api/core/dispatcher.md +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/docs/en/api/core/exceptions.md +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/docs/en/api/core/protocol.md +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/docs/en/api/core/router.md +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/docs/en/api/core/sync.md +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/docs/en/api/index.md +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/docs/en/api/providers/gemini.md +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/docs/en/api/providers/openai.md +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/docs/en/architecture/core/README.md +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/docs/en/architecture/core/data_flow.md +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/docs/index.md +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/docs/ru/architecture/core/README.md +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/docs/ru/architecture/core/data_flow.md +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/docs/stylesheets/extra.css +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/src/codex_ai/core/exceptions.py +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/src/codex_ai/core/router.py +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/src/codex_ai/core/sync.py +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/src/codex_ai/py.typed +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/tests/conftest.py +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/tests/integration/__init__.py +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/tests/integration/conftest.py +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/tests/unit/__init__.py +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/tests/unit/conftest.py +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/tests/unit/core/__init__.py +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/tests/unit/core/test_exceptions.py +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/tests/unit/core/test_router.py +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/tests/unit/core/test_sync.py +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/tests/unit/providers/__init__.py +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/tools/__init__.py +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/tools/dev/README.md +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/tools/dev/__init__.py +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/tools/dev/check.py +0 -0
- {codex_ai-0.2.4 → codex_ai-0.2.6}/tools/dev/generate_project_tree.py +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
## graphify
|
|
2
|
+
|
|
3
|
+
This component is part of a larger project. It uses a global knowledge graph located at the workspace root (`../graphify-out/`).
|
|
4
|
+
|
|
5
|
+
Rules:
|
|
6
|
+
- Before answering architecture or codebase questions, read the global report at **`../graphify-out/GRAPH_REPORT.md`** for god nodes and community structure.
|
|
7
|
+
- If `../graphify-out/wiki/index.md` exists, navigate it instead of reading raw files.
|
|
8
|
+
- For cross-module questions, prefer `graphify query`, `graphify path`, or `graphify explain` (run from root or via MCP) over grep.
|
|
9
|
+
- After modifying code files in this session, run `graphify update .` from the **workspace root** to keep the global graph current.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codex-ai-development
|
|
3
|
+
description: Maintain this repository's provider contracts, tests, package guidance, and offline consumer skill delivery.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# codex-ai development
|
|
7
|
+
|
|
8
|
+
This repository publishes `codex-ai`, a Gemini-first Python library with an OpenAI Responses adapter. Read [references/architecture.md](references/architecture.md) when changing provider behavior or shared contracts. For external application usage, use the packaged `codex-ai` consumer skill under `src/codex_ai/agent_skills/resources/`; keep application-specific rules out of that package.
|
|
9
|
+
|
|
10
|
+
Before architecture or cross-module changes, follow the graphify rules in the repository `AGENTS.md`, including the workspace graph report and update after code changes. Keep the public exports in `src/codex_ai/__init__.py` and provider protocols in `src/codex_ai/core/protocol.py` aligned with implementation. Preserve the documented legacy text router unless a task explicitly changes that contract.
|
|
11
|
+
|
|
12
|
+
Use the relevant optional extra when verifying a provider. Run focused unit tests for changed behavior and the applicable quality checks. Integration tests can require API credentials; do not inspect or expose local secrets. For changes to packaged skill delivery, verify a built wheel and install/update/status/delete in an isolated project.
|
|
13
|
+
|
|
14
|
+
The repository source skill is authored here; any installed consumer copy and its manifest belong to the installer. Keep source and installed ownership separate. Typical checks from the repository root are `python -m pytest tests/unit -q`, `python -m ruff check src tests`, and `python -m mypy src`. Verify package artifact contents when changing delivery; inspect failures rather than accepting a silent test run.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Source map and contracts
|
|
2
|
+
|
|
3
|
+
- `src/codex_ai/providers/gemini.py` implements direct Gemini text, structured JSON, Gemini image generation, and separate Imagen generation. Image edits accept `ImageInput` values.
|
|
4
|
+
- `src/codex_ai/providers/openai.py` implements OpenAI Responses text, JSON, and streaming. It does not expose an image-generation method.
|
|
5
|
+
- `src/codex_ai/core/protocol.py` defines shared DTOs and runtime-checkable provider capabilities; `core/exceptions.py` defines provider errors.
|
|
6
|
+
- `src/codex_ai/core/router.py` registers prompt builders. `core/dispatcher.py` handles the legacy `process()` flow and delegates supported direct calls. `core/sync.py` wraps that flow for synchronous callers.
|
|
7
|
+
- `src/codex_ai/__init__.py` lazily loads providers so optional SDK dependencies remain optional.
|
|
8
|
+
- `src/codex_ai/agent_skills/` owns the optional offline consumer installer and packaged skill. It must touch only its managed destination and marked `AGENTS.md` block, preserve unrelated content, and reject modified managed files or unsafe paths.
|
|
9
|
+
|
|
10
|
+
When provider behavior changes, test the direct public call and error path. When a public signature or capability changes, update README, library skill examples, and public exports or protocols as needed. Do not use live provider calls in unit tests.
|
codex_ai-0.2.6/AGENTS.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
## graphify
|
|
2
|
+
|
|
3
|
+
This component is part of a larger project. It uses a global knowledge graph located at the workspace root (`../graphify-out/`).
|
|
4
|
+
|
|
5
|
+
Rules:
|
|
6
|
+
- Before answering architecture or codebase questions, read the global report at **`../graphify-out/GRAPH_REPORT.md`** for god nodes and community structure.
|
|
7
|
+
- If `../graphify-out/wiki/index.md` exists, navigate it instead of reading raw files.
|
|
8
|
+
- For cross-module questions, prefer `graphify query`, `graphify path`, or `graphify explain` (run from root or via MCP) over grep.
|
|
9
|
+
- After modifying code files in this session, run `graphify update .` from the **workspace root** to keep the global graph current.
|
|
10
|
+
|
|
11
|
+
## Project skill
|
|
12
|
+
|
|
13
|
+
For codex-ai repository development, use [.agents/skills/codex-ai-development/SKILL.md](.agents/skills/codex-ai-development/SKILL.md). Keep the graphify rules above in force.
|
|
@@ -4,6 +4,37 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.2.6] - 2026-10-09
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- Added a project development skill and an optional packaged consumer skill for `codex-ai` integrations.
|
|
12
|
+
- Added an offline `python -m codex_ai.agent_skills` installer with install, update, status, and delete commands, ownership checks, path validation, and rollback for ordinary I/O failures.
|
|
13
|
+
- Added English and Russian guides for installing and maintaining the optional agent skill.
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- Widened the supported `codex-core` range to include the additive `0.5.x` agent-skill release.
|
|
18
|
+
- Refreshed the development and documentation lockfile to use patched versions of AnyIO, cryptography, pip, pyasn1, urllib3, virtualenv, Material for MkDocs, and PyMdown Extensions.
|
|
19
|
+
|
|
20
|
+
## [0.2.5] - 2026-07-19
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
- Added `ImageInput` and optional `input_images` support to Gemini `generate_image_bytes()` for image reference/edit workflows.
|
|
24
|
+
- Added OpenAI structured output generation through `generate_json()` with native Pydantic parsing.
|
|
25
|
+
- Added typed OpenAI Responses API text streaming through `stream_text()`.
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
- Replaced the OpenAI Chat Completions implementation with the Responses API.
|
|
29
|
+
- Updated the OpenAI SDK requirement to `openai>=2.0,<3.0`.
|
|
30
|
+
- Changed the OpenAI default model to `gpt-5.6-luna` with `reasoning={"effort": "none"}` and `store=False` defaults.
|
|
31
|
+
|
|
32
|
+
## [0.2.4] - 2026-05-21
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
- Widened the supported `codex-core` range to include the `0.4.x` series.
|
|
36
|
+
- Clarified the Gemini-first provider focus in the package documentation.
|
|
37
|
+
|
|
7
38
|
## [0.2.3] - 2026-05-17
|
|
8
39
|
|
|
9
40
|
### Added
|
codex_ai-0.2.6/CLAUDE.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
## graphify
|
|
2
|
+
|
|
3
|
+
This component is part of a larger project. It uses a global knowledge graph located at the workspace root (`../graphify-out/`).
|
|
4
|
+
|
|
5
|
+
Rules:
|
|
6
|
+
- Before answering architecture or codebase questions, read the global report at **`../graphify-out/GRAPH_REPORT.md`** for god nodes and community structure.
|
|
7
|
+
- If `../graphify-out/wiki/index.md` exists, navigate it instead of reading raw files.
|
|
8
|
+
- For cross-module questions, prefer `graphify query`, `graphify path`, or `graphify explain` (run from root or via MCP) over grep.
|
|
9
|
+
- After modifying code files in this session, run `graphify update .` from the **workspace root** to keep the global graph current.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: codex-ai
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.6
|
|
4
4
|
Summary: Gemini-first and OpenAI provider helpers for Codex
|
|
5
5
|
Project-URL: Homepage, https://github.com/codexdlc/codex-ai
|
|
6
6
|
Project-URL: Documentation, https://codexdlc.github.io/codex-ai/
|
|
@@ -16,17 +16,17 @@ Classifier: License :: OSI Approved :: Apache Software License
|
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.12
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.13
|
|
18
18
|
Requires-Python: >=3.12
|
|
19
|
-
Requires-Dist: codex-core<0.
|
|
19
|
+
Requires-Dist: codex-core<0.6.0,>=0.2.2
|
|
20
20
|
Requires-Dist: pydantic<3.0,>=2.0
|
|
21
21
|
Provides-Extra: all
|
|
22
22
|
Requires-Dist: google-genai==2.3.0; extra == 'all'
|
|
23
|
-
Requires-Dist: openai<
|
|
23
|
+
Requires-Dist: openai<3.0,>=2.0; extra == 'all'
|
|
24
24
|
Provides-Extra: dev
|
|
25
25
|
Requires-Dist: bandit>=1.7; extra == 'dev'
|
|
26
26
|
Requires-Dist: detect-secrets>=1.5; extra == 'dev'
|
|
27
27
|
Requires-Dist: google-genai==2.3.0; extra == 'dev'
|
|
28
28
|
Requires-Dist: mypy>=1.10; extra == 'dev'
|
|
29
|
-
Requires-Dist: openai<
|
|
29
|
+
Requires-Dist: openai<3.0,>=2.0; extra == 'dev'
|
|
30
30
|
Requires-Dist: pip-audit>=2.7; extra == 'dev'
|
|
31
31
|
Requires-Dist: pre-commit>=3.0; extra == 'dev'
|
|
32
32
|
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
|
|
@@ -42,7 +42,7 @@ Requires-Dist: mkdocstrings[python]>=0.24; extra == 'docs'
|
|
|
42
42
|
Provides-Extra: gemini
|
|
43
43
|
Requires-Dist: google-genai==2.3.0; extra == 'gemini'
|
|
44
44
|
Provides-Extra: openai
|
|
45
|
-
Requires-Dist: openai<
|
|
45
|
+
Requires-Dist: openai<3.0,>=2.0; extra == 'openai'
|
|
46
46
|
Description-Content-Type: text/markdown
|
|
47
47
|
|
|
48
48
|
# codex-ai <!-- Type: LANDING -->
|
|
@@ -52,7 +52,7 @@ Description-Content-Type: text/markdown
|
|
|
52
52
|
[](https://github.com/codexdlc/codex-ai/actions/workflows/ci.yml)
|
|
53
53
|
[](https://github.com/codexdlc/codex-ai/blob/main/LICENSE)
|
|
54
54
|
|
|
55
|
-
Gemini-first API helpers for the Codex ecosystem. The active surface is direct Gemini text, JSON, Gemini image, and Imagen generation. OpenAI
|
|
55
|
+
Gemini-first API helpers for the Codex ecosystem. The active surface is direct Gemini text, JSON, Gemini image, and Imagen generation. OpenAI provides modern Responses API text, structured JSON, and streaming helpers. The router/dispatcher layer is kept for legacy text workflows.
|
|
56
56
|
|
|
57
57
|
## Install
|
|
58
58
|
|
|
@@ -65,12 +65,24 @@ pip install "codex-ai[openai,gemini]"
|
|
|
65
65
|
|
|
66
66
|
Requires Python 3.12 or newer.
|
|
67
67
|
|
|
68
|
+
## Optional agent skill
|
|
69
|
+
|
|
70
|
+
Starting with version 0.2.6, the package includes an offline guide for agents integrating `codex-ai` into another project. Installing the Python package alone does not change that project's files. Install the guide explicitly:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
python -m codex_ai.agent_skills install --project /path/to/project
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
The installer manages `.agents/skills/codex-ai/` and a marked instruction block in the target project's `AGENTS.md`. It preserves unrelated content and refuses to overwrite local changes to managed files. See the [agent skill installation guide](https://codexdlc.github.io/codex-ai/latest/en/agent-skill/) for status, package upgrades, updates, deletion, and Windows examples. The installer itself needs no provider SDK extra.
|
|
77
|
+
|
|
68
78
|
## Gemini Direct API
|
|
69
79
|
|
|
70
80
|
```python
|
|
81
|
+
from pathlib import Path
|
|
82
|
+
|
|
71
83
|
from pydantic import BaseModel
|
|
72
84
|
|
|
73
|
-
from codex_ai import GeminiProvider
|
|
85
|
+
from codex_ai import GeminiProvider, ImageInput
|
|
74
86
|
|
|
75
87
|
|
|
76
88
|
class LootItem(BaseModel):
|
|
@@ -89,6 +101,13 @@ image_bytes, content_type = await gemini.generate_image_bytes(
|
|
|
89
101
|
image_config={"aspect_ratio": "1:1", "image_size": "4K"},
|
|
90
102
|
)
|
|
91
103
|
|
|
104
|
+
source_image_bytes = Path("source.png").read_bytes()
|
|
105
|
+
edited_bytes, edited_content_type = await gemini.generate_image_bytes(
|
|
106
|
+
"Keep the composition, but redraw it as a watercolor map.",
|
|
107
|
+
response_mime_type="image/png",
|
|
108
|
+
input_images=[ImageInput(data=source_image_bytes, mime_type="image/png")],
|
|
109
|
+
)
|
|
110
|
+
|
|
92
111
|
imagen_bytes, imagen_content_type = await gemini.generate_imagen_bytes(
|
|
93
112
|
"A fantasy clan banner, game icon style.",
|
|
94
113
|
response_mime_type="image/jpeg",
|
|
@@ -101,10 +120,39 @@ imagen_bytes, imagen_content_type = await gemini.generate_imagen_bytes(
|
|
|
101
120
|
`response_mime_type` as a preferred/fallback MIME type. It does not pass image MIME values
|
|
102
121
|
to Gemini's text `response_mime_type` config field. Pass Gemini image controls such as
|
|
103
122
|
`aspect_ratio` and `image_size` with `image_config`; if a `4K` request is rejected,
|
|
104
|
-
the Gemini provider retries once with `2K`.
|
|
123
|
+
the Gemini provider retries once with `2K`. Pass `input_images` with `ImageInput`
|
|
124
|
+
items to provide reference/edit-source images for Gemini image models. Use `generate_imagen_bytes()` for
|
|
105
125
|
Imagen models; that path uses `generate_images` and passes the requested MIME as
|
|
106
126
|
`output_mime_type`.
|
|
107
127
|
|
|
128
|
+
## OpenAI Responses API
|
|
129
|
+
|
|
130
|
+
```python
|
|
131
|
+
from pydantic import BaseModel
|
|
132
|
+
|
|
133
|
+
from codex_ai import OpenAIProvider
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
class LootItem(BaseModel):
|
|
137
|
+
name: str
|
|
138
|
+
power: int
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
openai = OpenAIProvider(api_key="sk-...")
|
|
142
|
+
|
|
143
|
+
text = await openai.generate_text("Write one short tavern rumor.")
|
|
144
|
+
loot = await openai.generate_json("Create one loot item.", schema=LootItem)
|
|
145
|
+
|
|
146
|
+
async for chunk in openai.stream_text("Tell a short story."):
|
|
147
|
+
print(chunk, end="")
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
The OpenAI provider uses the Responses API and the `openai` 2.x SDK. Responses
|
|
151
|
+
are not stored by default. Its default `gpt-5.6-luna` model uses
|
|
152
|
+
`reasoning={"effort": "none"}` to retain a cost- and latency-sensitive role;
|
|
153
|
+
override the model and reasoning options per request when a workload needs more
|
|
154
|
+
capability.
|
|
155
|
+
|
|
108
156
|
## Legacy Text Router
|
|
109
157
|
|
|
110
158
|
```python
|
|
@@ -136,7 +184,7 @@ New Gemini integrations should call `generate_text()`, `generate_json()`,
|
|
|
136
184
|
| Module | Extra | Description |
|
|
137
185
|
| :--- | :--- | :--- |
|
|
138
186
|
| `codex_ai.providers.gemini` | `[gemini]` | Primary API: Gemini text, JSON, Gemini image, and Imagen generation via pinned `google-genai` |
|
|
139
|
-
| `codex_ai.providers.openai` | `[openai]` |
|
|
187
|
+
| `codex_ai.providers.openai` | `[openai]` | OpenAI Responses API text, structured JSON, and streaming adapter |
|
|
140
188
|
| `codex_ai.core` | - | Legacy text router/dispatcher contracts and shared provider exceptions |
|
|
141
189
|
|
|
142
190
|
## Development
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
[](https://github.com/codexdlc/codex-ai/actions/workflows/ci.yml)
|
|
6
6
|
[](https://github.com/codexdlc/codex-ai/blob/main/LICENSE)
|
|
7
7
|
|
|
8
|
-
Gemini-first API helpers for the Codex ecosystem. The active surface is direct Gemini text, JSON, Gemini image, and Imagen generation. OpenAI
|
|
8
|
+
Gemini-first API helpers for the Codex ecosystem. The active surface is direct Gemini text, JSON, Gemini image, and Imagen generation. OpenAI provides modern Responses API text, structured JSON, and streaming helpers. The router/dispatcher layer is kept for legacy text workflows.
|
|
9
9
|
|
|
10
10
|
## Install
|
|
11
11
|
|
|
@@ -18,12 +18,24 @@ pip install "codex-ai[openai,gemini]"
|
|
|
18
18
|
|
|
19
19
|
Requires Python 3.12 or newer.
|
|
20
20
|
|
|
21
|
+
## Optional agent skill
|
|
22
|
+
|
|
23
|
+
Starting with version 0.2.6, the package includes an offline guide for agents integrating `codex-ai` into another project. Installing the Python package alone does not change that project's files. Install the guide explicitly:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
python -m codex_ai.agent_skills install --project /path/to/project
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The installer manages `.agents/skills/codex-ai/` and a marked instruction block in the target project's `AGENTS.md`. It preserves unrelated content and refuses to overwrite local changes to managed files. See the [agent skill installation guide](https://codexdlc.github.io/codex-ai/latest/en/agent-skill/) for status, package upgrades, updates, deletion, and Windows examples. The installer itself needs no provider SDK extra.
|
|
30
|
+
|
|
21
31
|
## Gemini Direct API
|
|
22
32
|
|
|
23
33
|
```python
|
|
34
|
+
from pathlib import Path
|
|
35
|
+
|
|
24
36
|
from pydantic import BaseModel
|
|
25
37
|
|
|
26
|
-
from codex_ai import GeminiProvider
|
|
38
|
+
from codex_ai import GeminiProvider, ImageInput
|
|
27
39
|
|
|
28
40
|
|
|
29
41
|
class LootItem(BaseModel):
|
|
@@ -42,6 +54,13 @@ image_bytes, content_type = await gemini.generate_image_bytes(
|
|
|
42
54
|
image_config={"aspect_ratio": "1:1", "image_size": "4K"},
|
|
43
55
|
)
|
|
44
56
|
|
|
57
|
+
source_image_bytes = Path("source.png").read_bytes()
|
|
58
|
+
edited_bytes, edited_content_type = await gemini.generate_image_bytes(
|
|
59
|
+
"Keep the composition, but redraw it as a watercolor map.",
|
|
60
|
+
response_mime_type="image/png",
|
|
61
|
+
input_images=[ImageInput(data=source_image_bytes, mime_type="image/png")],
|
|
62
|
+
)
|
|
63
|
+
|
|
45
64
|
imagen_bytes, imagen_content_type = await gemini.generate_imagen_bytes(
|
|
46
65
|
"A fantasy clan banner, game icon style.",
|
|
47
66
|
response_mime_type="image/jpeg",
|
|
@@ -54,10 +73,39 @@ imagen_bytes, imagen_content_type = await gemini.generate_imagen_bytes(
|
|
|
54
73
|
`response_mime_type` as a preferred/fallback MIME type. It does not pass image MIME values
|
|
55
74
|
to Gemini's text `response_mime_type` config field. Pass Gemini image controls such as
|
|
56
75
|
`aspect_ratio` and `image_size` with `image_config`; if a `4K` request is rejected,
|
|
57
|
-
the Gemini provider retries once with `2K`.
|
|
76
|
+
the Gemini provider retries once with `2K`. Pass `input_images` with `ImageInput`
|
|
77
|
+
items to provide reference/edit-source images for Gemini image models. Use `generate_imagen_bytes()` for
|
|
58
78
|
Imagen models; that path uses `generate_images` and passes the requested MIME as
|
|
59
79
|
`output_mime_type`.
|
|
60
80
|
|
|
81
|
+
## OpenAI Responses API
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
from pydantic import BaseModel
|
|
85
|
+
|
|
86
|
+
from codex_ai import OpenAIProvider
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
class LootItem(BaseModel):
|
|
90
|
+
name: str
|
|
91
|
+
power: int
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
openai = OpenAIProvider(api_key="sk-...")
|
|
95
|
+
|
|
96
|
+
text = await openai.generate_text("Write one short tavern rumor.")
|
|
97
|
+
loot = await openai.generate_json("Create one loot item.", schema=LootItem)
|
|
98
|
+
|
|
99
|
+
async for chunk in openai.stream_text("Tell a short story."):
|
|
100
|
+
print(chunk, end="")
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The OpenAI provider uses the Responses API and the `openai` 2.x SDK. Responses
|
|
104
|
+
are not stored by default. Its default `gpt-5.6-luna` model uses
|
|
105
|
+
`reasoning={"effort": "none"}` to retain a cost- and latency-sensitive role;
|
|
106
|
+
override the model and reasoning options per request when a workload needs more
|
|
107
|
+
capability.
|
|
108
|
+
|
|
61
109
|
## Legacy Text Router
|
|
62
110
|
|
|
63
111
|
```python
|
|
@@ -89,7 +137,7 @@ New Gemini integrations should call `generate_text()`, `generate_json()`,
|
|
|
89
137
|
| Module | Extra | Description |
|
|
90
138
|
| :--- | :--- | :--- |
|
|
91
139
|
| `codex_ai.providers.gemini` | `[gemini]` | Primary API: Gemini text, JSON, Gemini image, and Imagen generation via pinned `google-genai` |
|
|
92
|
-
| `codex_ai.providers.openai` | `[openai]` |
|
|
140
|
+
| `codex_ai.providers.openai` | `[openai]` | OpenAI Responses API text, structured JSON, and streaming adapter |
|
|
93
141
|
| `codex_ai.core` | - | Legacy text router/dispatcher contracts and shared provider exceptions |
|
|
94
142
|
|
|
95
143
|
## Development
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Agent skill installation
|
|
2
|
+
|
|
3
|
+
`codex-ai` 0.2.6 and newer ships an optional, offline usage guide for coding agents working in a consumer project. Installing the Python package does not write to that project. Run the installer only when you want its project-level skill:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
python -m codex_ai.agent_skills install --project /path/to/project
|
|
7
|
+
python -m codex_ai.agent_skills status --project /path/to/project
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
On Windows PowerShell, quote a path containing spaces, for example `--project "D:\My Projects\game"`. Run the command with the Python environment where `codex-ai` is installed. The installer works offline and does not need the `[gemini]` or `[openai]` SDK extras. Install the relevant extra separately before using a provider.
|
|
11
|
+
|
|
12
|
+
The installer creates `.agents/skills/codex-ai/` under the target project and adds one marked instruction block to its `AGENTS.md`. It records the package version and SHA-256 hashes of the files it owns in `.agents/skills/codex-ai/.manifest.json`. Existing instructions and unrelated files are preserved. The installed skill and manifest are managed content; put application-specific guidance in a separate project-owned skill.
|
|
13
|
+
|
|
14
|
+
## Refresh or remove the skill
|
|
15
|
+
|
|
16
|
+
After upgrading the Python package, check and refresh the installed guide:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
python -m codex_ai.agent_skills status --project /path/to/project
|
|
20
|
+
python -m codex_ai.agent_skills update --project /path/to/project
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`status` reports whether the installed files match the current package and exits with a nonzero status when absent, stale, or inconsistent. `update` requires an existing managed installation. Upgrading the Python package alone does not update the copied skill.
|
|
24
|
+
|
|
25
|
+
To remove the guide and its marked `AGENTS.md` block:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
python -m codex_ai.agent_skills delete --project /path/to/project
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Update and delete refuse to change managed files that were edited or deleted locally. They also refuse corrupt ownership records, altered instruction blocks, unsafe links, and collisions with unrelated files. Restore or back up local edits before retrying; do not change the manifest to claim them. Unrelated files beside the skill remain in place. Ordinary file-operation errors trigger rollback, with recovery backups retained if rollback itself fails.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Purpose
|
|
4
4
|
|
|
5
|
-
`codex_ai.providers` contains concrete SDK adapters, not a broad interchangeable provider framework. Gemini is the product focus; OpenAI is
|
|
5
|
+
`codex_ai.providers` contains concrete SDK adapters, not a broad interchangeable provider framework. Gemini is the product focus; OpenAI is a separate modern Responses API adapter.
|
|
6
6
|
|
|
7
7
|
Gemini is the primary target and exposes direct methods for text, JSON, and image generation:
|
|
8
8
|
|
|
@@ -13,7 +13,14 @@ await gemini.generate_image_bytes(...)
|
|
|
13
13
|
await gemini.generate_imagen_bytes(...)
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
OpenAI
|
|
16
|
+
OpenAI exposes direct text, structured JSON, and typed streaming helpers:
|
|
17
|
+
|
|
18
|
+
```python
|
|
19
|
+
await openai.generate_text(...)
|
|
20
|
+
await openai.generate_json(..., schema=MyModel)
|
|
21
|
+
async for chunk in openai.stream_text(...):
|
|
22
|
+
...
|
|
23
|
+
```
|
|
17
24
|
|
|
18
25
|
## Architecture
|
|
19
26
|
|
|
@@ -24,7 +31,9 @@ PromptResult/String
|
|
|
24
31
|
├── GeminiProvider.generate_json(...) -> dict | BaseModel
|
|
25
32
|
├── GeminiProvider.generate_image_bytes(...) -> tuple[bytes, str]
|
|
26
33
|
├── GeminiProvider.generate_imagen_bytes(...) -> tuple[bytes, str]
|
|
27
|
-
|
|
34
|
+
├── OpenAIProvider.generate_text(...) -> str
|
|
35
|
+
├── OpenAIProvider.generate_json(...) -> dict | BaseModel
|
|
36
|
+
└── OpenAIProvider.stream_text(...) -> AsyncIterator[str]
|
|
28
37
|
```
|
|
29
38
|
|
|
30
39
|
The legacy router pipeline remains available:
|
|
@@ -40,14 +49,19 @@ LLMRouter builder -> PromptResult -> LLMDispatcher.process() -> provider.answer(
|
|
|
40
49
|
| Component | Class | SDK | Default Model |
|
|
41
50
|
|-----------|-------|-----|---------------|
|
|
42
51
|
| `gemini.py` | `GeminiProvider` | `google-genai` | `gemini-2.5-flash-lite` |
|
|
43
|
-
| `openai.py` | `OpenAIProvider` | `openai` | `gpt-
|
|
52
|
+
| `openai.py` | `OpenAIProvider` | `openai` 2.x | `gpt-5.6-luna` |
|
|
44
53
|
|
|
45
54
|
## Key Design Decisions
|
|
46
55
|
|
|
47
56
|
- Gemini-specific capabilities are represented directly instead of being hidden behind a broad universal abstraction.
|
|
48
57
|
- JSON generation uses provider-native JSON configuration and still validates locally with `json.loads` and optional Pydantic models.
|
|
58
|
+
- OpenAI uses the Responses API exclusively; the old Chat Completions path is not retained.
|
|
59
|
+
- OpenAI requests default to `store=False` and `reasoning={"effort": "none"}`.
|
|
60
|
+
- OpenAI Pydantic schemas use the SDK's native `responses.parse()` structured-output path.
|
|
61
|
+
- The OpenAI SDK client is injectable behind a small Responses API port for deterministic tests and custom transports.
|
|
49
62
|
- Gemini image generation and Imagen generation are separate explicit methods because they use different SDK calls.
|
|
50
63
|
- `generate_image_bytes()` uses Gemini `generate_content` with image modality. Its `response_mime_type` is only a preferred/fallback MIME type, and Gemini image controls are passed through `image_config`.
|
|
64
|
+
- `generate_image_bytes()` can also accept `input_images=[ImageInput(...)]` for image reference/edit workflows; without `input_images`, the prompt-only path is unchanged.
|
|
51
65
|
- `generate_image_bytes()` retries a rejected `image_config={"image_size": "4K"}` request once as `2K`.
|
|
52
66
|
- `generate_imagen_bytes()` uses Imagen `generate_images` and passes the requested MIME as `output_mime_type`.
|
|
53
67
|
- Anthropic, OpenRouter, and multi-provider failover are not active APIs in this line.
|
|
@@ -33,6 +33,16 @@ prompt: str
|
|
|
33
33
|
-> (bytes, actual_mime_type)
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
+
With `input_images`, the provider sends multimodal content:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
prompt: str + input_images: list[ImageInput]
|
|
40
|
+
-> text part + inline_data image parts
|
|
41
|
+
-> GeminiProvider.generate_image_bytes()
|
|
42
|
+
-> first returned inline_data image part
|
|
43
|
+
-> (bytes, actual_mime_type)
|
|
44
|
+
```
|
|
45
|
+
|
|
36
46
|
`response_mime_type` is not passed to `GenerateContentConfig.response_mime_type` on this path; it is only a fallback content type when Gemini omits `inline_data.mime_type`.
|
|
37
47
|
When `image_config.image_size` is `4K` and Gemini rejects the request, the provider retries once with `image_size` changed to `2K`.
|
|
38
48
|
|
|
@@ -51,7 +61,30 @@ prompt: str
|
|
|
51
61
|
```
|
|
52
62
|
PromptResult | str
|
|
53
63
|
-> OpenAIProvider.generate_text()
|
|
54
|
-
->
|
|
55
|
-
->
|
|
64
|
+
-> _OpenAIRequestMapper
|
|
65
|
+
-> responses.create(store=False)
|
|
66
|
+
-> response.output_text
|
|
56
67
|
-> str
|
|
57
68
|
```
|
|
69
|
+
|
|
70
|
+
## OpenAI Structured JSON
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
PromptResult | str + Pydantic schema
|
|
74
|
+
-> OpenAIProvider.generate_json()
|
|
75
|
+
-> responses.parse(text_format=schema)
|
|
76
|
+
-> response.output_parsed
|
|
77
|
+
-> BaseModel
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Without a schema, the provider requests JSON mode and decodes `response.output_text`.
|
|
81
|
+
|
|
82
|
+
## OpenAI Streaming
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
PromptResult | str
|
|
86
|
+
-> OpenAIProvider.stream_text()
|
|
87
|
+
-> responses.create(stream=True)
|
|
88
|
+
-> response.output_text.delta events
|
|
89
|
+
-> AsyncIterator[str]
|
|
90
|
+
```
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Установка навыка для агента
|
|
2
|
+
|
|
3
|
+
Начиная с версии 0.2.6, пакет `codex-ai` содержит необязательный автономный справочник для агентов, которые используют библиотеку в другом проекте. Установка Python-пакета не меняет файлы проекта. Чтобы явно добавить навык, выполните:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
python -m codex_ai.agent_skills install --project /path/to/project
|
|
7
|
+
python -m codex_ai.agent_skills status --project /path/to/project
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
В Windows PowerShell путь с пробелами нужно заключить в кавычки, например `--project "D:\My Projects\game"`. Используйте среду Python, в которой установлен `codex-ai`. Установщик работает без сети и не требует дополнений `[gemini]` или `[openai]`; нужное дополнение следует установить отдельно перед использованием соответствующего провайдера.
|
|
11
|
+
|
|
12
|
+
Установщик создаёт `.agents/skills/codex-ai/` в целевом проекте и добавляет один помеченный блок в `AGENTS.md`. Версия пакета и SHA-256-хеши управляемых файлов записываются в `.agents/skills/codex-ai/.manifest.json`. Остальные инструкции и файлы сохраняются. Установленные навык и манифест находятся под управлением установщика; правила конкретного приложения размещайте в отдельном навыке проекта.
|
|
13
|
+
|
|
14
|
+
## Обновление и удаление
|
|
15
|
+
|
|
16
|
+
После обновления Python-пакета проверьте и обновите установленный справочник:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
python -m codex_ai.agent_skills status --project /path/to/project
|
|
20
|
+
python -m codex_ai.agent_skills update --project /path/to/project
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`status` сообщает, соответствует ли установленный навык текущему пакету, и возвращает ненулевой код, если навык отсутствует, устарел или повреждён. Для `update` требуется уже установленный управляемый навык. Само обновление Python-пакета не обновляет скопированные файлы навыка.
|
|
24
|
+
|
|
25
|
+
Чтобы удалить справочник и его помеченный блок в `AGENTS.md`, выполните:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
python -m codex_ai.agent_skills delete --project /path/to/project
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Команды `update` и `delete` отказываются менять управляемые файлы, если они были изменены или удалены вручную. Установщик также отклоняет повреждённый манифест, изменённый блок инструкций, небезопасные ссылки и конфликты с посторонними файлами. Перед повторной попыткой сохраните или восстановите локальные правки; не подменяйте манифест. Посторонние файлы рядом с навыком остаются на месте. При обычных ошибках файловых операций выполняется откат; если откат не удался, резервные копии сохраняются для восстановления.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Назначение
|
|
4
4
|
|
|
5
|
-
`codex_ai.providers` содержит конкретные SDK-адаптеры, а не широкий interchangeable provider framework. Фокус продукта — Gemini; OpenAI
|
|
5
|
+
`codex_ai.providers` содержит конкретные SDK-адаптеры, а не широкий interchangeable provider framework. Фокус продукта — Gemini; OpenAI является отдельным современным адаптером Responses API.
|
|
6
6
|
|
|
7
7
|
Gemini является основным направлением и дает прямые методы для текста, JSON и картинок:
|
|
8
8
|
|
|
@@ -13,7 +13,14 @@ await gemini.generate_image_bytes(...)
|
|
|
13
13
|
await gemini.generate_imagen_bytes(...)
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
OpenAI
|
|
16
|
+
OpenAI предоставляет прямые методы для текста, структурированного JSON и typed streaming:
|
|
17
|
+
|
|
18
|
+
```python
|
|
19
|
+
await openai.generate_text(...)
|
|
20
|
+
await openai.generate_json(..., schema=MyModel)
|
|
21
|
+
async for chunk in openai.stream_text(...):
|
|
22
|
+
...
|
|
23
|
+
```
|
|
17
24
|
|
|
18
25
|
## Архитектура
|
|
19
26
|
|
|
@@ -24,7 +31,9 @@ PromptResult/String
|
|
|
24
31
|
├── GeminiProvider.generate_json(...) -> dict | BaseModel
|
|
25
32
|
├── GeminiProvider.generate_image_bytes(...) -> tuple[bytes, str]
|
|
26
33
|
├── GeminiProvider.generate_imagen_bytes(...) -> tuple[bytes, str]
|
|
27
|
-
|
|
34
|
+
├── OpenAIProvider.generate_text(...) -> str
|
|
35
|
+
├── OpenAIProvider.generate_json(...) -> dict | BaseModel
|
|
36
|
+
└── OpenAIProvider.stream_text(...) -> AsyncIterator[str]
|
|
28
37
|
```
|
|
29
38
|
|
|
30
39
|
Старый router pipeline остается доступным:
|
|
@@ -40,14 +49,19 @@ LLMRouter builder -> PromptResult -> LLMDispatcher.process() -> provider.answer(
|
|
|
40
49
|
| Компонент | Класс | SDK | Модель по умолчанию |
|
|
41
50
|
|-----------|-------|-----|---------------------|
|
|
42
51
|
| `gemini.py` | `GeminiProvider` | `google-genai` | `gemini-2.5-flash-lite` |
|
|
43
|
-
| `openai.py` | `OpenAIProvider` | `openai` | `gpt-
|
|
52
|
+
| `openai.py` | `OpenAIProvider` | `openai` 2.x | `gpt-5.6-luna` |
|
|
44
53
|
|
|
45
54
|
## Ключевые решения
|
|
46
55
|
|
|
47
56
|
- Возможности Gemini представлены напрямую, без широкой универсальной абстракции.
|
|
48
57
|
- JSON generation использует native JSON config провайдера и локальную проверку через `json.loads` и optional Pydantic schema.
|
|
58
|
+
- OpenAI использует только Responses API; старый путь Chat Completions не сохраняется.
|
|
59
|
+
- OpenAI-запросы по умолчанию используют `store=False` и `reasoning={"effort": "none"}`.
|
|
60
|
+
- Pydantic-схемы OpenAI обрабатываются через native structured-output путь `responses.parse()`.
|
|
61
|
+
- OpenAI SDK client можно внедрить через небольшой Responses API port для детерминированных тестов и custom transport.
|
|
49
62
|
- Gemini image generation и Imagen generation разведены в отдельные явные методы, потому что они используют разные SDK calls.
|
|
50
63
|
- `generate_image_bytes()` использует Gemini `generate_content` с image modality. Его `response_mime_type` является только preferred/fallback MIME type, а Gemini image controls передаются через `image_config`.
|
|
64
|
+
- `generate_image_bytes()` также принимает `input_images=[ImageInput(...)]` для сценариев reference/edit; без `input_images` старый prompt-only путь не меняется.
|
|
51
65
|
- `generate_image_bytes()` один раз повторяет отклоненный `image_config={"image_size": "4K"}` запрос как `2K`.
|
|
52
66
|
- `generate_imagen_bytes()` использует Imagen `generate_images` и передает requested MIME как `output_mime_type`.
|
|
53
67
|
- Anthropic, OpenRouter и multi-provider failover не являются активными API в этой линейке.
|
|
@@ -33,6 +33,16 @@ prompt: str
|
|
|
33
33
|
-> (bytes, actual_mime_type)
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
+
С `input_images` провайдер отправляет multimodal content:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
prompt: str + input_images: list[ImageInput]
|
|
40
|
+
-> text part + inline_data image parts
|
|
41
|
+
-> GeminiProvider.generate_image_bytes()
|
|
42
|
+
-> first returned inline_data image part
|
|
43
|
+
-> (bytes, actual_mime_type)
|
|
44
|
+
```
|
|
45
|
+
|
|
36
46
|
`response_mime_type` в этом пути не передается в `GenerateContentConfig.response_mime_type`; он используется только как fallback content type, если Gemini не вернул `inline_data.mime_type`.
|
|
37
47
|
Если `image_config.image_size` равен `4K` и Gemini отклоняет запрос, провайдер один раз повторяет его с `image_size="2K"`.
|
|
38
48
|
|
|
@@ -51,7 +61,30 @@ prompt: str
|
|
|
51
61
|
```
|
|
52
62
|
PromptResult | str
|
|
53
63
|
-> OpenAIProvider.generate_text()
|
|
54
|
-
->
|
|
55
|
-
->
|
|
64
|
+
-> _OpenAIRequestMapper
|
|
65
|
+
-> responses.create(store=False)
|
|
66
|
+
-> response.output_text
|
|
56
67
|
-> str
|
|
57
68
|
```
|
|
69
|
+
|
|
70
|
+
## OpenAI Structured JSON
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
PromptResult | str + Pydantic schema
|
|
74
|
+
-> OpenAIProvider.generate_json()
|
|
75
|
+
-> responses.parse(text_format=schema)
|
|
76
|
+
-> response.output_parsed
|
|
77
|
+
-> BaseModel
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Без schema провайдер запрашивает JSON mode и декодирует `response.output_text`.
|
|
81
|
+
|
|
82
|
+
## OpenAI Streaming
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
PromptResult | str
|
|
86
|
+
-> OpenAIProvider.stream_text()
|
|
87
|
+
-> responses.create(stream=True)
|
|
88
|
+
-> response.output_text.delta events
|
|
89
|
+
-> AsyncIterator[str]
|
|
90
|
+
```
|
|
@@ -59,6 +59,7 @@ plugins:
|
|
|
59
59
|
nav:
|
|
60
60
|
- Home: index.md
|
|
61
61
|
- Guide (EN):
|
|
62
|
+
- Agent Skill: en/agent-skill.md
|
|
62
63
|
- Architecture:
|
|
63
64
|
- Core:
|
|
64
65
|
- Overview: en/architecture/core/README.md
|
|
@@ -67,6 +68,7 @@ nav:
|
|
|
67
68
|
- Overview: en/architecture/providers/README.md
|
|
68
69
|
- Data Flow: en/architecture/providers/data_flow.md
|
|
69
70
|
- Руководство (RU):
|
|
71
|
+
- Навык агента: ru/agent-skill.md
|
|
70
72
|
- Архитектура:
|
|
71
73
|
- Core:
|
|
72
74
|
- Обзор: ru/architecture/core/README.md
|