Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import app from "../../wolfram_alpha.app.mjs";

export default {
key: "wolfram_alpha-perform-computation",
name: "Perform Computation",
description: "Executes a computation query using the Wolfram Alpha API. [See the documentation](https://products.wolframalpha.com/api/documentation)",
version: "0.0.1",
type: "action",
props: {
app,
input: {
type: "string",
label: "Input",
description: "Text specifying the input string.",
},
width: {
type: "string",
label: "Width",
description: "Specify an approximate width limit for text and tables. Eg. `200`, `500`. This parameter does not affect plots or graphics. Width values are approximate; behavior may vary for different content.",
optional: true,
},
maxWidth: {
type: "string",
label: "Max Width",
description: "Specify an extended maximum width for large objects. Eg. `200`, `500`. This parameter does not affect plots or graphics. Width values are approximate; behavior may vary for different content.",
optional: true,
},
plotWidth: {
type: "string",
label: "Plot Width",
description: "Specify an approximate width limit for plots and graphics. Eg. `100`, `200`. This parameter does not affect text or tables. Width values are approximate; behavior may vary for different content.",
optional: true,
},
mag: {
type: "string",
label: "Magnification",
description: "Specify magnification of objects within a pod. Eg. `0.5`, `1.0`, `2.0`. Changing this parameter does not affect the overall size of pods.",
optional: true,
},
assumption: {
type: "string",
label: "Assumption",
description: "Specifies an assumption, such as the meaning of a word or the value of a formula variable. Eg. `*C.pi-_*Movie`, `DateOrder_**Day.Month.Year--`. Assumptions made implicitly by the API. Values for this parameter are given by the input properties of `<value>` subelements of `<assumption>` elements in XML results.",
optional: true,
},
},
methods: {
performComputation(args = {}) {
return this.app.makeRequest({
path: "/llm-api",
...args,
});
},
},
async run({ $ }) {
const {
performComputation,
input,
width,
maxWidth,
plotWidth,
mag,
assumption,
} = this;

const response = await performComputation({
$,
params: {
input,
width,
maxwidth: maxWidth,
plotwidth: plotWidth,
mag,
assumption,
},
});

$.export("$summary", "Computation performed successfully");
return response;
},
};
7 changes: 7 additions & 0 deletions components/wolfram_alpha/common/constants.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const BASE_URL = "https://www.wolframalpha.com";
const VERSION_PATH = "/api/v1";

export default {
BASE_URL,
VERSION_PATH,
};
7 changes: 5 additions & 2 deletions components/wolfram_alpha/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/wolfram_alpha",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream Wolfram Alpha Components",
"main": "wolfram_alpha.app.mjs",
"keywords": [
Expand All @@ -11,5 +11,8 @@
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.0.3"
}
}
}
24 changes: 20 additions & 4 deletions components/wolfram_alpha/wolfram_alpha.app.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
import { axios } from "@pipedream/platform";
import constants from "./common/constants.mjs";

export default {
type: "app",
app: "wolfram_alpha",
propDefinitions: {},
methods: {
// this.$auth contains connected account data
authKeys() {
console.log(Object.keys(this.$auth));
getUrl(path) {
return `${constants.BASE_URL}${constants.VERSION_PATH}${path}`;
},
getAuthParams(params) {
return {
...params,
appid: this.$auth.app_id,
};
},
makeRequest({
$ = this, path, params, ...args
} = {}) {
return axios($, {
...args,
url: this.getUrl(path),
params: this.getAuthParams(params),
});
},
},
};
17 changes: 8 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading