Skip to content

Enhance agent tool function registration with direct function support#402

Merged
MervinPraison merged 1 commit intomainfrom
develop
Mar 3, 2025
Merged

Enhance agent tool function registration with direct function support#402
MervinPraison merged 1 commit intomainfrom
develop

Conversation

@MervinPraison
Copy link
Copy Markdown
Owner

  • Added support for directly registering tool functions without global declaration
  • Implemented auto-generation of tool definitions for registered functions
  • Created new example scripts demonstrating direct function tool registration
  • Updated package version to 1.0.18
  • Expanded Agent configuration to support toolFunctions property
  • Added type exports for improved type safety

- Added support for directly registering tool functions without global declaration
- Implemented auto-generation of tool definitions for registered functions
- Created new example scripts demonstrating direct function tool registration
- Updated package version to 1.0.18
- Expanded Agent configuration to support `toolFunctions` property
- Added type exports for improved type safety
@MervinPraison MervinPraison merged commit ceddd9e into main Mar 3, 2025
4 of 6 checks passed
Copy link
Copy Markdown
Contributor

@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 enhances the agent tool function registration process by allowing direct registration of tool functions without requiring global declaration. It implements auto-generation of tool definitions for registered functions, adds example scripts demonstrating the new functionality, updates the package version, expands the Agent configuration to support a toolFunctions property, and adds type exports for improved type safety. The changes primarily affect the src/agent/proxy.ts and src/agent/simple.ts files, along with the addition of new example files.

Highlights

  • Direct Tool Function Registration: The pull request introduces the ability to directly register tool functions within the Agent configuration using the toolFunctions property, eliminating the need for global declarations.
  • Auto-generation of Tool Definitions: The system now automatically generates tool definitions for registered functions if they are not already provided, simplifying the tool registration process.
  • New Example Scripts: New example scripts, such as direct-function-tools.ts, demonstrate the usage of direct function tool registration.
  • Agent Configuration Update: The Agent configuration is expanded to include the toolFunctions property, allowing for direct registration of tool functions.

Changelog

Click here to see the changelog
  • src/praisonai-ts/examples/simple/direct-function-tools.ts
    • Added a new example demonstrating direct function registration for agent tools. The example defines getWeather and getTime functions and registers them directly with the agent, showcasing how to use tool functions without global declarations (lines 1-35).
  • src/praisonai-ts/examples/simple/multi-tool-call.ts
    • No functional changes, only adding a new example file.
  • src/praisonai-ts/examples/simple/single-agent-tool-call.ts
    • No functional changes, only adding a new example file.
  • src/praisonai-ts/package.json
    • Updated the package version from 1.0.17 to 1.0.18 (line 3).
    • Updated praisonai dependency from 1.0.12 to 1.0.17 (line 65).
  • src/praisonai-ts/src/agent/index.ts
    • Added type exports for ProxyAgentConfig and SimpleAgentConfig to improve type safety (lines 9, 12).
  • src/praisonai-ts/src/agent/proxy.ts
    • Added toolFunctions property to the ProxyAgentConfig interface, allowing for direct registration of tool functions (line 9).
    • Modified the Agent constructor to pass the toolFunctions configuration to the SimpleAgent (line 40).
  • src/praisonai-ts/src/agent/simple.ts
    • Added toolFunctions property to the SimpleAgentConfig interface (line 14).
    • Modified the Agent constructor to register directly provided tool functions and auto-generate tool definitions if not already provided (lines 44-54).
    • Added hasToolDefinition method to check if a tool definition exists for a given function name (lines 75-89).
    • Added addAutoGeneratedToolDefinition method to auto-generate a tool definition based on the function's parameters (lines 91-143).
  • src/praisonai-ts/tests/development/simple/direct-function-tools.ts
    • Added a new test file demonstrating direct function registration for agent tools. This mirrors the example in src/praisonai-ts/examples/simple/direct-function-tools.ts but is located in the test directory (lines 1-35).
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.


Did you know?

The first high-level programming language was Fortran, created in the mid-1950s by John Backus and his team at IBM.

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.

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 3, 2025

Deploy Preview for praisonai canceled.

Name Link
🔨 Latest commit 14049e4
🔍 Latest deploy log https://app.netlify.com/sites/praisonai/deploys/67c564bc78214800085b42b1

Copy link
Copy Markdown
Contributor

@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

This pull request introduces a significant enhancement by allowing direct registration of tool functions, simplifying the agent configuration and improving code clarity. The auto-generation of tool definitions is a valuable addition. The examples provided are helpful in understanding the new feature. Overall, the changes are well-structured and contribute positively to the project.

Merge Readiness

The changes introduced in this pull request are well-structured and enhance the functionality of the agent framework. The addition of direct function registration simplifies agent configuration and improves code clarity. The auto-generation of tool definitions is a valuable feature. The provided examples are helpful in understanding the new functionality. I am unable to approve this pull request, and recommend that others review and approve this code before merging. Given the absence of any CRITICAL or HIGH severity issues, the pull request appears to be in good shape for merging.

shaneholloman pushed a commit to shaneholloman/praisonai that referenced this pull request Feb 4, 2026
Enhance agent tool function registration with direct function support
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