Skip to content

feat: add TS Pre, post and schema processors to doc #1088

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 5 commits into from
Jan 2, 2025

Conversation

abhishekpatil4
Copy link
Contributor

@abhishekpatil4 abhishekpatil4 commented Dec 24, 2024

Important

Adds TypeScript examples for schema, input, and output processing in processing-actions.mdx.

  • Documentation:
    • Adds TypeScript examples to processing-actions.mdx for schema, input, and output processing.
    • Demonstrates TypeScript code for modifying LINEAR_CREATE_LINEAR_ISSUE action schema, inputs, and outputs.
    • Shows how to integrate processors into the toolset and execute an agent in TypeScript.

This description was created by Ellipsis for 8c8ca05. It will automatically update as commits are pushed.

Copy link

vercel bot commented Dec 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
composio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 2, 2025 10:43am

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Reviewed everything up to 56680fc in 19 seconds

More details
  • Looked at 227 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. docs/patterns/tools/use-tools/processing-actions.mdx:165
  • Draft comment:
    Ensure that toolResponse.data is defined and has an id property before accessing it to avoid runtime errors. Consider using optional chaining or a conditional check.
  • Reason this comment was not posted:
    Comment did not seem useful.
2. docs/patterns/tools/use-tools/processing-actions.mdx:67
  • Draft comment:
    There's a typo in the key 'successfull'. It should be 'successful'.
  • Reason this comment was not posted:
    Comment was not on a valid diff hunk.

Workflow ID: wflow_FR9wuM3TtSAFvsjn


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

appName: string;
toolResponse: ActionExecutionResDto;
}) => {
const issueId = toolResponse.data.id;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Consider adding error handling for the case when toolResponse.data.id is undefined:

const postProcessor: TPostProcessor = ({ actionName, appName, toolResponse }: {
  actionName: string;
  appName: string;
  toolResponse: ActionExecutionResDto;
}) => {
  if (!toolResponse.data?.id) {
    return { data: null, successful: false, error: 'No issue ID found in response' };
  }
  const issueId = toolResponse.data.id;
  return { data: { id: issueId }, successful: true };
}

<Step title="Schema Modifier">
This will be used to modify the schema of the `LINEAR_CREATE_LINEAR_ISSUE` action, we remove the parameters `project_id` and `team_id` as required fields, later in the program we will pass these values as inputs to the action manually. The technical term for this is **Schema Processing**.
```typescript TypeScript
const schemaProcessor: TSchemaProcessor = ({
Copy link
Collaborator

Choose a reason for hiding this comment

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

Consider adding a return type annotation for better type safety and documentation:

const schemaProcessor: TSchemaProcessor = ({
  actionName,
  toolSchema,
}: {
  actionName: string;
  toolSchema: RawActionData;
}): RawActionData => {


const agentExecutor = new AgentExecutor({ agent, tools, verbose: true });

const response = await agentExecutor.invoke({ input: "Create an issue on linear to update the frontend to with new design and description 'Refer to the design in the attachment', estimate is 5 (L) & return the issue id" });
Copy link
Collaborator

Choose a reason for hiding this comment

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

There's a minor grammatical error in the example task string: "to update the frontend to with new design" should be "to update the frontend with new design"

}) => {
const modifiedParams = { ...params };

modifiedParams.project_id = "e708162b-9b1a-4901-ab93-0f0149f9d805";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Consider extracting these IDs into constants at the top of the file or into a configuration object for better maintainability:

const LINEAR_CONFIG = {
  PROJECT_ID: 'e708162b-9b1a-4901-ab93-0f0149f9d805',
  TEAM_ID: '249ee4cc-7bbb-4ff1-adbe-d3ef2f3df94e'
} as const;

// Then in the preprocessor:
modifiedParams.project_id = LINEAR_CONFIG.PROJECT_ID;
modifiedParams.team_id = LINEAR_CONFIG.TEAM_ID;

@shreysingla11
Copy link
Collaborator

Code Review Summary

Overall, this is a well-structured documentation update that adds valuable TypeScript examples alongside the existing Python documentation. The code examples are clear and follow good practices. Here's a detailed assessment:

Strengths:

✅ Well-organized documentation with clear step-by-step examples
✅ Good use of TypeScript types and interfaces
✅ Consistent code style with the existing codebase
✅ Clear explanations for each processor type

Suggestions for Improvement:

  1. Add error handling in processors (especially for null/undefined values)
  2. Add explicit return type annotations for better type safety
  3. Extract hardcoded values into constants
  4. Fix minor grammatical issues in example text

Code Quality Rating: 8/10

The code is well-structured and follows TypeScript best practices, with room for minor improvements in error handling and type safety.

Please address the comments I've left on specific lines. Once these are addressed, this will be a very solid addition to the documentation.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 8c8ca05 in 11 seconds

More details
  • Looked at 13 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. docs/patterns/tools/use-tools/processing-actions.mdx:194
  • Draft comment:
    Typo in key name 'successfull'. It should be 'successful'.
  'success': output_data['successful'],
  • Reason this comment was not posted:
    Comment was not on a valid diff hunk.

Workflow ID: wflow_EvMaq2vKSQq1QvNf


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@himanshu-dixit himanshu-dixit changed the title feat: add TS processors to doc feat: add TS Pre, post and schema processors to doc Dec 26, 2024
@himanshu-dixit himanshu-dixit merged commit 0ca89ac into master Jan 2, 2025
10 checks passed
@himanshu-dixit himanshu-dixit deleted the feat/docs-add-ts-processors branch January 2, 2025 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants