Repository navigation
✨ add API for RAG operations #464
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
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
624ef0a
:sprakles: add API for RAG operations
ianardee 86f3a00
minor rework
ianardee ee505a6
finish params
ianardee 215ab46
rework as dataclass
ianardee b321adf
fixes
ianardee 8325caa
add client methods
ianardee de05a62
final fixes
ianardee 709b9ff
fixes for copilot
ianardee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| from abc import ABC, abstractmethod | ||
| from dataclasses import dataclass | ||
| from typing import Generic | ||
|
|
||
| from mindee.parsing.common.string_dict import StringDict | ||
| from mindee.v2.parsing.base_rag_annotation_response import TypeRagAnnotationResponse | ||
|
|
||
|
|
||
| @dataclass(kw_only=True) | ||
| class BaseAnnotationParameters(ABC, Generic[TypeRagAnnotationResponse]): | ||
| """Base parameters for document annotations.""" | ||
|
|
||
| # Note: DocumentId is included in the request URL path, it is not a parameter. | ||
| document_id: str | ||
| """UID of the annotated document.""" | ||
|
|
||
| _response_class: type[TypeRagAnnotationResponse] | ||
| """Response class for the annotation.""" | ||
|
|
||
| @abstractmethod | ||
| def get_request_parameters(self) -> dict[str, str | StringDict]: | ||
| """Gets the request parameters for the upload request.""" | ||
|
|
||
| def get_response_class(self) -> type[TypeRagAnnotationResponse]: | ||
| """Gets the response class for the search.""" | ||
| return self._response_class |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
mindee/v2/client_options/base_rag_document_upload_parameters.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| from abc import ABC | ||
| from dataclasses import dataclass | ||
| from typing import Generic | ||
|
|
||
| from mindee.v2.parsing.base_rag_annotation_response import TypeRagAnnotationResponse | ||
|
|
||
|
|
||
| @dataclass(kw_only=True) | ||
| class BaseRagDocumentUploadParameters(ABC, Generic[TypeRagAnnotationResponse]): | ||
| """Base parameters for document upload operations.""" | ||
|
|
||
| model_id: str | ||
| """UUID of the model that the uploaded RAG document is linked to.""" | ||
|
|
||
| close_file: bool = True | ||
| """Whether to close the file after uploading. Default: True.""" | ||
|
|
||
| _response_class: type[TypeRagAnnotationResponse] | ||
| """Response class for the annotation.""" | ||
|
|
||
| def get_request_parameters(self) -> dict[str, str]: | ||
| """Gets the request parameters for the upload request.""" | ||
| return {"model_id": self.model_id} | ||
|
|
||
| def get_response_class(self) -> type[TypeRagAnnotationResponse]: | ||
| """Gets the response class for the search.""" | ||
| return self._response_class |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.