Functions
Create function
Comprehensive guide to creating a function in the assistant main page.
Follow these steps to create a function in the assistant:
Step-by-Step guide
1. Find “Functions” on the sidebar
- Navigate to the assistant’s main page and locate “Functions” on the sidebar.
2. Click “Add Function”
- Select “Add Function” on the left side of the page.
3. Define the function name
- At the top of the page, define the function name. Note that the function name can only contain alphanumeric characters and underscores.
4. Provide a description
- Use the “Description” field to provide an accurate summary of what your function does. This helps the model understand when to call the function. Be descriptive and concise about its purpose.
5. Define LLM parameters
- In the “LLM Parameters” field, specify the parameters the LLM model will collect and use in the function.
- Name: Assign a clear and descriptive name to improve the accuracy of the LLM result.
- Context Description: Provide essential context to help the LLM accurately understand and extract the parameter from the caller.
- Type: Specify the parameter type. Options include “string,” “number,” “integer,” or “boolean.” Note that “number” supports decimals, while “integer” does not.
6. Define the function
- Use the “Function Definition” field to write the function in Python. You can retrieve “Secrets” in your Python definition—refer to the “How to Retrieve Secret” page for details.
- The function should return a string, which serves as additional information for the LLM to continue the conversation. Ensure the output is a natural language string that resolves knowledge gaps for the model.
7. Save the Function
- Click “Save” to finalize and create your function.
Best practices
Environment configuration
You can use the conv.env
property to define environment-specific platform functions and activate test features in sandbox or pre-release environments.