Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
91d3130
SDK regeneration
fern-api[bot] Feb 23, 2024
f0afd84
feat: Add comprehensive Oracle Cloud Infrastructure (OCI) client support
fede-kamel Jan 26, 2026
b2b196c
fix: Correct OCI client request signing and response transformation
fede-kamel Jan 26, 2026
4b99aef
feat: Add V2 API support for OCI with Command A models
fede-kamel Jan 26, 2026
8e53af8
style: Fix ruff linting issues in OCI client
fede-kamel Jan 26, 2026
ab5e724
chore: Remove temporary development summary files
fede-kamel Jan 26, 2026
21c8de4
fix: Address OCI pip extras installation and streaming [DONE] signal …
fede-kamel Jan 26, 2026
4331330
feat: Add OCI session-based (security token) authentication support
fede-kamel Jan 26, 2026
79225fb
docs: Add session-based authentication to OCI documentation
fede-kamel Jan 26, 2026
5a6124b
fix: Replace httpx.Headers object instead of updating it for OCI sign…
fede-kamel Jan 26, 2026
660aec1
Fix OCI client V2 support and address copilot issues
fede-kamel Jan 26, 2026
b776ade
docs: Add OCI model availability limitations and improve docstrings
fede-kamel Jan 26, 2026
9d67148
fix: Address PR feedback - V2 detection and security token path expan…
fede-kamel Jan 26, 2026
3dedc19
fix: Address PR feedback for OCI client
fede-kamel Jan 26, 2026
1d98356
feat: Add thinking parameter support for Command A Reasoning models
fede-kamel Feb 4, 2026
d173167
Address cursor[bot] review feedback for OCI client
fede-kamel Feb 6, 2026
f447f07
Fix token_budget casing and add toolCalls conversion
fede-kamel Feb 6, 2026
716d743
fix: Use UUID for generation_id instead of modelId
fede-kamel Feb 24, 2026
b78c63e
fix: Address Bugbot feedback for OCI client
fede-kamel Feb 24, 2026
bc31c1e
feat: Add OciClientV2 only, drop V1 OCI client
fern-support Mar 12, 2026
06f88a3
fix: Port V1 OciClient test classes to V2
fern-support Mar 12, 2026
fd9d389
fix: Remove stale is_v2 argument from transformation tests
fern-support Mar 12, 2026
4bff87f
fix: Update lazy_oci error message to reference only OciClientV2
fern-support Mar 12, 2026
27a05ae
fix: Improve streaming error handling in OCI client
fern-support Mar 12, 2026
ecb3ad4
fix: Validate private key is provided for direct OCI credentials
fern-support Mar 12, 2026
0d26484
fix: Reject unknown endpoints in get_oci_url instead of silent fallback
fern-support Mar 12, 2026
115468d
fix: Guard _event_hook with descriptive error handling
fern-support Mar 12, 2026
02c65b4
fix: Improve error handling for response extensions and session tokens
fern-support Mar 12, 2026
d34435b
feat: Emit message-start and content-start events in OCI streaming
fern-support Mar 12, 2026
e2a6e76
test: Add unit tests for model normalization and request transformation
fern-support Mar 12, 2026
5ae9e08
fix: Regenerate poetry.lock to include optional oci dependency
fern-support Mar 12, 2026
7fa464f
docs: Fix OCI README to use OciClientV2 and correct model names
fern-support Mar 12, 2026
488f5d1
fixes
fern-support Mar 12, 2026
4b28959
fix: Add type: ignore for optional oci import to match AWS pattern
fern-support Mar 12, 2026
a470877
ci: Skip flaky langchain-cohere integration tests
fern-support Mar 12, 2026
b8c5c2a
ci: Skip only the flaky test_langchain_tool_calling_agent test
fern-support Mar 12, 2026
e75f389
update test model
fern-support Mar 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .fernignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ src/cohere/manually_maintained/__init__.py
src/cohere/bedrock_client.py
src/cohere/aws_client.py
src/cohere/sagemaker_client.py
src/cohere/oci_client.py
src/cohere/client_v2.py
mypy.ini
src/cohere/aliases.py
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ jobs:

echo "Current cohere installation: $(poetry show cohere)"
make test
make integration_test

# Skip test_langchain_tool_calling_agent: uses deprecated models and hits
# the live API without temperature=0, causing non-deterministic failures.
# See https://github.com/cohere-ai/cohere-python/pull/738
poetry run pytest tests/integration_tests/ --deselect tests/integration_tests/test_langgraph_agents.py::test_langchain_tool_calling_agent
echo "tests passed"

# reset poetry changes
Expand Down
105 changes: 105 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,111 @@ for event in response:
print(event.delta.message.content.text, end="")
```

## Oracle Cloud Infrastructure (OCI)

The SDK supports Oracle Cloud Infrastructure (OCI) Generative AI service. First, install the OCI SDK:

```
pip install 'cohere[oci]'
```

Then use `OciClientV2`:

```Python
import cohere

# Using OCI config file authentication (default: ~/.oci/config)
co = cohere.OciClientV2(
oci_region="us-chicago-1",
oci_compartment_id="ocid1.compartment.oc1...",
)

response = co.embed(
model="embed-english-v3.0",
texts=["Hello world"],
input_type="search_document",
)

print(response.embeddings)
```

### OCI Authentication Methods

**1. Config File (Default)**
```Python
co = cohere.OciClientV2(
oci_region="us-chicago-1",
oci_compartment_id="ocid1.compartment.oc1...",
# Uses ~/.oci/config with DEFAULT profile
)
```

**2. Custom Profile**
```Python
co = cohere.OciClientV2(
oci_profile="MY_PROFILE",
oci_region="us-chicago-1",
oci_compartment_id="ocid1.compartment.oc1...",
)
```

**3. Session-based Authentication (Security Token)**
```Python
# Works with OCI CLI session tokens
co = cohere.OciClientV2(
oci_profile="MY_SESSION_PROFILE", # Profile with security_token_file
oci_region="us-chicago-1",
oci_compartment_id="ocid1.compartment.oc1...",
)
```

**4. Direct Credentials**
```Python
co = cohere.OciClientV2(
oci_user_id="ocid1.user.oc1...",
oci_fingerprint="xx:xx:xx:...",
oci_tenancy_id="ocid1.tenancy.oc1...",
oci_private_key_path="~/.oci/key.pem",
oci_region="us-chicago-1",
oci_compartment_id="ocid1.compartment.oc1...",
)
```

**5. Instance Principal (for OCI Compute instances)**
```Python
co = cohere.OciClientV2(
auth_type="instance_principal",
oci_region="us-chicago-1",
oci_compartment_id="ocid1.compartment.oc1...",
)
```

### Supported OCI APIs

The OCI client supports the following Cohere APIs:
- **Embed**: Full support for all embedding models (embed-english-v3.0, embed-english-light-v3.0, embed-multilingual-v3.0)
- **Chat**: Full support with `OciClientV2`
- Streaming available via `chat_stream()`
- Supports Command-R and Command-A model families

### OCI Model Availability and Limitations

**Available on OCI On-Demand Inference:**
- **Embed models**: embed-english-v3.0, embed-english-light-v3.0, embed-multilingual-v3.0
- **Chat models**: command-r-08-2024, command-r-plus, command-a-03-2025

**Not Available on OCI On-Demand Inference:**
- **Generate API**: OCI TEXT_GENERATION models are base models that require fine-tuning before deployment
- **Rerank API**: OCI TEXT_RERANK models are base models that require fine-tuning before deployment
- **Multiple Embedding Types**: OCI on-demand models only support single embedding type per request (cannot request both `float` and `int8` simultaneously)

**Note**: To use Generate or Rerank models on OCI, you need to:
1. Fine-tune the base model using OCI's fine-tuning service
2. Deploy the fine-tuned model to a dedicated endpoint
3. Update your code to use the deployed model endpoint

For the latest model availability, see the [OCI Generative AI documentation](https://docs.oracle.com/en-us/iaas/Content/generative-ai/home.htm).

## Contributing

While we value open-source contributions to this SDK, the code is generated programmatically. Additions made directly would have to be moved over to our generation code, otherwise they would be overwritten upon the next generated release. Feel free to open a PR as a proof of concept, but know that we will not be able to merge it as-is. We suggest opening an issue first to discuss with us!
Expand Down
Loading
Loading