Skip to content
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

Expand tool registration documentation and examples #403

Merged
merged 1 commit into from
Mar 3, 2025
Merged

Conversation

MervinPraison
Copy link
Owner

  • Added comprehensive TypeScript documentation for tool registration methods in docs/js/typescript.mdx
  • Created new README example file examples/README-tool-examples.md with detailed tool registration approaches
  • Updated example scripts to demonstrate direct function tool registration
  • Refined agent tool registration logic to support multiple function registration styles
  • Bumped package version to 1.0.19

- Added comprehensive TypeScript documentation for tool registration methods in `docs/js/typescript.mdx`
- Created new README example file `examples/README-tool-examples.md` with detailed tool registration approaches
- Updated example scripts to demonstrate direct function tool registration
- Refined agent tool registration logic to support multiple function registration styles
- Bumped package version to 1.0.19
@MervinPraison MervinPraison merged commit 7c65791 into main Mar 3, 2025
3 of 6 checks passed
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Hello @MervinPraison, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

This pull request focuses on expanding the documentation and examples for tool registration within the PraisonAI TypeScript framework. It introduces comprehensive TypeScript documentation for tool registration methods, a new README example file with detailed tool registration approaches, updates to example scripts to demonstrate direct function tool registration, and refines agent tool registration logic to support multiple function registration styles. Additionally, the package version is bumped to 1.0.19.

Highlights

  • Documentation: Added comprehensive TypeScript documentation for tool registration methods in docs/js/typescript.mdx, including examples for single agent tool calls and direct function tools.
  • Examples: Created a new README example file examples/README-tool-examples.md that provides detailed examples of different tool registration approaches, including using the tools array with function objects, the toolFunctions object, and pre-defined tool definitions.
  • Direct Function Registration: Updated example scripts and refined agent tool registration logic to support direct function tool registration, allowing functions to be registered directly as tools without needing to be made globally available.
  • Package Version: Bumped the package version to 1.0.19.

Changelog

Click here to see the changelog
  • docs/js/typescript.mdx
    • Added a new section with comprehensive examples for tool calls, including single agent tool call and direct function tools.
    • Demonstrates how to create agents with tool calling capabilities and directly registered function tools.
  • src/praisonai-ts/examples/README-tool-examples.md
    • Created a new file to demonstrate different ways to register tool functions in PraisonAI.
    • Provides examples for using the tools array with function objects, the toolFunctions object, and pre-defined tool definitions.
    • Includes a combined approach example to showcase mixing different registration methods.
  • src/praisonai-ts/examples/simple/direct-function-tools.ts
    • Updated the example to register functions directly as an array in the tools option instead of using the toolFunctions object.
    • Simplified the agent configuration by directly passing the functions in the tools array.
  • src/praisonai-ts/package.json
    • Bumped the package version from 1.0.18 to 1.0.19.
  • src/praisonai-ts/src/agent/simple.ts
    • Modified the tools property in the SimpleAgentConfig interface to accept an array of any or Function types.
    • Updated the agent initialization logic to process the tools array, handling both tool definitions and functions.
    • Added logic to automatically generate tool definitions for functions passed in the tools array, including generating a random name for functions without names.
    • Ensured that function names are valid and auto-generated if necessary.
    • Added debug logging for auto-generated tool definitions.
    • Refactored to use function names or generate names if not provided.
  • src/praisonai-ts/src/llm/openai.ts
    • Added a check to ensure the function name is valid and generate a random name if it's missing or empty.
    • Modified the convertToOpenAITool function to generate a valid function name if none is provided.
    • Added a default description for tools if none is provided.
  • src/praisonai-ts/tests/development/simple/direct-function-tools.ts
    • Updated the test example to register functions directly as an array in the tools option instead of using the toolFunctions object.
    • Simplified the agent configuration by directly passing the functions in the tools array.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


In realms of code, where agents roam,
A tool's true worth is in its home.
Register it well, with docs so clear,
And watch your agent conquer fear.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request enhances the documentation and examples for tool registration in PraisonAI, providing comprehensive TypeScript documentation, new README examples, and refined agent tool registration logic. The changes aim to clarify and simplify the process of registering tools for agents, supporting multiple function registration styles. Overall, the changes are well-structured and contribute positively to the usability of the framework.

Merge Readiness

The pull request is well-structured and provides valuable enhancements to the documentation and examples for tool registration in PraisonAI. The changes clarify and simplify the process of registering tools for agents, supporting multiple function registration styles. Given the thoroughness of the changes and the absence of any critical or high severity issues, the pull request is in good shape to be merged, but please have others review and approve this code before merging. I am unable to directly approve the pull request.

Copy link

netlify bot commented Mar 3, 2025

Deploy Preview for praisonai ready!

Name Link
🔨 Latest commit f9ba1c8
🔍 Latest deploy log https://app.netlify.com/sites/praisonai/deploys/67c56761d3a6ee00088c66c5
😎 Deploy Preview https://deploy-preview-403--praisonai.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

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.

1 participant