| |
|
| |
|
| | |
| |
|
| | |
| | from smolagents import CodeAgent, HfApiModel, tool, load_tool |
| |
|
| | |
| | import time |
| | import yaml |
| |
|
| | |
| | from tools.final_answer import FinalAnswerTool |
| | from Gradio_UI import GradioUI |
| |
|
| | |
| | |
| | @tool |
| | def detect_ambiguity(content: str) -> str: |
| | """Checks for vague instructions and suggests clarifications. |
| | |
| | Args: |
| | content: Text to analyze. |
| | """ |
| | return "Ambiguity detected. Click 'Is this ambiguous?' for help." |
| |
|
| | |
| | |
| | @tool |
| | def explain_assumed_knowledge(term: str) -> str: |
| | """Defines technical terms in a simple way. |
| | |
| | Args: |
| | term: The term to explain. |
| | """ |
| | return f"Definition of '{term}': [Detailed beginner-friendly explanation here]" |
| |
|
| | |
| | |
| | @tool |
| | def highlight_elements(step: str, element: str, auto_execute: bool = False) -> str: |
| | """(Placeholder) Highlights a UI element and optionally performs an action. |
| | |
| | Args: |
| | step: The current step in the guide. |
| | element: The UI element to highlight (as an identifier). |
| | auto_execute: If True, the agent would auto-click the element. |
| | """ |
| | return "Highlight functionality is currently not available." |
| |
|
| | |
| | |
| | @tool |
| | def explain_code_line(line: str) -> str: |
| | """Explains what a line of code does in simple terms. |
| | |
| | Args: |
| | line: The code line to explain. |
| | """ |
| | return f"Explanation for: {line} [Insert explanation here]" |
| |
|
| | |
| | |
| | @tool |
| | def teacher_box_query(question: str) -> str: |
| | """Allows users to ask the AI questions while browsing. |
| | |
| | Args: |
| | question: User's query. |
| | """ |
| | return f"AI Answer: [Response for '{question}']" |
| |
|
| | |
| | |
| | @tool |
| | def toggle_auto_execution(enable: bool) -> str: |
| | """Lets the user turn automatic navigation on or off. |
| | |
| | Args: |
| | enable: True for auto-mode, False for manual steps. |
| | """ |
| | return "Auto-execution enabled." if enable else "Manual step-by-step mode enabled." |
| |
|
| | |
| | |
| | model = HfApiModel( |
| | max_tokens=2096, |
| | temperature=0.5, |
| | model_id='Qwen/Qwen2.5-Coder-32B-Instruct', |
| | custom_role_conversions=None |
| | ) |
| |
|
| | |
| | with open("prompts.yaml", 'r') as stream: |
| | prompt_templates = yaml.safe_load(stream) |
| |
|
| | |
| |
|
| |
|