Spaces:
Sleeping
Sleeping
copying code from prior examples, not sure if tools.final_answer is actually necessary
Browse files- app.py +1 -1
- tools/final_answer.py +14 -0
app.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import streamlit as st
|
2 |
-
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel, load_tool
|
3 |
from tools.final_answer import FinalAnswerTool
|
4 |
from huggingface_hub import notebook_login
|
5 |
import yaml
|
|
|
1 |
import streamlit as st
|
2 |
+
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel, load_tool
|
3 |
from tools.final_answer import FinalAnswerTool
|
4 |
from huggingface_hub import notebook_login
|
5 |
import yaml
|
tools/final_answer.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from typing import Any, Optional
|
2 |
+
from smolagents.tools import Tool
|
3 |
+
|
4 |
+
class FinalAnswerTool(Tool):
|
5 |
+
name = "final_answer"
|
6 |
+
description = "Provides a final answer to the given problem."
|
7 |
+
inputs = {'answer': {'type': 'any', 'description': 'The final answer to the problem'}}
|
8 |
+
output_type = "any"
|
9 |
+
|
10 |
+
def forward(self, answer: Any) -> Any:
|
11 |
+
return answer
|
12 |
+
|
13 |
+
def __init__(self, *args, **kwargs):
|
14 |
+
self.is_initialized = False
|