Skip to content

Commit 548f741

Browse files
committed
feat(oci): support both V1 (OciClient) and V2 (OciClientV2) with validation
- Add OciClient back for V1 API (Command R, embeddings) - OciClientV2 for V2 API (Command A, COHEREV2 format) - Fail-fast validation: V2 body on V1 client or V1 body on V2 client raises ValueError with clear guidance on which client to use - V1/V2 determined by client class, not body sniffing - Full V1 chat, stream, and response transforms restored - Par to par with BedrockClient/BedrockClientV2 architecture - 47 tests pass (14 integration + 33 unit) against OCI GenAI
1 parent 14f6e01 commit 548f741

4 files changed

Lines changed: 579 additions & 233 deletions

File tree

src/cohere/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,7 @@
518518
"NotFoundError": ".errors",
519519
"NotImplementedError": ".errors",
520520
"OAuthAuthorizeResponse": ".types",
521+
"OciClient": ".oci_client",
521522
"OciClientV2": ".oci_client",
522523
"ParseInfo": ".types",
523524
"RerankDocument": ".types",
@@ -852,6 +853,7 @@ def __dir__():
852853
"NotFoundError",
853854
"NotImplementedError",
854855
"OAuthAuthorizeResponse",
856+
"OciClient",
855857
"OciClientV2",
856858
"ParseInfo",
857859
"RerankDocument",

src/cohere/manually_maintained/lazy_oci_deps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from typing import Any
44

55
OCI_INSTALLATION_MESSAGE = """
6-
The OCI SDK is required to use OciClientV2.
6+
The OCI SDK is required to use OciClient or OciClientV2.
77
88
Install it with:
99
pip install oci

0 commit comments

Comments
 (0)