feat(oracle): Add Oracle GenAI Provider with full model family support#1537
feat(oracle): Add Oracle GenAI Provider with full model family support#1537fede-kamel wants to merge 4 commits intoPortkey-AI:mainfrom
Conversation
Note on
|
Issue Discovery: OCI Streaming Tool CallsWhile testing portkey-strands (Strands Agents SDK integration with Portkey), I discovered a critical issue with OCI GenAI streaming responses for tool/function calling. The ProblemWhen using OCI GenAI models through the current production Portkey gateway, streaming responses do not properly return tool call data. The model indicates it wants to call a tool ( Test Results (before this PR):
Actual Error# Model returns end_turn with empty content instead of tool_use
AgentResult(
stop_reason='end_turn', # Should be 'tool_use'
message={'role': 'assistant', 'content': []}, # Tool call data missing
...
)The streaming response returns Why This PR Fixes ItThis PR includes proper streaming state management for tool calls:
VerificationAfter applying this PR's changes, all OCI models pass tool calling tests:
This enables full agentic workflows with OCI GenAI models through Portkey. |
|
cc @VisargD - This PR addresses a critical issue affecting agentic workflows with OCI GenAI models. The streaming tool call bug prevents Strands Agents (and likely other agent frameworks) from working properly with OCI models through Portkey. Would appreciate a review when you have time! |
|
Tracking issue created: #1538 This documents the critical streaming tool call bug and explains why keeping the Oracle GenAI integration up to date is important for enterprise customers. |
|
Rebased check done: branch is already up to date with Validation run:
Re-pinging for review. |
|
Friendly follow-up on this one when you have a moment: @VisargD @narengogi\n\nWould appreciate a review. Thank you! |
|
Maintainer note: keeping OCI support current is strategically important here, not just additive. OCI is increasingly exposing new model families and provider-specific behaviors behind a single enterprise surface, and that surface changes fast: model availability, request/response shapes, auth expectations, token parameters, streaming/tool-call behavior, and embedding support all evolve over time. If the OCI provider lags, Portkey users in Oracle environments end up with capability gaps or subtle incompatibilities even when the same models are available elsewhere. Keeping OCI up to date means Portkey stays credible as a gateway layer for Oracle-hosted GPT/Gemini/Llama/Grok/Cohere workloads, reduces integration drift for enterprise customers, and avoids pushing teams into provider-specific forks or direct OCI workarounds. This PR moves OCI much closer to parity with the broader provider matrix, which is exactly the kind of maintenance surface that compounds in value if it is kept current. |
|
Hey @VisargD @narengogi — friendly ping on this one. It's been open for about 3 weeks now. Beyond the technical additions (full OCI GenAI support, streaming tool call fix, 61 unit tests), there's a broader Portkey + Oracle partnership story here: Portkey becomes the gateway layer for enterprise teams running GenAI on OCI, and Oracle customers get unified API access to all their OCI-hosted models (Llama, Gemini, GPT, Grok, Cohere) through a gateway they may already be using for OpenAI/Anthropic. That's a compelling value prop for both sides — Portkey expands its enterprise reach, Oracle gets first-class representation in the provider matrix. Happy to jump on a call if it's easier to walk through the implementation. Would really appreciate a review when you get a chance! |
… tests Oracle GenAI Provider Enhancements: - Add embeddings support (embed.ts) with Cohere model compatibility - Add model configuration system (modelConfig.ts) for model-specific behaviors - Add model handler classes for different families (Meta, Gemini, GPT, Grok, Cohere) - Support reasoningContent for GPT-OSS reasoning models - Handle content in multiple formats (array, string, reasoningContent) - Add oracleEndpointId to Options type for dedicated serving mode Testing: - Add comprehensive unit tests (61 tests passing) - Add integration tests for chat completions and embeddings - Add run-tests.sh script for easy test execution with OCI profiles Models tested: - Google Gemini 2.5 (flash, flash-lite, pro) - OpenAI GPT-OSS (20b, 120b) - Meta Llama Maverick - Cohere embeddings (v4.0, v3.0 variants)
- Add usesMaxCompletionTokens() helper for GPT-5+ model detection - Update chatRequest transform to use maxCompletionTokens for GPT-5 models - Add model configs for openai.gpt-5 and openai.gpt-4o families - Add OracleStreamChunk type definition for streaming responses - Set appropriate minTokens (500) for GPT-5 reasoning models
- Test multiple tool calls in a single response (weather, time, stock) - Test parallel tool calls with streaming - Verify models can call 2+ tools simultaneously
- Switch default test model from llama-4-maverick to llama-3.3-70b (maverick has intermittent >60s latency causing flaky timeouts) - Add AbortController with 115s timeout to makeOracleRequest to prevent hanging fetches - Bump parallel tool calling Jest timeout to 120s - Make streaming parallel tool test resilient to models that return text instead of tool calls in streaming mode - Rebase onto latest upstream/main (3 new commits, no conflicts) Verified: 61/61 unit tests, 21/21 integration tests pass across meta.llama-3.3, openai.gpt-oss-20b, and google.gemini-2.5-flash.
ed94379 to
63f0983
Compare
Summary
This PR adds comprehensive support for Oracle Cloud Infrastructure (OCI) Generative AI as a provider in the Portkey Gateway. As an Oracle engineer working on GenAI integrations, I've implemented this to bring Portkey's API gateway capabilities to the full range of models available on OCI GenAI.
Key Features
Supported Features by Model Family
Model-Specific Configurations
Backwards Compatibility
Gateway Core (Shared Files)
jest.config.jssrc/providers/open-ai-base/index.tssrc/types/requestBody.tssrc/utils/env.tsOracle Provider
embedendpointmodelConfig.tsmaxCompletionTokensreasoningContenthandlingExisting Oracle users will NOT experience breaking changes. All existing functionality continues to work.
Test Coverage
Unit Tests (61 passing)
modelConfig.test.ts- Model configuration and helperschatComplete.test.ts- Request/response transformsIntegration Tests (Real API calls)
Parallel Tool Calling Results
Technical Implementation
Files Added/Modified
src/providers/oracle/- Complete provider implementationchatComplete.ts- Chat completions with OpenAI-compatible transformsembed.ts- Embeddings support for Cohere modelsmodelConfig.ts- Model family configurations and helpersutils.ts- OCI request signing utilitieshandlers/- Model-specific handler classestypes/- TypeScript type definitionsAuthentication
The provider uses OCI API Key authentication with request signing:
Verification Checklist