From 11d4b6f34f4991bd59057f3d26ba593e6d99a337 Mon Sep 17 00:00:00 2001 From: "praisonai-triage-agent[bot]" <272766704+praisonai-triage-agent[bot]@users.noreply.github.com> Date: Sun, 16 Aug 2026 17:16:53 +0000 Subject: [PATCH] docs: fix broken _astructured_completion example in thread-safety.mdx (fixes #2961) Replace the removed private method _astructured_completion (removed as dead code in PraisonAI PR #3991) with the live async path _structured_completion_async(..., is_async=True), and update the PR #1736 and PR #2963 behaviour-change notes to reflect the rename/removal. Co-authored-by: Mervin Praison --- docs/features/thread-safety.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/features/thread-safety.mdx b/docs/features/thread-safety.mdx index 448242dcc..55833e284 100644 --- a/docs/features/thread-safety.mdx +++ b/docs/features/thread-safety.mdx @@ -578,15 +578,15 @@ async with BaseAutoGenerator(config_list=[{ "api_key": os.getenv("OPENAI_API_KEY"), "base_url": None, }]) as gen: - result = await gen._astructured_completion(MyModel, messages=[...]) + result = await gen._structured_completion_async(MyModel, messages=[...], is_async=True) ``` **Behaviour change in PR #1681**: the module-level functions `praisonai.auto._get_openai_client(api_key, base_url)` and the `_openai_clients` / `_openai_clients_lock` globals **have been removed**. If you imported them, switch to constructing an `OpenAI` client yourself or call `BaseAutoGenerator(...).\_get_openai_client()`. Each generator now owns exactly one client; the previous bug — an in-use client being evicted from a process-wide LRU and closed while other threads still held a reference — is no longer possible. -**Behaviour change in PR #1736**: `__del__` was removed and async support was added. New methods include `aclose`, `__aenter__`/`__aexit__`, and `_astructured_completion`. Use context managers or explicit cleanup instead of relying on destructors. +**Behaviour change in PR #1736**: `__del__` was removed and async support was added. New methods include `aclose`, `__aenter__`/`__aexit__`, and `_structured_completion_async` (originally added as `_astructured_completion`, renamed and consolidated on the live path — the shorter alias was removed as dead code in [PR #3991](https://github.com/MervinPraison/PraisonAI/pull/3991)). Use context managers or explicit cleanup instead of relying on destructors. -**Behaviour change in PR for #2963**: `BaseAutoGenerator` now owns a single `_core_client: OpenAIClient` (the core-owned client) instead of separate `_openai_client` / `_async_openai_client` attributes. The methods `_get_openai_client()` and `_get_async_openai_client()` were consolidated into `_get_core_client()`. The public surface (`close`, `aclose`, `__enter__`/`__exit__`, `__aenter__`/`__aexit__`, `_structured_completion`, `_astructured_completion`) is unchanged. If you called the previous private methods directly, switch to `_get_core_client()`. +**Behaviour change in PR for #2963**: `BaseAutoGenerator` now owns a single `_core_client: OpenAIClient` (the core-owned client) instead of separate `_openai_client` / `_async_openai_client` attributes. The methods `_get_openai_client()` and `_get_async_openai_client()` were consolidated into `_get_core_client()`. The public surface (`close`, `aclose`, `__enter__`/`__exit__`, `__aenter__`/`__aexit__`, `_structured_completion`, `_structured_completion_async`) is unchanged as of PR #2963. `_astructured_completion` was later removed as dead code in [PR #3991](https://github.com/MervinPraison/PraisonAI/pull/3991) — call `_structured_completion_async` instead. If you called the previous private methods directly, switch to `_get_core_client()`. ### Thread-safe Typer command discovery