-
Notifications
You must be signed in to change notification settings - Fork 5.6k
feat(strale): add Strale — 290+ quality-tested data capabilities #20584
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
Open
petterlindstrom79
wants to merge
5
commits into
PipedreamHQ:master
Choose a base branch
from
petterlindstrom79:feat/add-strale
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
327b1bb
feat(strale): add Strale — 290+ quality-tested data capabilities
petterlindstrom79 e36d88b
Merge branch 'master' into feat/add-strale
michelle0927 feb05bf
updates
michelle0927 65bd6b0
updates
michelle0927 95a2592
fix summary
michelle0927 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
65 changes: 65 additions & 0 deletions
65
components/strale/actions/execute-capability/execute-capability.mjs
This file contains hidden or 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,65 @@ | ||
| import strale from "../../strale.app.mjs"; | ||
|
|
||
| export default { | ||
| name: "Execute Capability", | ||
| version: "0.0.1", | ||
| key: "strale-execute-capability", | ||
| description: "Execute a specific Strale capability by slug with the provided inputs. Returns structured data with quality score and audit trail. [See the documentation](https://strale.dev)", | ||
| type: "action", | ||
| annotations: { | ||
| readOnlyHint: false, | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| }, | ||
| props: { | ||
|
michelle0927 marked this conversation as resolved.
|
||
| strale, | ||
| capabilitySlug: { | ||
| propDefinition: [ | ||
| strale, | ||
| "capabilitySlug", | ||
| ], | ||
| }, | ||
| inputs: { | ||
| propDefinition: [ | ||
| strale, | ||
| "inputs", | ||
| ], | ||
| }, | ||
| maxPriceCents: { | ||
| propDefinition: [ | ||
| strale, | ||
| "maxPriceCents", | ||
| ], | ||
| }, | ||
| dryRun: { | ||
| propDefinition: [ | ||
| strale, | ||
| "dryRun", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const data = { | ||
| capability_slug: this.capabilitySlug, | ||
| inputs: this.inputs, | ||
| max_price_cents: this.maxPriceCents, | ||
| }; | ||
|
|
||
| if (this.dryRun) { | ||
| data.dry_run = true; | ||
| } | ||
|
|
||
| const response = await this.strale.execute({ | ||
| $, | ||
| data, | ||
| }); | ||
|
|
||
| if (this.dryRun) { | ||
| $.export("$summary", `Dry run matched capability "${response.capability?.slug ?? this.capabilitySlug}"`); | ||
| } else { | ||
| $.export("$summary", `Successfully executed "${this.capabilitySlug}" (transaction: ${response?.result?.transaction_id ?? "n/a"})`); | ||
| } | ||
|
|
||
| return response; | ||
| }, | ||
| }; | ||
68 changes: 68 additions & 0 deletions
68
components/strale/actions/search-and-execute/search-and-execute.mjs
This file contains hidden or 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,68 @@ | ||
| import strale from "../../strale.app.mjs"; | ||
|
|
||
| export default { | ||
| name: "Search and Execute", | ||
| version: "0.0.1", | ||
| key: "strale-search-and-execute", | ||
| description: "Describe what you need in plain language, and Strale finds the best-matching capability and executes it. Combines search (POST /v1/suggest) and execution (POST /v1/do) in one step. [See the documentation](https://strale.dev)", | ||
|
michelle0927 marked this conversation as resolved.
|
||
| type: "action", | ||
| annotations: { | ||
| readOnlyHint: false, | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| }, | ||
| props: { | ||
|
michelle0927 marked this conversation as resolved.
|
||
| strale, | ||
| task: { | ||
| propDefinition: [ | ||
| strale, | ||
| "task", | ||
| ], | ||
| }, | ||
| inputs: { | ||
| propDefinition: [ | ||
| strale, | ||
| "inputs", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| maxPriceCents: { | ||
| propDefinition: [ | ||
| strale, | ||
| "maxPriceCents", | ||
| ], | ||
| }, | ||
| dryRun: { | ||
| propDefinition: [ | ||
| strale, | ||
| "dryRun", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const data = { | ||
| task: this.task, | ||
| inputs: this.inputs ?? {}, | ||
| max_price_cents: this.maxPriceCents, | ||
| }; | ||
|
|
||
| if (this.dryRun) { | ||
| data.dry_run = true; | ||
| const response = await this.strale.execute({ | ||
| $, | ||
| data, | ||
| }); | ||
| $.export("$summary", `Dry run completed for "${this.task}"`); | ||
| return response; | ||
|
michelle0927 marked this conversation as resolved.
|
||
| } | ||
|
|
||
| const response = await this.strale.execute({ | ||
| $, | ||
| data, | ||
| }); | ||
|
|
||
| $.export("$summary", `Executed "${this.task}" (transaction: ${response?.result?.transaction_id ?? "n/a"})`); | ||
|
|
||
| return response; | ||
| }, | ||
| }; | ||
42 changes: 42 additions & 0 deletions
42
components/strale/actions/search-capabilities/search-capabilities.mjs
This file contains hidden or 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,42 @@ | ||
| import strale from "../../strale.app.mjs"; | ||
|
|
||
| export default { | ||
| name: "Search Capabilities", | ||
| version: "0.0.1", | ||
| key: "strale-search-capabilities", | ||
| description: "Search Strale's catalog of 290+ data capabilities using natural language. Returns matching capabilities with prices and quality scores. [See the documentation](https://strale.dev)", | ||
| type: "action", | ||
| annotations: { | ||
| readOnlyHint: true, | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| }, | ||
| props: { | ||
|
michelle0927 marked this conversation as resolved.
|
||
| strale, | ||
| task: { | ||
| propDefinition: [ | ||
| strale, | ||
| "task", | ||
| ], | ||
| }, | ||
| limit: { | ||
| propDefinition: [ | ||
| strale, | ||
| "limit", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.strale.suggest({ | ||
| $, | ||
| data: { | ||
| query: this.task, | ||
| limit: this.limit ?? 5, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully searched for matching capabilities for "${this.task}"`); | ||
|
|
||
| return response; | ||
| }, | ||
| }; | ||
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
| @@ -1,11 +1,98 @@ | ||
| import { axios } from "@pipedream/platform"; | ||
|
|
||
| export default { | ||
| type: "app", | ||
| app: "strale", | ||
| propDefinitions: {}, | ||
| description: "Strale is the data layer for AI agents — 290+ quality-tested data capabilities including company verification, sanctions screening, VAT validation, invoice extraction, and more. [See the documentation](https://strale.dev)", | ||
| propDefinitions: { | ||
| task: { | ||
| type: "string", | ||
| label: "Task", | ||
| description: "A natural-language description of what you need (e.g. \"verify a Swedish company\", \"validate this VAT number\").", | ||
| }, | ||
| capabilitySlug: { | ||
| type: "string", | ||
| label: "Capability Slug", | ||
| description: "The slug of the capability to execute (e.g. `swedish-company-data`, `vat-validate`, `email-validate`). [See the catalog](https://strale.dev).", | ||
| }, | ||
| inputs: { | ||
| type: "object", | ||
| label: "Inputs", | ||
| description: "Input parameters for the capability as a JSON object (e.g. `{ \"vat_number\": \"SE556677889901\" }` or `{ \"email\": \"ops@example.com\" }`). The required fields depend on the capability being called.", | ||
| }, | ||
|
michelle0927 marked this conversation as resolved.
|
||
| limit: { | ||
| type: "integer", | ||
| label: "Limit", | ||
| description: "Maximum number of results to return.", | ||
| optional: true, | ||
| default: 5, | ||
| }, | ||
| maxPriceCents: { | ||
| type: "integer", | ||
| label: "Max Price (cents)", | ||
| description: "Maximum price in euro cents you are willing to pay per execution.", | ||
| }, | ||
|
michelle0927 marked this conversation as resolved.
|
||
| dryRun: { | ||
| type: "boolean", | ||
| label: "Dry Run", | ||
| description: "If `true`, validates the request and returns the matched capability without executing or charging.", | ||
| optional: true, | ||
| default: false, | ||
| }, | ||
| }, | ||
| methods: { | ||
| // this.$auth contains connected account data | ||
| authKeys() { | ||
| console.log(Object.keys(this.$auth)); | ||
| _apiKey() { | ||
| return this.$auth.api_key; | ||
| }, | ||
| _baseUrl() { | ||
| return "https://api.strale.io"; | ||
| }, | ||
| _headers() { | ||
| const headers = { | ||
| "Content-Type": "application/json", | ||
| }; | ||
| const apiKey = this._apiKey(); | ||
| if (apiKey) { | ||
| headers["Authorization"] = `Bearer ${apiKey}`; | ||
| } | ||
| return headers; | ||
| }, | ||
| _makeRequest({ | ||
| $ = this, path, ...args | ||
| }) { | ||
| return axios($, { | ||
| url: `${this._baseUrl()}${path}`, | ||
| headers: this._headers(), | ||
| ...args, | ||
| }); | ||
|
michelle0927 marked this conversation as resolved.
|
||
| }, | ||
| suggest(args = {}) { | ||
| return this._makeRequest({ | ||
| path: "/v1/suggest", | ||
| method: "post", | ||
| ...args, | ||
| }); | ||
| }, | ||
| execute(args = {}) { | ||
| return this._makeRequest({ | ||
| path: "/v1/do", | ||
| method: "post", | ||
| ...args, | ||
| }); | ||
| }, | ||
| listCapabilities(args = {}) { | ||
| return this._makeRequest({ | ||
| path: "/v1/capabilities", | ||
| ...args, | ||
| }); | ||
| }, | ||
| getQuality({ | ||
| slug, ...args | ||
| } = {}) { | ||
| return this._makeRequest({ | ||
| path: `/v1/quality/${slug}`, | ||
| ...args, | ||
| }); | ||
| }, | ||
| }, | ||
| }; | ||
| }; | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.