Skip to content

feat(wolfram): add Wolfram Alpha integration for math/science queries #855

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 12, 2025

Conversation

electron271
Copy link
Member

@electron271 electron271 commented May 12, 2025

adds /wolfram command that returns a answer to provided question in image form
image

Summary by Sourcery

Integrate Wolfram Alpha as a new tool, enabling users to query math and science questions via a Discord command and receive visual answers.

New Features:

  • Add /wolfram command to query Wolfram Alpha and return results as images.

Enhancements:

  • Introduce Wolfram Alpha API configuration and category for tools.

Documentation:

  • Add WOLFRAM_APP_ID to .env.example.

Copy link
Contributor

sourcery-ai bot commented May 12, 2025

Reviewer's Guide

This pull request introduces a new /wolfram command that integrates Wolfram Alpha's Simple API for math and science queries, returning results as images. It adds a new cog, updates configuration and help files, and ensures proper environment variable handling.

File-Level Changes

Change Details Files
Add Wolfram Alpha integration as a new Discord command.
  • Create a new cog at tux/cogs/tools/wolfram.py implementing the /wolfram command.
  • Command queries Wolfram Alpha Simple API, processes the image, and returns it as an embed attachment.
  • Handles missing API key by unloading the cog and logging a warning.
tux/cogs/tools/wolfram.py
Update configuration to support Wolfram Alpha API key.
  • Add WOLFRAM_APP_ID to config, sourced from environment variables.
  • Document WOLFRAM_APP_ID in .env.example.
tux/utils/config.py
.env.example
Register new 'tools' category for cogs and help UI.
  • Add 'tools' category to cog_loader.py for cog loading priority.
  • Add 'tools' category with icon to help.py for help menu display.
tux/cog_loader.py
tux/help.py

Possibly linked issues

  • #0: The PR adds the /wolfram command implementing the Wolfram Alpha integration requested by the issue.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@electron271 electron271 removed this from the 0.1.0 milestone May 12, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds Wolfram Alpha integration to support math and science queries by introducing a new /wolfram command.

  • Added a new configuration property for Wolfram Alpha credentials.
  • Implemented a new cog in tux/cogs/tools/wolfram.py for handling Wolfram Alpha queries and processing the returned image.
  • Updated help documentation and cog loader to include the new "tools" category.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tux/utils/config.py Added Wolfram Alpha configuration property.
tux/help.py Updated help options to include "tools".
tux/cogs/tools/wolfram.py Implemented new Wolfram Alpha integration command.
tux/cog_loader.py Included new "tools" category with load priority.
.env.example Documented sample configuration for Wolfram Alpha.

Copy link

cloudflare-workers-and-pages bot commented May 12, 2025

Deploying tux with  Cloudflare Pages  Cloudflare Pages

Latest commit: 30e83f8
Status: ✅  Deploy successful!
Preview URL: https://51fb8b70.tux-afh.pages.dev
Branch Preview URL: https://wolfram-alpha.tux-afh.pages.dev

View logs

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @electron271 - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 4 issues found
  • 🟡 Security: 1 issue found
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@electron271 electron271 merged commit bb89ef7 into main May 12, 2025
9 of 10 checks passed
@electron271 electron271 deleted the wolfram-alpha branch May 12, 2025 04:33
Copy link

trunk-io bot commented May 12, 2025

⏱️ 9m total CI duration on this PR

Job Cumulative Duration Recent Runs
Analyze (python) 2m 🟩🟩
pyright 2m 🟩🟩🟩
docker 2m 🟩
Analyze (actions) 2m 🟩🟩
Ruff 1m 🟩🟩🟩

settingsfeedbackdocs ⋅ learn more about trunk.io

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

Successfully merging this pull request may close these issues.

1 participant