
Use a Large Language Model (LLM) to create a derived trait function
make_trait.Rd
This function allows you to create a derived trait function using natural language.
Note that LLMs can be unreliable, so the result should be verified manually.
If the description is not clear, an error will be raised.
Try to read the descriptions of built-in traits to get ideas.
Currently, only
prop(), ratio(), and wmean() are supported.
To use this feature, you need to install the ellmer package.
You also need to provide an API key for the DeepSeek chat model.
Please set the environment variable DEEPSEEK_API_KEY to your API key using Sys.setenv().
You can obtain an API key from https://platform.deepseek.com.
Arguments
- description
A description of the trait in natural language.
- custom_mp
A named character vector of custom meta-properties. The names are the meta-property names, and the values are in the format "(type) description". For example:
c(nE = "(integer) number of a2,6-linked sialic acids"). These custom meta-properties will be available for the LLM to use. Note that defining the meta-properties here is not enough for you to use them. You need to define corresponding meta-property functions or specifying meta-property columns. For more information about custom meta-properties, see the vignette Custom Meta-Properties.- max_retries
Maximum number of reflection retries when the AI-generated formula's explanation doesn't match the original description. Default is 2.
- verbose
Whether to print verbose output. Default is FALSE. This is useful for inspecting how LLMs generate trait functions.