Package: PsyLingLLM 0.4.0

Han Ming

PsyLingLLM: Controlled Psycholinguistic Experiments with Large Language Models

Runs controlled psycholinguistic, psychological, cognitive, and educational experiments with large language models. Registry-based configuration separates models, providers, and application programming interfaces so that compatible services can share experimental designs. Functions support randomized and factorial trials, multi-turn conversations, response and reasoning capture, timing and token measurements, and structured result export. For methodological context on using language models as experimental participants, see Dillion et al. (2023) <doi:10.1016/j.tics.2023.04.008>.

Authors:Han Ming [aut, cre]

PsyLingLLM_0.4.0.tar.gz
PsyLingLLM_0.4.0.zip(r-4.7-any)PsyLingLLM_0.4.0.zip(r-4.6-any)
PsyLingLLM_0.4.0.tar.gz(r-4.7-any)PsyLingLLM_0.4.0.tar.gz(r-4.6-any)
PsyLingLLM_0.4.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
PsyLingLLM/json (API)

# Install 'PsyLingLLM' in R:
install.packages('PsyLingLLM', repos = c('https://cran.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/hanmingpsy/psylingllm-r/issues

On CRAN:

Conda:

1.70 score 65 exports 38 dependencies

Last updated from:2146ec7cb2. Checks:6 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-develOK161
source / vignettesOK187
linux-releaseOK150
windows-develOK270
windows-releaseOK215
wasm-releaseOK118

Exports:adaptive_feedback_experimentbuild_body_pass2_structuralbuild_registry_entry_from_analysisbuild_standardized_inputcat_slowlyclassify_generation_interfacecoerce_path_segmentscommon_error_blacklistcomplete_headers_for_pass2conversation_experimentconversation_experiment_with_feedbackdefault_keyword_lexicondefault_optional_keysdetect_embedded_think_tagensure_registry_headerexplain_aliasextract_pass2_templatesextract_process_metricsextract_token_probabilitiesextract_usage_fieldsfactorial_trial_experimentfind_placeholder_pathflat_key_to_regexflatten_json_pathsformat_registration_previewgenerate_llm_experiment_listgenerate_llm_factorial_experiment_listget_model_configget_registry_entryget_registry_pathget_trial_rawhas_nonempty_textinfer_role_mapping_from_bodyinfer_structure_from_placeholderinject_optional_paramsis_invalid_candidateis_message_objectjson_get_by_pathlist_get_by_pathllm_callerllm_registerload_registrymake_aliasmake_pass2_probe_inputsmerge_defaults_for_probemulti_model_experimentnormalize_history_messagesnormalize_path_keynormalize_path_key_with_regexnormalize_provider_labelnormalize_type_labelprobe_llm_streamingregister_endpoint_offlineregister_endpoint_to_user_registrysave_experiment_resultsscore_candidates_nsscore_candidates_ststream_reconstruct_textstrip_optionals_from_bodysub_placeholderstrial_experimentupdate_progress_barvalidate_experiment_configvalidate_registry_entryvalidate_registry_schema

Dependencies:bitbit64cellrangerclicliprcpp11crayoncurldplyrgenericsgluehmsjsonlitelifecyclemagrittropenxlsxpillarpkgconfigprettyunitsprogressR6Rcppreadrreadxlrematchrlangstringistringrtibbletidyselecttzdbutf8vctrsvroomwithrwritexlyamlzip

Readme and manuals

Help Manual

Help pageTopics
Run an Adaptive Feedback Experimentadaptive_feedback_experiment conversation_experiment_with_feedback
Build Pass-2 bodybuild_body_pass2_structural
Build a registry entry from analysis resultsbuild_registry_entry_from_analysis
Build standardized Pass-2 headers & body from Pass-1 raw inputsbuild_standardized_input
Print lines gradually with delay (console-safe)cat_slowly
Classify LLM generation interface from URL (robust and version-agnostic)classify_generation_interface
Common provider error-field blacklist (path segments only)common_error_blacklist
Compare two optional scalar strings (paths). Return a structured line and a boolean flag.compare_path_line
Complete headers minimally for Pass-2 (keeps user values)complete_headers_for_pass2
Run a Multi-turn Conversation Experimentconversation_experiment
Default keyword lexicon for ns/st scoringdefault_keyword_lexicon
Default optional keys for common LLM providers (explicit removal first)default_optional_keys
Detect embedded <think> tags in model outputdetect_embedded_think_tag
Ensure registry directory exists and header is presentensure_registry_header
Explain how an alias was derived from a model idexplain_alias
Tolerant extraction of Pass-2 templates (headers and body)extract_pass2_templates
Extract Standard Process Metrics from RAW Trial Resultsextract_process_metrics
Extract Token Probabilities from RAW Trial Resultsextract_token_probabilities
Extract usage field names from a parsed non-streaming responseextract_usage_fields
Run Factorial Trial Experiment (registry-driven, assistant-native)factorial_trial_experiment
Recursively find the first path to a placeholder stringfind_placeholder_path
Flatten a JSON-like object into (path, key, value) rowsflatten_json_paths
Render a registry entry preview (verbatim from the registry node)format_registration_preview
Generate LLM Experiment List (CSV→XLSX conversion, UTF-8 safe)generate_llm_experiment_list
Generate LLM Experiment List for Factorial Design (UTF-8 safe)generate_llm_factorial_experiment_list
Resolve a model name (id or alias) to a registry entry (new registry-aware)get_model_config
Retrieve a registry interface entry (inputs / outputs / streaming)get_registry_entry
Get user registry path (cross-platform, unified)get_registry_path
Inspect One Archived RAW Trial Recordget_trial_raw
Does a value contain any non-empty textual content?has_nonempty_text
Infer role mapping from a chat-style LLM request bodyinfer_role_mapping_from_body
Infer structure from where '"\${CONTENT}"' livesinfer_structure_from_placeholder
Inject optional params into a body using a whitelistinject_optional_params
Hard filter: blacklist, nullish, booleans, numeric-only, too-short Segment-exact blacklist (compares path segments, not substrings).is_invalid_candidate
Utility: check if a path segment is a named keyis_key
Check if an object is a message objectis_message_object
Get a nested value by a mixed path (character keys and integer indices)list_get_by_path
Call an LLM via the registryllm_caller
Register an LLM Endpoint with Pass-2 Validationllm_register
Load the system LLM registryload_registry
Generate a compact alias for a model idmake_alias
Build Pass-2 EFFECTIVE probe inputs (no forced system; structural role inference)make_pass2_probe_inputs
Merge default generation parameters into a request body (probe only)merge_defaults_for_probe
Run Trials Across Multiple Models (registry-driven, assistant-native)multi_model_experiment
Normalize conversation history into message objectsnormalize_history_messages
Normalize any path spec to a flat key AND, if needed, a regex with wildcard indexnormalize_path_key_with_regex
Normalize a free-form provider labelnormalize_provider_label
Normalize a free-form type string (strip a leading '@' if present)normalize_type_label
Probe an LLM endpoint (non-stream + streaming, SSE-aware)probe_llm_streaming
PsyLingLLM Schema (v1)PsyLingLLM_Schema
Register an LLM endpoint offline (supports reasoning / thinking path)register_endpoint_offline
Upsert endpoint entry into the user registry (safe merge)register_endpoint_to_user_registry
Render a structured "[Pass-2 Verified Ports]" report section.render_pass2_path_consistency_report
Save Experiment Results to Filesave_experiment_results
Rank non-streaming JSON paths for answer/think (segment-aware, conflict-guarded)score_candidates_ns
Rank streaming (SSE) candidates for answer/think (temporal aggregation, delta-aware, conflict-guarded)score_candidates_st
Reconstruct stream text from raw_json using exact or wildcard-index matching Falls back to regex (for ".." wildcard) if exact match finds nothing.stream_reconstruct_text
Strip optional runtime parameters from a request bodystrip_optionals_from_body
Substitute placeholders '"\${API_KEY}"', '"\${CONTENT}"', '"\${ROLE}"' robustlysub_placeholders
Run LLM Trial Experimenttrial_experiment
Update progress bar for an experimentupdate_progress_bar
Validate experiment configuration and resolve API URLvalidate_experiment_config
Validate structure of a registry entryvalidate_registry_entry
Validate a PsyLingLLM Registry Documentvalidate_registry_schema