feat: Add OCI Gen AI Integration for Direct LLM Support #2321
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue Link / Problem Description
This PR adds direct support for Oracle Cloud Infrastructure (OCI) Generative AI models in Ragas, enabling evaluation without requiring LangChain or LlamaIndex dependencies. Currently, users who want to use OCI Gen AI models must go through LangChain or LlamaIndex wrappers, which adds unnecessary complexity and dependencies.
Problem: No direct OCI Gen AI integration exists in Ragas, forcing users to use indirect approaches through LangChain/LlamaIndex.
Solution: Implement a native OCI Gen AI wrapper that uses the OCI Python SDK directly.
Changes Made
Core Implementation
OCIGenAIWrapper
- New LLM wrapper class extendingBaseRagasLLM
oci.generative_ai.GenerativeAiClient
directlyoci_genai_factory()
for easy initializationModel Support
Pretrained Foundational Models supported by OCI Generative AI
Dependencies & Configuration
oci>=2.160.1
as optional dependencyTesting & Quality
Documentation & Examples
examples/oci_genai_example.py
Analytics & Monitoring
LLMUsageEvent
Testing
How to Test
pip install ragas[oci]
python examples/oci_genai_example.py
Test Coverage
References
BaseRagasLLM
patternsScreenshots/Examples
Basic Usage
Advanced Configuration
Files Changed
src/ragas/llms/oci_genai_wrapper.py
- Main implementationsrc/ragas/llms/__init__.py
- Export new classespyproject.toml
- Add OCI optional dependencytests/unit/test_oci_genai_wrapper.py
- Comprehensive testsdocs/howtos/integrations/oci_genai.md
- Complete documentationdocs/howtos/integrations/index.md
- Updated integration indexexamples/oci_genai_example.py
- Working example scriptBreaking Changes
None - This is a purely additive feature with no breaking changes.
Dependencies
oci>=2.160.1