Tags: ogx-ai/ogx
Tags
fix: make AsyncOgxClient functional by inheriting from sync ApiClient (… …#6372) # What does this PR do? The AsyncOgxClient was completely non-functional. Any API call through it would immediately crash with AttributeError: 'AsyncApiClient' object has no attribute 'select_header_accept' because AsyncApiClient was a standalone class missing 15+ methods (select_header_accept, param_serialize, call_api, response_deserialize, etc.) that the generated API classes depend on. Additionally, all API methods wired into AsyncOgxClient were synchronous and could not be awaited, and nested API wiring (e.g. client.chat.completions) was never applied. This PR fixes the async client by: - Making AsyncApiClient inherit from ApiClient, overriding only the HTTP transport layer (__init__, call_api, close, context managers). All serialization/deserialization methods are inherited unchanged. - Generating proper Async*Api subclasses (e.g. AsyncInspectApi(InspectApi)) in the same file via the api.mustache template. These inherit _serialize helpers and override the operation methods with async def / await. - Updating AsyncOgxClient to wire Async*Api classes instead of sync ones. - Fixing patch_hierarchy.py to apply nested API wiring to both OgxClient and AsyncOgxClient. - Adding RESTResponse.aread() for async response body reading. - Updating export templates (exports_api.mustache, exports_package.mustache, __init__package.mustache) to include the new Async*Api classes. ## Test Plan Ran integration test to validate no regression for sync client Ran this simple script to validate async is at least somewhat working; ```python import asyncio from ogx_client import AsyncOgxClient async def main(): async with AsyncOgxClient(base_url="http://localhost:8321") as client: health = await client.inspect.health() models = await client.models.list() print(f"Health {health}") print(f"Models {models}") asyncio.run(main()) ``` --------- Signed-off-by: Eitan Geiger <egeiger@redhat.com> Co-authored-by: Charlie Doern <cdoern@redhat.com>
feat(inference): add Meta AI remote inference provider (#6275) ## What Adds a new remote inference provider (`remote::meta`) for the OpenAI-compatible **Meta AI API** endpoint (`api.meta.ai`), supporting three API surfaces: - **Chat Completions** (`/v1/chat/completions`) — via `OpenAIMixin` - **Responses** (`/v1/responses`) — via OGX's built-in responses provider, reconstructed over chat completions (same path as every OpenAI-compatible provider; usage is mapped from the underlying chat-completion `usage`) - **Anthropic Messages** (`/v1/messages` + `/v1/messages/count_tokens`) — the adapter overrides `anthropic_messages()` / `anthropic_count_tokens()` to forward **natively** to `api.meta.ai`, instead of the `OpenAIMixin` translation fallback (following the `InferenceProvider.anthropic_messages()` pattern from #6264, same as Ollama/vLLM) ## Changes - New adapter package `src/ogx/providers/remote/inference/meta/` (`config.py`, `meta.py`, `__init__.py`); `base_url` defaults to `https://api.meta.ai/v1`, API key from `META_API_KEY` / `meta_api_key` provider-data field - Registered `RemoteProviderSpec` for `remote::meta` in `providers/registry/inference.py` - Native Anthropic Messages + count_tokens passthrough implemented on the adapter, mirroring the Ollama adapter - Enabled in the `starter` distribution (`ENABLED_INFERENCE_PROVIDERS` + `META_API_KEY` env var); distro/provider codegen regenerated (starter + ci-tests configs, `docs/.../remote_meta.mdx`) - Added a parametrized case to `test_inference_client_caching.py` - Mapped `meta` in `scripts/generate_target_models_docs.py` (`INTENTIONALLY_UNMAPPED_REGISTRY_PROVIDERS`) to keep the `target-model-matrix` pre-commit hook in sync (no dedicated integration-test setup yet) No `ogx_api/` (public API surface) changes, so no OpenAPI regeneration required. Branch is merged up to date with `main`. ## Test plan ### Automated ``` # unit uv run pytest tests/unit/providers/inference/test_inference_client_caching.py \ tests/unit/providers/inline/messages/ -q # 21 passed # lint / type uv run ruff check src/ogx/providers/remote/inference/meta # All checks passed! uv run mypy src/ogx/providers/remote/inference/meta # Success: no issues found in 3 source files # pre-commit uv run pre-commit run --all-files # pre-commit CI check: pass ``` CI: all checks green (pre-commit, `Analyze (python)`/mypy, builds, and the full integration-test matrix). ### End-to-end against the live endpoint Server started from the `starter` distribution with `META_API_KEY` set; model `meta/muse-spark-1.1`. Every surface verified **through OGX** and, as a control, **directly against `api.meta.ai`**. | Surface | OGX endpoint | Through OGX | Direct to api.meta.ai | Notes | |---|---|---|---|---| | Chat Completions | `POST /v1/chat/completions` | 200 | 200 (Bearer) | `object: chat.completion` | | Responses | `POST /v1/responses` | 200 | 200 (Bearer) | `object: response`; `usage.input_tokens` matches direct (8 == 8), `cached_tokens`/`reasoning_tokens` preserved | | Messages | `POST /v1/messages` | 200 (native `anthropic_messages`) | 200 (x-api-key) | native Anthropic `redacted_thinking` block returned — cannot be produced by the translation path, confirming native forwarding | | Count Tokens | `POST /v1/messages/count_tokens` | 200 `{"input_tokens":9}` | 200 `{"input_tokens":9}` | native `anthropic_count_tokens` passthrough | Example (messages through OGX): ``` $ curl http://localhost:8321/v1/messages -H "anthropic-version: 2023-06-01" \ -d '{"model":"meta/muse-spark-1.1","max_tokens":2048, "messages":[{"role":"user","content":"Reply with exactly: messages works"}]}' # -> blocks ['redacted_thinking', 'text'] text ['messages works'] # server log: "Using native /v1/messages passthrough" ... POST /v1/messages 200 ``` Notes: - The Meta model must be referenced with the `meta/` prefix so the router resolves it to this provider. - The native `/v1/messages` path forwards with `x-api-key`; chat/responses use `Authorization: Bearer`. --------- Signed-off-by: Raghotham Murthy <rsm@meta.com>
fix(ci): temporarily skip ogx-client-typescript from release pipeline The external ogx-client-typescript repo does not have a release-1.2.x branch, causing the build matrix to fail and block all downstream test and publish jobs. Signed-off-by: Sébastien Han <seb@redhat.com>
feat: add inline::unstructured file processor (#6159) # What does this PR do? Adds inline::unstructured as an opt-in file processor provider for processing 65+ document formats using the local Unstructured library. Follows the same structure as inline::docling provider. Provides the same multi-format document processing capabilities with structure-aware chunking options as remote::unstructured-api, but runs locally without API costs. Follows the same structure as inline::docling provider. ## Test Plan Tested with real PDF processing via /v1alpha/file-processors/process endpoint: ``` bash # Start server uv run ogx stack run \ --providers "file_processors=inline::unstructured,files=inline::localfs,vector_io=inline::faiss,inference=inline::sentence-transformers" \ --port 8321 # Process PDF curl -X POST http://localhost:8321/v1alpha/file-processors/process \ -F "file=@example_pdf" \ -F 'chunking_strategy={"type":"auto"} Results: { "metadata": { "processor": "unstructured", "processing_time_ms": 44121, "extraction_method": "unstructured-local", "file_size_bytes": 25766, "total_elements": 174, "strategy": "auto" } } ``` Output: - Processed 25.7 KB PDF in 44 seconds - Extracted 174 elements - Created 2 chunks with auto chunking strategy - Metadata preserved (filename, page numbers, element types) - All unit tests passed --------- Signed-off-by: Sahana Sreeram <sahanasreeram01@gmail.com>
PreviousNext