wolfram-alpha-query / index.html
LecJackS's picture
Usage instructions
13758b1
raw
history blame
1.57 kB
<!DOCTYPE html>
<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>
<a href="https://huggingface.co/spaces/LecJackS/wolfram-alpha-query/blob/main/wolfram-alpha-tool">https://huggingface.co/spaces/LecJackS/wolfram-alpha-query/blob/main/wolfram-alpha-tool</a>
<h1>Usage instructions:</h1>
<h3>Save WolframAlpha API key:</h3>
<code>
CFG_appid = WOLFRAM_API_KEY<br>
<a href="https://products.wolframalpha.com/simple-api/documentation">https://products.wolframalpha.com/simple-api/documentation</a>
</code>
<h3>Test it:</h3>
<code>
query = "Integrate [ log(x)^2 + e^(x^2) dx ]"<br>
wolframalpha_tool = WolframAlpha()<br>
print(wolframalpha_tool(query))<br>
</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")<br>
print(res)<br>
<br>
res = agent.run("Integrate log(x)^2 + e^(x^2) dx")<br>
print(res)<br>
</code>
</div>
</body>
</html>