Simple Custom Action

Excited by the ability to run custom python code (but limited by plan even tier 2), but how do I get this to the chat space? I saw the more complex how to which returns from make API. What if we just want to do some local stuff and return something without a network call.

import requests
from datetime import date

def insert_the_date(email: str, key: str):
    """
    Gives todays date to the LLM

    Args:
        email (string): Users email address
        key (string): test variable
    """

    # Insert your PYTHON code below. You can access environment variables using os.environ[].
    # Currently, only the requests library is supported, but more libraries will be available soon.
    # Use print statements or return values to display results to the user.
    # If you save a png, pdf, csv, jpg, webp, gif, or html file in the root directory, it will be automatically displayed to the user.
    # You do not have to call this function as the bot will automatically call and fill in the parameters.
    payload={
        "key":key,
        "secretemail":email,
        "date":date.today()
    }
    return payload
1 Like

oohhhhhh… great question! Following this closely.

1 Like

Hi @landed , something like this?

Thanks, so the takeaway is that it is what gets printed that the chat bot can use?

@landed what gets printed becomes part of the prompt and therefore the memory of the chatbot.

That nugget is indeed very valuable! Just that on gold plan we only get one action. I need that to be an email at the end. LLM’s are incapable of doing basic math if the workings out are to be hidden from the output. Thats where I wanted some python logic. Thanks for sharing the intel.