Spaces:
Sleeping
Sleeping
import os | |
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel, tool | |
import datetime | |
import requests | |
import yaml | |
from tools.final_answer import FinalAnswerTool | |
from docx import Document # Ensure correct import | |
from Gradio_UI import GradioUI | |
def generate_automation_report(case_description: str) -> str: | |
""" | |
Generates a structured Word report for RPA analysts based on a case description. | |
Parameters: | |
case_description (str): A detailed description of the process and workflow to be automated. | |
Returns: | |
str: Message indicating successful report generation and further instructions. | |
""" | |
doc = Document() | |
doc.add_heading('Automation Suitability & Requirements Report', 0) | |
# Add report sections here (as before) | |
# ... | |
report_filename = 'Automation_Suitability_Report.docx' | |
doc.save(report_filename) | |
return f"Report generated: {report_filename} (update with specific details)." | |
# Configure the model | |
model = HfApiModel( | |
max_tokens=2096, | |
temperature=0.5, | |
model_id='Qwen/Qwen2.5-Coder-32B-Instruct', | |
custom_role_conversions=None | |
) | |
# Set up the agent | |
agent = CodeAgent( | |
model=model, | |
tools=[generate_automation_report, final_answer], # Include the report tool | |
max_steps=6, | |
verbosity_level=1, | |
grammar=None, | |
planning_interval=None, | |
name=None, | |
description=None, | |
) | |
# Launch the Gradio UI | |
if __name__ == "__main__": | |
GradioUI(agent).launch() |