Skip to content

feat(oracle): add Cohere embeddings support#1634

Open
fede-kamel wants to merge 1 commit into
Portkey-AI:mainfrom
fede-kamel:feat/oracle-cohere-embeddings
Open

feat(oracle): add Cohere embeddings support#1634
fede-kamel wants to merge 1 commit into
Portkey-AI:mainfrom
fede-kamel:feat/oracle-cohere-embeddings

Conversation

@fede-kamel
Copy link
Copy Markdown

@fede-kamel fede-kamel commented May 6, 2026

Summary

Adds the Oracle GenAI embeddings endpoint (Cohere embed models on OCI) and wires it into the gateway's /v1/embeddings surface.

This is the embeddings split from the original #1537 (per @narengogi's review asking to trim into focused PRs). #1537 now contains only the streaming tool-call fix.

What changed

File Change
src/providers/oracle/embed.ts New — request transform + OCI-to-OpenAI response transform
src/providers/oracle/api.ts Route the embed endpoint to OCI /actions/embedText
src/providers/oracle/index.ts Wire OracleEmbedConfig + OracleEmbedResponseTransform
src/providers/oracle/embed.test.ts New — focused unit tests

Total diff: +266 / -0, 4 files, all under src/providers/oracle/.

Behaviour

  • Input shaping: handles OpenAI's input as string, string array, or object array ({text: ...}).
  • input_type: maps OpenAI-style values (search_document, search_query, classification, clustering, image) to OCI's uppercase enum.
  • truncate: maps none / start / end to OCI's NONE / START / END.
  • Serving mode: ON_DEMAND only in this PR. DEDICATED can follow once a matching oracleEndpointId provider option lands (intentionally out of scope here to keep the PR focused).
  • Response: maps OCI embeddings: number[][] + inputTextTokenCount to OpenAI's data: [{embedding, index}] + usage.

Verified

  • npm run build
  • npm run format:check
  • Type-clean (tsc --noEmit reports no errors in src/providers/oracle/)
  • Verified live against inference.generativeai.us-chicago-1.oci.oraclecloud.com/20231130/actions/embedText for cohere.embed-multilingual-v3.0 (single string, batch, search_document type).

Related

Adds the Oracle GenAI embeddings endpoint (Cohere embed models on OCI),
exposing them through the gateway's `/v1/embeddings` interface.

- `embed.ts`: request transform (string / string[] / object[] inputs,
  input_type / truncate / is_echo passthrough) and OCI-to-OpenAI
  response transform with usage mapping
- `api.ts`: route the `embed` endpoint to OCI's `/actions/embedText`
- `index.ts`: wire the embed config and response transform into the
  Oracle provider

Scope is intentionally minimal — ON_DEMAND serving mode only. DEDICATED
endpoint support can follow in a separate change once the matching
`oracleEndpointId` provider option is plumbed through.

Tests cover input shaping (string, string array, object array, empty),
input_type mapping, ON_DEMAND serving payload, success response (data /
model / usage), and error / invalid-response paths.
@fede-kamel
Copy link
Copy Markdown
Author

@roh26it @narengogi @VisargD — companion to #1537. Rebased on main, mergeable, e2e-verified live against cohere.embed-multilingual-v3.0 on us-chicago-1. Diff is +266 / −0, all under src/providers/oracle/ plus a one-line embed route case in api.ts. See #1537 for the broader context on bringing the OCI provider quality up to par. Happy to take review feedback.

@fede-kamel
Copy link
Copy Markdown
Author

Thanks for the review @narengogi! What's the next step from here to land this in a release? Happy to add a changelog entry, rebase, or anything else the merge process needs — just let me know what's missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants