agentsociety.agent.decorator

Module Contents

Functions

register_get

Registers a method as an available function.

param_docs

  • Description:

    • A decorator that adds documentation to function parameters.

    • This documentation can be accessed by FormatPrompt when associated with the method.

  • Args:

    • **param_descriptions: Keyword arguments where keys are parameter names and values are descriptions.

  • Returns:

    • A decorator function that preserves the original function’s signature and behavior.

  • Example:

    @param_docs(
        name="The person's full name",
        age="The person's age in years"
    )
    def greet(name, age):
        return f"Hello {name}, you are {age} years old!"
    

API

agentsociety.agent.decorator.register_get(description: str)

Registers a method as an available function.

  • Description:

    • Function that registers a method as an available function with the given name and description.

  • Args:

    • description (str): Description of what the function does.

  • Returns:

    • decorator (Callable): The decorator function.

agentsociety.agent.decorator.param_docs(**param_descriptions: str)
  • Description:

    • A decorator that adds documentation to function parameters.

    • This documentation can be accessed by FormatPrompt when associated with the method.

  • Args:

    • **param_descriptions: Keyword arguments where keys are parameter names and values are descriptions.

  • Returns:

    • A decorator function that preserves the original function’s signature and behavior.

  • Example:

    @param_docs(
        name="The person's full name",
        age="The person's age in years"
    )
    def greet(name, age):
        return f"Hello {name}, you are {age} years old!"