-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat(rightbrain): added rightbrain block and rightbrain_run_task
tool
#363
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
base: main
Are you sure you want to change the base?
Conversation
This reverts commit ded8a0e.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@pete001 is attempting to deploy a commit to the Sim Studio Team on Vercel. A member of the Team first needs to authorize it. |
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.
PR Summary
Added Rightbrain integration to enable running AI tasks through Rightbrain's API, allowing users to deploy LLMs for specific tasks across applications and workflows.
- The URL validation in
/apps/sim/tools/rightbrain/run_task.ts
needs improvement - currently processes URLs without validating structure before accessing array indices - Response transformation in
run_task.ts
should validate data structure before property access - Generic
object
type used in/apps/sim/tools/rightbrain/types.ts
could be more specific for better type safety - Inconsistencies exist between type definitions in documentation (
rightbrain.mdx
) and implementation - The URL processing function in
run_task.ts
discards its return value, making the validation ineffective
💡 (1/5) You can manually trigger the bot by mentioning @greptileai in a comment!
10 file(s) reviewed, 8 comment(s)
Edit PR Review Bot Settings | Greptile
outputs: { | ||
response: { | ||
type: { | ||
charged_credits: 'any', |
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.
style: charged_credits type should be more specific than 'any' - based on the Rightbrain API docs this should be a number
task_id: 'string', | ||
task_revision_id: 'string', | ||
total_tokens: 'number', | ||
is_error: 'any', |
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.
style: is_error should be typed as boolean rather than 'any' for better type safety
is_error: 'any', | |
is_error: 'boolean', |
| Parameter | Type | | ||
| ------------------------ | ------ | | ||
| `charged_credits` | string | | ||
| `created` | string | | ||
| `id` | string | | ||
| `input_processor_timing` | string | | ||
| `input_tokens` | string | | ||
| `llm_call_timing` | string | | ||
| `output_tokens` | string | | ||
| `response` | string | | ||
| `run_data` | string | | ||
| `task_id` | string | | ||
| `task_revision_id` | string | | ||
| `total_tokens` | string | | ||
| `is_error` | string | |
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.
logic: Type inconsistency between docs and implementation - output parameters are documented as 'string' but some are actually 'number' or 'any' according to the block configuration
| Parameter | Type | | |
| ------------------------ | ------ | | |
| `charged_credits` | string | | |
| `created` | string | | |
| `id` | string | | |
| `input_processor_timing` | string | | |
| `input_tokens` | string | | |
| `llm_call_timing` | string | | |
| `output_tokens` | string | | |
| `response` | string | | |
| `run_data` | string | | |
| `task_id` | string | | |
| `task_revision_id` | string | | |
| `total_tokens` | string | | |
| `is_error` | string | | |
| Parameter | Type | | |
| ------------------------ | ------ | | |
| `charged_credits` | any | | |
| `created` | string | | |
| `id` | string | | |
| `input_processor_timing` | any | | |
| `input_tokens` | number | | |
| `llm_call_timing` | any | | |
| `output_tokens` | number | | |
| `response` | json | | |
| `run_data` | json | | |
| `task_id` | string | | |
| `task_revision_id` | string | | |
| `total_tokens` | number | | |
| `is_error` | any | |
@@ -65,6 +65,7 @@ | |||
"@radix-ui/react-toggle": "^1.1.2", | |||
"@radix-ui/react-tooltip": "^1.1.6", | |||
"@react-email/components": "^0.0.34", | |||
"@rightbrain/sdk": "^0.1.2", |
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.
style: Consider pinning to exact version (0.1.2) instead of using caret (^0.1.2) since this is a very early SDK version that may have breaking changes
url: (params) => { | ||
processUrl(params.url) | ||
return params.url | ||
}, |
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.
logic: processUrl() result is unused but contains important parsed values that could be needed later
const baseUrl = urlInstance.pathname.split('/') | ||
const orgId = baseUrl[4] | ||
const projectId = baseUrl[6] | ||
const taskId = baseUrl[8] |
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.
logic: array access without length validation could throw if URL doesn't have expected path segments
const baseUrl = urlInstance.pathname.split('/') | |
const orgId = baseUrl[4] | |
const projectId = baseUrl[6] | |
const taskId = baseUrl[8] | |
const baseUrl = urlInstance.pathname.split('/') | |
if (baseUrl.length < 9) { | |
throw new Error('Invalid URL format: missing required path segments') | |
} | |
const orgId = baseUrl[4] | |
const projectId = baseUrl[6] | |
const taskId = baseUrl[8] |
|
||
export interface RightBrainRunTaskParams { | ||
url: string | ||
inputs: object |
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.
style: Using generic object
type loses type information. Consider using a more specific type or making this generic with constraints.
} | ||
|
||
export interface RightBrainRunTaskResponse extends ToolResponse { | ||
output: TaskRun<object, object> |
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.
style: TaskRun<object, object> is too generic. Consider using more specific types or making the interface generic with appropriate constraints.
da0d8ca
to
8881559
Compare
1b3f825
to
b9b662b
Compare
5fec813
to
b42c43a
Compare
Description
Added rightbrain block and
rightbrain_run_task
toolType of change
How Has This Been Tested?
Tested the
rightbrain_run_task
tool and rightbrain block manually.Checklist:
npm test
)Security Considerations:
Additional Information:
Added the
@rightbrain/sdk
package, but it's currently used only for TypeScript types.