File size: 1,475 Bytes
f1592f3
d3785cd
9b5b26a
4c95107
c19d193
6aae614
4c95107
9b5b26a
 
 
d3785cd
4c95107
 
 
 
 
 
 
 
 
d3785cd
 
 
4c95107
 
 
d3785cd
 
 
ae7a494
4c95107
e121372
d3785cd
 
 
 
13d500a
8c01ffb
4c95107
8c01ffb
8fe992b
4c95107
8c01ffb
 
4c95107
 
 
 
8fe992b
 
4c95107
d3785cd
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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

@tool
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()