-
Notifications
You must be signed in to change notification settings - Fork 29
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
wolframalpha example #1
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
# @describe Get an answer to a question using Wolfram Alpha. Input should the the query in English. | ||
# Use it to answer user questions that require computation, detailed facts, data analysis, or complex queries. | ||
# This ensures accurate and precise answers. | ||
# @option --query! The query to search for. | ||
# @env WOLFRAM_API_KEY! The API key used to connect to WolframAlpha | ||
|
||
|
||
main() { | ||
local curl_args=( | ||
-sSf -G | ||
--data-urlencode "output=JSON" | ||
--data-urlencode "format=plaintext" | ||
--data-urlencode "input=$argc_query" | ||
--data-urlencode "appid=$WOLFRAM_API_KEY" | ||
"https://api.wolframalpha.com/v2/query" | ||
) | ||
curl "${curl_args[@]}" | jq -r '.queryresult.pods[] | select(.subpods[0].plaintext != "") | .title, .subpods[0].plaintext' | ||
} | ||
|
||
eval "$(argc --argc-eval "$0" "$@")" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you specifically point it out? Is it really only possible to use English?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that is the case, WolframAlpha natural language processing features are minimal as far I know.
PS: although the website now lists English, Spanish and Japanese
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's best not to limit. Each words occupies tokens.
If users use other languages and feel that the effect is not good, they will not use it, and there is no need to point it out here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those lines there actually make it useful for people using other languages. They are supposed to make the AI translate the query before passing it to WolframAlpha. I think a few words is a good price to pay for better accessibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My understanding of this sentence is that
search_wolframalpha
only supports English. If you input other languages, it cannot be processed. Bye bye.This does not tell LLM to translate into English.
Remove this sentence here, add more comments on
--query
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe, I am misunderstanding something then. What exactly is the input on the LLM when using functions? I thought it was the
@describe
text, not the@option
text.PS: I just tested my intuition and it seems to be correct. The LLM (at least the latest gpt-4o) translated a query in hungarian
tényező a szám 12141124125125125
into> call search_wolframalpha --query 'factor the number 12141124125125125' Yes
.Inputting the hungarian directly to WolframAlpha (website) gives nonsensical results.
Without that sentence therefore the AI may not translate anything and miss results.
PS2: Thinking about it more carefully, maybe the
@describe
field is used in 2 contexts, and those two are hard to conflate. It is what the user sees when figuring out what a function does, but it is also what the AI sees when trying to do the same.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you've tested it, I'll defer to your judgment. Go ahead and fix the grammar, and I'm ready to merge.