Skip to main content
All CollectionsCustom Plugins
Enhancing Custom Plugins with Global Variables in TeamAI
Enhancing Custom Plugins with Global Variables in TeamAI
M
Written by Muhammad Jawad
Updated over a week ago

In our previous articles, we explored the power of custom plugins in TeamAI and how they allow users to extend the functionality of their AI models by interacting with external APIs and services. Today, we'll dive into a new feature that further enhances the capabilities of custom plugins: global variables.

What are Global Variables?

Global variables are pre-defined variables that can be used directly in your custom plugin configuration without the need to define them as parameters. Unlike user-defined parameters, which require you to provide a value when testing or using the plugin, global variables have their values automatically set by TeamAI.


Using Global Variables in Custom Plugins

Global variables can be used in various parts of your custom plugin configuration, including:

  • Headers

  • Query parameters

  • Endpoints

To use a global variable, simply reference its name wrapped in double curly braces, like this: {{VARIABLE_NAME}}. TeamAI will automatically replace the variable with its corresponding value when the plugin is executed.

Supported Global Variables

Currently, TeamAI supports one global variable: {{DATE}}. When used in your custom plugin configuration, {{DATE}} will be automatically replaced with the current date. This can be particularly useful for plugins that require date-based data or for generating dynamic content based on the current date.

We plan to introduce more global variables in the future to further extend the capabilities of custom plugins in TeamAI.

Best Practices and Considerations

When using global variables in your custom plugins, there are a few best practices and considerations to keep in mind:

  1. Avoid naming collisions: You cannot create user-defined parameters with the same names as global variables. This restriction is in place to prevent naming collisions and ensure the proper functioning of your custom plugins.

  2. Use global variables judiciously: While global variables can be a powerful tool, it's important to use them judiciously and only when they truly enhance the functionality of your plugin. Overusing global variables can make your plugin configuration more complex and harder to maintain.

  3. Test your plugins thoroughly: As with any custom plugin, it's crucial to test your plugins that utilize global variables thoroughly to ensure they function as expected and provide the desired user experience.

Conclusion

Global variables are a valuable addition to custom plugins in TeamAI, allowing users to leverage pre-defined variables without the need for manual configuration. By using global variables like {{DATE}}, you can create more dynamic and flexible custom plugins that adapt to the current context.

As you continue to develop custom plugins in TeamAI, consider how global variables can be used to streamline your plugin configuration and provide a more seamless user experience. Stay tuned for more global variables in the future, and happy plugin building!


โ€‹


โ€‹

Did this answer your question?