Spaces:
Running
Running
| <html> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <meta name="viewport" content="width=device-width" /> | |
| <title>My static Space</title> | |
| <link rel="stylesheet" href="style.css" /> | |
| </head> | |
| <body> | |
| <div class="card"> | |
| <h1>Wolfram Alpha Tool for HuggingFace Agents</h1> | |
| <p>Not sure how to set this manually (push_to_hub does not seem to work for tool classes) so:</p> | |
| <p> Copy the contents of:<p> | |
| https://huggingface.co/spaces/LecJackS/wolfram-alpha-query/blob/main/wolfram-alpha-tool | |
| <h1>Usage:</h1> | |
| <code> | |
| CFG_appid=<WOLFRAM API KEY> | |
| # https://products.wolframalpha.com/simple-api/documentation | |
| </code> | |
| <h3>Test it:</h3> | |
| <code> | |
| query = "Integrate [ log(x)^2 + e^(x^2) dx ]" | |
| wolframalpha_tool = WolframAlpha() | |
| print(wolframalpha_tool(query)) | |
| </code> | |
| <h3>Add tool to agent:</h3> | |
| <code> | |
| agent = HfAgent("https://api-inference.huggingface.co/models/bigcode/starcoder", additional_tools=[wolframalpha_tool]) | |
| </code> | |
| <h3>Ask the agent to solve some math:</h3> | |
| <code> | |
| res = agent.run("Solve the following equation: Area of circle of radius 2") | |
| print(res) | |
| res = agent.run("Integrate log(x)^2 + e^(x^2) dx") | |
| print(res) | |
| </code> | |
| </div> | |
| </body> | |
| </html> | |