Skip to content

♻️ simplify RAG CRUD - #218

Merged
ianardee merged 3 commits into
mainfrom
better-rag
Sep 10, 2026
Merged

♻️ simplify RAG CRUD#218
ianardee merged 3 commits into
mainfrom
better-rag

Conversation

@ianardee

@ianardee ianardee commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Description

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Requires a change to the official Guide documentation.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

It introduces a breaking public API signature change without addressing backward compatibility / change classification, and it also introduces a potential fatal error path via an uninitialized typed static property.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR refactors the V2 RAG document annotation update flow by moving the response-class selection into the annotation parameter objects (instead of passing a response class into each update call), simplifying the CRUD surface area for RAG annotations.

Changes:

  • Removed the explicit $responseClass argument from Client::updateRagAnnotation() and MindeeApiV2::reqPatchRagAnnotation(), and now deserializes via $params->getResponseClass().
  • Introduced a generic BaseAnnotationParameters<T> with a getResponseClass() accessor.
  • Updated RagDocumentAnnotationParameters to declare its associated response class, and updated functional tests accordingly.
File summaries
File Description
tests/V2/Product/Extraction/RagDocumentsFunctional.php Updates test calls to updateRagAnnotation() to use the new parameter-driven response class.
src/V2/Product/Extraction/RagDocuments/Params/RagDocumentAnnotationParameters.php Binds the RAG annotation params to ExtractionRagAnnotationResponse via a static response-class field.
src/V2/Http/MindeeApiV2.php Removes $responseClass from reqPatchRagAnnotation() and deserializes using the params’ response class.
src/V2/ClientOptions/BaseAnnotationParameters.php Adds generic response typing and getResponseClass() to parameter objects.
src/V2/Client.php Removes $responseClass from updateRagAnnotation() and adjusts polling path to use the params’ response class.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/V2/Client.php
Comment thread src/V2/ClientOptions/BaseAnnotationParameters.php

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Fix the uninitialized upload response class and address the public API compatibility breaks.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (2)

src/V2/Client.php:233

  • This removes the first $responseClass argument from the public updateRagAnnotation() method. Existing callers using the previous signature will no longer match this method, making the refactor source-incompatible despite the PR not being marked as breaking. Preserve a compatibility entry point or explicitly version/document the break.
    public function updateRagAnnotation(
        BaseAnnotationParameters $params
    ): BaseRagAnnotationResponse {
        return $this->mindeeApi->reqPatchRagAnnotation($params);

src/V2/Client.php:342

  • Removing the required $responseClass argument from this public polling method breaks existing calls with updateAndGetRagAnnotationPoll($responseClass, $params, ...), which now pass a string to the BaseAnnotationParameters type and fail with a TypeError. This is a breaking API change despite the PR metadata leaving the breaking-change option unchecked; retain a compatibility path or explicitly version and document the break.
    public function updateAndGetRagAnnotationPoll(
        BaseAnnotationParameters $params,
        ?PollingOptions $pollingOptions = null,
  • Files reviewed: 10/10 changed files
  • Comments generated: 4
  • Review effort level: Lite

Comment thread src/V2/Product/Extraction/RagDocuments/Params/RagDocumentUploadParameters.php Outdated
Comment thread src/V2/Client.php
Comment thread src/V2/Client.php
Comment thread src/V2/ClientOptions/BaseProductParameters.php
@ianardee
ianardee merged commit 369bcaa into main Sep 10, 2026
31 checks passed
@ianardee
ianardee deleted the better-rag branch September 10, 2026 10:10
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.

2 participants