preCheck {MacBehaviour}R Documentation

Step4: Pre-check for token usage in experiment design.

Description

Configures experimental parameters before execution.

Usage

preCheck(
  data,
  checkToken = FALSE,
  systemPrompt = "",
  imgDetail = "auto",
  version = "2023-06-01",
  ...
)

Arguments

data

A data.frame that has been structured by the 'experimentDesign' function, containing the experimental setup.

checkToken

Whether to perform token count check, select TRUE to submit your experiment to our server's tokenizer for token count check, the default selection is FALSE (i.e., no token check will be performed, but you need to manually check if the number of tokens exceeds the model limit to avoid errors in the experiment).

systemPrompt

The system prompt text used in the chatGPT model interaction. If left empty, a space character is assumed.Note: This parameter does not work in models that do not support system prompts.

imgDetail

The image quality of the img modality is set to auto by default, with low/high as selectable options.

version

When using the Claude model, the version parameter required defaults to "2023-06-01".

...

Variable parameter lists allow you to input additional parameters supported by the model you're using, such as n=2 / logprobs=TRUE... Note: You must ensure the validity of the parameters you enter; otherwise, an error will occur.

Value

A list containing the original data and the parameters for the chatGPT model interaction, confirming that the setup has passed the token checks or indicating issues if found.

Examples


df <- data.frame(
Run = c(1,2),
Item = c(1,2),
Event =c(1,1),
Condition = c(1,2),
TargetPrompt = c("please repeat this sentence: test1","please repeat this sentence: test2")
)

ExperimentItem=loadData(df$Run,df$Item,df$Event,df$Condition,promptList = df$TargetPrompt)

Design=experimentDesign(ExperimentItem,session=1)

gptConfig=preCheck(Design, systemPrompt="You are a participant in a psychological experiment",
                    imgDetail="low",temperature=0.7)


[Package MacBehaviour version 1.2.4 Index]