Remove docker example
This commit is contained in:
parent
8646697c73
commit
65a93870cc
|
@ -1,35 +0,0 @@
|
||||||
from smolagents.default_tools.search import DuckDuckGoSearchTool
|
|
||||||
from smolagents.docker_alternative import DockerPythonInterpreter
|
|
||||||
|
|
||||||
|
|
||||||
from smolagents.tools import Tool
|
|
||||||
|
|
||||||
class DummyTool(Tool):
|
|
||||||
name = "echo"
|
|
||||||
description = '''Perform a web search based on your query (think a Google search) then returns the top search results as a list of dict elements.
|
|
||||||
Each result has keys 'title', 'href' and 'body'.'''
|
|
||||||
inputs = {
|
|
||||||
"cmd": {"type": "string", "description": "The search query to perform."}
|
|
||||||
}
|
|
||||||
output_type = "any"
|
|
||||||
|
|
||||||
def forward(self, cmd: str) -> str:
|
|
||||||
return cmd
|
|
||||||
|
|
||||||
|
|
||||||
container = DockerPythonInterpreter()
|
|
||||||
|
|
||||||
output = container.execute("x = 5")
|
|
||||||
print(f"first output: {output}")
|
|
||||||
output = container.execute("print(x)")
|
|
||||||
print(f"second output: {output}")
|
|
||||||
|
|
||||||
breakpoint()
|
|
||||||
|
|
||||||
print("---------")
|
|
||||||
|
|
||||||
|
|
||||||
output = container.execute("res = DummyTool(cmd='echo this'); print(res())")
|
|
||||||
print(output)
|
|
||||||
|
|
||||||
container.stop()
|
|
Loading…
Reference in New Issue