Skip to content
This repository has been archived by the owner on Jun 21, 2024. It is now read-only.

Wolfram Alpha #8

Open
conceptofmind opened this issue Feb 23, 2023 · 1 comment
Open

Wolfram Alpha #8

conceptofmind opened this issue Feb 23, 2023 · 1 comment

Comments

@conceptofmind
Copy link
Owner

'''
Wolfram Alpha Calculator

pip install wolframalpha

Uses Wolfram Alpha API to calculate input query.

input_query - A string, the input query (e.g. "what is 2 + 2?")

output - A string, the answer to the input query

wolfarm_alpha_appid - your Wolfram Alpha API key
'''
def WolframAlphaCalculator(input_query: str):
    wolfram_alpha_appid = 'YOUR_WOLFRAM_ALPHA_APPID'
    wolfram_client = wolframalpha.Client(wolfram_alpha_appid)
    res = wolfram_client.query(input_query)
    assumption = next(res.pods).text
    answer = next(res.results).text
    return f'Assumption: {assumption} \nAnswer: {answer}'
@conceptofmind
Copy link
Owner Author

This is very strong but costly. Maybe if additional funding is provided worth using.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant