Skip to content

✨ add support for rag param in workflow executions #319

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
merged 1 commit into from
Apr 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mindee/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ def execute_workflow(

if not options:
options = WorkflowOptions(
alias=None, priority=None, full_text=False, public_url=None
alias=None, priority=None, full_text=False, public_url=None, rag=False
)

return self._send_to_workflow(GeneratedV1, input_source, workflow_id, options)
Expand Down
4 changes: 4 additions & 0 deletions mindee/input/workflow_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,19 @@ class WorkflowOptions:
"""Whether to include the full OCR text response in compatible APIs."""
public_url: Optional[str]
"""A unique, encrypted URL for accessing the document validation interface without requiring authentication."""
rag: bool
"""Whether to enable Retrieval-Augmented Generation."""

def __init__(
self,
alias: Optional[str] = None,
priority: Optional[ExecutionPriority] = None,
full_text: Optional[bool] = False,
public_url: Optional[str] = None,
rag: Optional[bool] = False,
):
self.alias = alias
self.priority = priority
self.full_text = full_text if full_text else False
self.public_url = public_url
self.rag = rag if rag else False
2 changes: 2 additions & 0 deletions mindee/mindee_http/workflow_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def workflow_execution_post(
params = {}
if options.full_text:
params["full_text_ocr"] = "true"
if options.rag:
params["rag"] = "true"

if isinstance(input_source, UrlInputSource):
data["document"] = input_source.url
Expand Down
2 changes: 1 addition & 1 deletion tests/workflows/test_workflow_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_workflow(mindee_client: Client, workflow_id: str, input_path: str):
current_date_time = datetime.now().strftime("%Y-%m-%d-%H:%M:%S")
alias = f"python-{current_date_time}"
priority = ExecutionPriority.LOW
options = WorkflowOptions(alias=alias, priority=priority)
options = WorkflowOptions(alias=alias, priority=priority, rag=True)

response = mindee_client.execute_workflow(input_source, workflow_id, options)

Expand Down