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 3 commits intoPortkey-AI:mainfrom
Conversation
… 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
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! |
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