Skip to content

Conversation

@yesshreyes
Copy link
Collaborator

No description provided.

@yesshreyes yesshreyes requested a review from RajashekarRaju June 9, 2025 15:23
@RajashekarRaju RajashekarRaju force-pushed the shreyas/migrate-openai-to-gemini branch from 8171c91 to f9c1a97 Compare June 9, 2025 15:33
@RajashekarRaju RajashekarRaju force-pushed the shreyas/migrate-openai-to-gemini branch from f9c1a97 to 0236d19 Compare June 9, 2025 15:53
yesshreyes and others added 2 commits June 10, 2025 10:08
    - Introduce `GeminiApiService` for handling Gemini API requests.
    - Create `KtorClientProvider` to manage the Ktor `HttpClient` and `Json` instances.
    - Implement `GeminiPromptBuilder` to construct API request prompts and bodies.
    - Add `GeminiJsonParser` for extracting and cleaning JSON from API responses.
- Move data models `CodeExample`, `Section`, and `Syntax` to separate files.
- Remove unused OpenAI-related data classes from `KotlinTopicDetails.kt`.
- Update `DetailRepository` to use the new `GeminiApiService`.
@RajashekarRaju RajashekarRaju force-pushed the shreyas/migrate-openai-to-gemini branch from c690580 to dad3e5a Compare June 10, 2025 07:21
Copy link
Member

@RajashekarRaju RajashekarRaju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have applied below changes :

Previously, GeminiApiService was an object, which will it hard to mock or replace for testing.
Now it’s provided as a DI singleton and injected into DetailRepository, improving testability.


Replaced the KtorClientProvider singleton with proper DI managed instances of HttpClient and Json. This ensures a consistent configuration and allows us to reuse or override these components in other environments.


DetailRepository now takes GeminiApiService as a constructor parameter. This decouples the repository from hardcoded services and aligns it with clean architecture best practices.


DI definitions have been cleanly separated into type-based modules:

  • httpClientModule for Ktor HttpClient and JSON
  • apiModule for API services
  • repositoryModule for data repositories
  • viewModelModule for ViewModels
    This makes the setup modular, easier to reason about, avoids clutter in a single DI file.

Copy link
Member

@RajashekarRaju RajashekarRaju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd move data classes CodeExample, Section, Syntax into KotlinTopicDetails itself, this sort of granularity for separation of each data class into own file is is unnecessary here and adds extra overhead in navigating the codebase.

Since these classes are tightly coupled to KotlinTopicDetails and not reused elsewhere, keeping them grouped within the same file improves readability and makes the model easier to maintain as a single unit of domain logic.

RajashekarRaju
RajashekarRaju previously approved these changes Jun 10, 2025
@yesshreyes yesshreyes merged commit accb7ba into master Jun 10, 2025
1 check passed
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.

3 participants