Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat : polish spring chat model #36

Merged
merged 4 commits into from
Apr 7, 2024
Merged

feat : polish spring chat model #36

merged 4 commits into from
Apr 7, 2024

Conversation

rajadilipkolli
Copy link
Owner

No description provided.

Copy link
Contributor

coderabbitai bot commented Apr 7, 2024

Walkthrough

The project saw a comprehensive overhaul to improve code quality and adapt to a new data handling approach. Key changes include adopting the spotless-maven-plugin for consistent code formatting, transitioning controller methods to use @PostMapping and AIChatRequest objects for structured data exchange, enabling the spring.ai.openai.embedding feature, and updating service layers to work with Generation objects for AI integration.

Changes

File Path Change Summary
.../pom.xml Added spotless-maven-plugin for code formatting.
.../controller/ChatController.java Updated annotations, method signatures, and dependencies for AIChatRequest.
.../model/request/AIChatRequest.java Added a record class AIChatRequest for request handling.
.../resources/application.properties Enabled spring.ai.openai.embedding.
.../controller/ChatControllerTest.java Updated tests for POST method and AIChatRequest usage.
.../service/AIChatService.java Modified return statements to use Generation object.

"In the realm of code, where logic does play,
A rabbit hopped in, bringing change its way.
🐰 With a leap and a bound, it set the format right,
And taught the controllers to handle requests in the night.
Through the fields of data, it made its quest,
To ensure that responses were simply the best.
'Twas a journey of code, with a hop and a cheer,
A tale of a rabbit, who made everything clear."

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@rajadilipkolli rajadilipkolli self-assigned this Apr 7, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between ef10569 and b87de52.
Files selected for processing (7)
  • chatmodel-springai/pom.xml (2 hunks)
  • chatmodel-springai/src/main/java/com/example/ai/controller/ChatController.java (2 hunks)
  • chatmodel-springai/src/main/java/com/example/ai/model/request/AIChatRequest.java (1 hunks)
  • chatmodel-springai/src/main/resources/application.properties (1 hunks)
  • chatmodel-springai/src/test/java/com/example/ai/controller/ChatControllerTest.java (2 hunks)
  • rag/rag-springai-ollama-llm/src/main/java/com/learning/ai/llmragwithspringai/service/AIChatService.java (2 hunks)
  • rag/rag-springai-openai-llm/src/main/java/com/learning/ai/llmragwithspringai/service/AIChatService.java (2 hunks)
Additional comments not posted (8)
chatmodel-springai/src/main/java/com/example/ai/model/request/AIChatRequest.java (1)

1-3: LGTM! Using a record for AIChatRequest is a suitable choice for immutable data representation.

chatmodel-springai/src/main/resources/application.properties (1)

9-9: LGTM! Enabling the spring.ai.openai.embedding feature aligns with the PR objectives.

chatmodel-springai/src/test/java/com/example/ai/controller/ChatControllerTest.java (2)

6-8: LGTM! The addition of AIChatRequest and ContentType imports supports the updated testing approach.


29-54: LGTM! Transitioning to POST methods and using AIChatRequest for request bodies are correctly implemented. Consider adding more comprehensive tests to cover edge cases if not already present.

chatmodel-springai/src/main/java/com/example/ai/controller/ChatController.java (1)

23-64: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [3-63]

LGTM! The transition to POST methods, use of AIChatRequest, and introduction of EmbeddingClient are well-implemented. Ensure EmbeddingClient is properly configured and injected.

rag/rag-springai-openai-llm/src/main/java/com/learning/ai/llmragwithspringai/service/AIChatService.java (1)

56-62: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [8-60]

LGTM! The use of Generation for output content retrieval standardizes AI-generated content handling across the application.

rag/rag-springai-ollama-llm/src/main/java/com/learning/ai/llmragwithspringai/service/AIChatService.java (1)

65-71: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [10-69]

LGTM! Consistent use of Generation for output content retrieval across different modules enhances the standardization of AI-generated content handling.

chatmodel-springai/pom.xml (1)

76-98: LGTM! The addition of spotless-maven-plugin for code formatting is a positive change. Ensure the chosen formatting rules align with the project's coding standards.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between b87de52 and 5339177.
Files selected for processing (1)
  • .github/workflows/rag-springai-ollama-llm.yml (1 hunks)
Additional comments not posted (1)
.github/workflows/rag-springai-ollama-llm.yml (1)

28-28: Consider the implications of restricting CI builds to ubuntu-latest.

Restricting the operating systems to ubuntu-latest might simplify the CI pipeline and reduce costs, but it could also impact the cross-platform compatibility testing of the application. Ensure this change aligns with the project's requirements and consider documenting the rationale behind this decision for future reference.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review Status

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 5339177 and 56da8a6.
Files selected for processing (3)
  • chatmodel-springai/src/main/java/com/example/ai/config/LoggingConfig.java (3 hunks)
  • rag/rag-springai-ollama-llm/src/main/java/com/learning/ai/llmragwithspringai/config/RestClientBuilderConfig.java (1 hunks)
  • rag/rag-springai-openai-llm/src/main/java/com/learning/ai/llmragwithspringai/config/ResponseHeadersModification.java (2 hunks)
Additional comments not posted (3)
rag/rag-springai-ollama-llm/src/main/java/com/learning/ai/llmragwithspringai/config/RestClientBuilderConfig.java (1)

14-18: Consider making the timeout values configurable through application properties to accommodate different environments or use cases.

rag/rag-springai-openai-llm/src/main/java/com/learning/ai/llmragwithspringai/config/ResponseHeadersModification.java (1)

22-23: LGTM! Consider adding a comment to clarify the intended use case for modifying the Content-Type header, ensuring it aligns with application requirements.

chatmodel-springai/src/main/java/com/example/ai/config/LoggingConfig.java (1)

27-28: LGTM! Ensure that logging does not inadvertently expose sensitive information, such as API keys or personal data.

@rajadilipkolli rajadilipkolli merged commit c894cd0 into main Apr 7, 2024
4 checks passed
@rajadilipkolli rajadilipkolli deleted the polish branch April 7, 2024 04:36
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.

1 participant