docs(api): fix backwards send_result claim — send() is canonical
product-guidelines.md claimed send_result() was canonical and send() was removed. The reverse is true: send() is the live public API returning Result[str, ErrorInfo]; send_result exists only as a local var in _send_gemini_cli. Corrected the section and added a reconciliation note. Also fixed guide_ai_client.md send() signature to show -> Result[str] instead of -> str.
This commit is contained in:
@@ -188,13 +188,24 @@ function. The audit script `scripts/audit_optional_in_3_files.py` enforces
|
||||
this rule by failing CI on new `Optional[X]` return types in the 3
|
||||
refactored files.
|
||||
|
||||
### Public API: `ai_client.send_result()` (RESOLVED 2026-06-15)
|
||||
### Public API: `ai_client.send()` (current as of 2026-07-02)
|
||||
|
||||
The public `ai_client.send_result()` is the canonical public API. It
|
||||
returns `Result[str, ErrorInfo]`. The legacy `ai_client.send()` was
|
||||
removed in the `public_api_migration_and_ui_polish_20260615` track on
|
||||
2026-06-15 (see `conductor/tracks/public_api_migration_and_ui_polish_20260615/spec.md`).
|
||||
All production call sites and tests now use `send_result()`.
|
||||
The public `ai_client.send()` is the canonical public API. It returns
|
||||
`Result[str, ErrorInfo]` (the data-oriented error type from
|
||||
`src/result_types.py`). Check `result.ok` for success; on failure,
|
||||
`result.errors` holds classified `ErrorInfo` instances. All provider
|
||||
calls go through `send()`, which routes to the provider-specific
|
||||
`_send_<vendor>()` helpers. The tests in `tests/test_ai_client_result.py`
|
||||
verify the `Result` contract.
|
||||
|
||||
> **Note (corrected 2026-07-02):** a previous version of this section
|
||||
> claimed `send_result()` was the canonical API and `send()` was
|
||||
> removed. That was backwards against the current code — `send()` is
|
||||
> live and `send_result` does not exist as a public function (it
|
||||
> appears only as a local variable in `_send_gemini_cli`). The
|
||||
> migration may have been reverted or the prior claim was always wrong;
|
||||
> either way, the source of truth is `src/ai_client.py:send` and
|
||||
> `tests/test_ai_client_result.py`.
|
||||
|
||||
</new_content>
|
||||
## Testing Requirements
|
||||
|
||||
@@ -106,10 +106,10 @@ def send(
|
||||
stream_callback: Optional[Callable] = None,
|
||||
patch_callback: Optional[Callable] = None,
|
||||
rag_engine: Optional[Any] = None,
|
||||
) -> str:
|
||||
) -> Result[str]:
|
||||
```
|
||||
|
||||
Returns the model's response as a string. All provider calls go through here.
|
||||
Returns the model's response as a `Result[str, ErrorInfo]` (the data-oriented error type from `src/result_types.py`). Check `result.ok` for success; on failure, `result.errors` holds `ErrorInfo` instances with classified `ErrorKind`. All provider calls go through here.
|
||||
|
||||
**Parameters:**
|
||||
- `md_content` — the system prompt + context (markdown)
|
||||
|
||||
Reference in New Issue
Block a user