Skip to content

Commit

Permalink
Slight tweaks to prompt and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
smathot committed Apr 25, 2024
1 parent d4aed9c commit 04d767e
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
Binary file modified .db.cache/index.faiss
Binary file not shown.
Binary file modified .db.cache/index.pkl
Binary file not shown.
2 changes: 1 addition & 1 deletion sigmund/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# The system prompt used during question answering is composed of the fragments
# below
SYSTEM_PROMPT_IDENTITY_WITH_SEARCH = '''You are Sigmund, a brilliant AI assistant for users of OpenSesame, a program for building psychology and neuroscience experiments. You sometimes use emojis.'''
SYSTEM_PROMPT_IDENTITY_WITH_SEARCH = '''You are Sigmund, a brilliant AI assistant for users of OpenSesame, a program for building psychology and neuroscience experiments. Your knowledge of OpenSesame is outdated. Therefore, strictly follow the documentation that is provided in the context between <documentation> tags. You sometimes use emojis.'''
SYSTEM_PROMPT_IDENTITY_WITHOUT_SEARCH = '''You are Sigmund, a brilliant AI assistant. You sometimes use emojis.'''
# Sent by AI to indicate that message requires for replies or actions
NOT_DONE_YET_MARKER = '<NOT_DONE_YET>'
Expand Down
2 changes: 2 additions & 0 deletions sources/jsonl/opensesame-howtos.jsonl
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@
{"content": "Understanding the meaning of the variables `acc`, `accuracy`, `correct`, and `correct_response`:\n\n- The correct response is stored in the variable `correct_response`. This variable needs to be defined in the experiment, for example in the table of the BLOCK_LOOP, and contains for example the name of the key that the participant is supposed to press on a trial. If `correct_response` is defined, response items such as the KEYBOARD_RESPONSE, will automatically determine whether a response is correct.\n- The participant's accuracy is stored in the variable `acc` and `accuracy` (which are aliases) as a percentage value between 0 and 100.\n- The participant's accuracy is a running average since the last reset of feedback variables.\n- Feedback variables can be reset by the FEEDBACK and RESET_FEEDBACK items.\n- The correctness of the participant's last response is stored as the variable `correct` as 1 (correct) or 0 (incorrect).\n\nTo provide feedback on the participant's accuracy (percentage correct) after several trials:\n\n- Add a RESET_FEEDBACK item at the point from which you want to provide feedback. This can for example be at the start of each block, as the first item in the *block_sequence*, in case you want to provide feedback per block.\n- At the end of each block, add a FEEDBACK item with the text: `Your accuracy was {acc}%`.\n\nTo provide feedback on the participant's correctness (correct vs incorrect) after each trial:\n\n- Add two SKETCHPAD items to the end of the *trial_sequence*.\n- Rename one SKETCHPAD to *correct_sketchpad* and add content that you want to show after a correct response, such as a green fixation dot.\n- Rename the other SKETCHPAD to *incorrect_sketchpad* and add content that you want to show after an error, such as a red fixation dot.\n- In the *trial_sequence*, use run-if expressions to show the correct SKETCHPAD depending on the participants response. For *correct_sketchpad* this should be `correct == 1`. For *incorrect_sketchpad* this should be `correct == 0`.", "url": "https://forum.cogsci.nl", "title": "How to give feedback on the participant's accuracy"}
{"content": "The LOGGER item determines which variables are logged the first time that it is executed. The LOGGER cannot automatically detect variables that will be defined later on in a Python INLINE_SCRIPT. Therefore, if you define a new variable in a Python INLINE_SCRIPT item after a LOGGER item has already been executed, this new variable will not be included in the log file. To work around this, you can add an initializing script to the start of the experiment and already assign a dummy value to the variable there, so that the LOGGER will be aware that the variable exists:\n ```python\n my_future_variable = 'some dummy value'\n ```", "url": "https://forum.cogsci.nl", "title": "How to log variables that are defined in a Python INLINE_SCRIPT item"}
{"content": "To change the language of the user interface in OpenSesame:\n\n1. Go to Menu \u2192 Tools \u2192 Preferences.\n2. In the Preferences window, select the 'Common settings' tab.\n3. In the section 'Application appearance', under 'Language', choose your desired language from the dropdown menu.\n4. The '[Default]' language corresponds to the language of the operating system.\n5. Restart OpenSesame to have the change take effect.", "url": "https://forum.cogsci.nl", "title": "How to change the language in OpenSesame"}
{"content": "When an OSWeb experiment doesn't run as expected, there are a few things that you can do:\n\n1. Make sure that you are running the latest versions of OpenSesame and OSWeb. OpenSesame 4 has an automatic updater, which will notify you of any available updates. This notification may take a few minutes to appear after you have started OpenSesame.\n2. Check for error messages in the browser console. See also: <https://osdoc.cogsci.nl/4.0/manual/debugging/>\n3. Make sure that your experiment is compatible with OSWeb. See also: <https://osdoc.cogsci.nl/4.0/manual/osweb/osweb/>", "url": "https://forum.cogsci.nl", "title": "How to debug errors when running an experiment in a browser with OSWeb"}
{"content": "To provide feedback by showing an image after a response:\n\n1. Insert a KEYBOARD_RESPONSE item in the *trial_sequence* to collect a key press.\n2. In the \"Allowed responses\" field of the KEYBOARD_RESPONSE, specify which keys should be accepted. This should be a semicolon-separated list, for example \"left;right\".\n3. After the KEYBOARD_RESPONSE, insert one SKETCHPAD item for each feedback image that might be presented. For example, you might create a *left_sketchpad* item that shows the image `left_feedback.png`, and a *right_sketchpad* item that shows the image `right_feedback.png`. The image files should be in the file pool.\n4. In the *trial_sequence*, use Run-If expressions to determine which item should be run on a given trial: `response == \"left\"` for *left_sketchpad* and `response == \"right\"` for *right_sketchpad*.", "url": "https://forum.cogsci.nl", "title": "How to give feedback by showing an image after a response, with the specific image depending on which key was pressed"}
{"content": "To add line breaks in OpenSesame text:\n\n1. Open the item (e.g., sketchpad, form_text_input, etc.) where you want to add line breaks.\n2. When entering text, you can typically enter multiple lines in the text input, and line breaks will be automatically inserted.\n3. When editing the script of an item, you need to manually indicate line breaks as shown below.\n4. In the item script, locate the text field where you need to insert line breaks.\n5. To add a line break, use the HTML tag `<br>` at the point where you want the text to start on a new line.\n6. If you need multiple consecutive line breaks, use multiple `<br>` tags.\n7. Save the changes to the item.\n8. Run the experiment to verify that the line breaks appear as expected.\n\nImportant side note: When running an experiment on the desktop, long lines are automatically wrapped so that they run out of the screen. However, when running an experiment in a browser with OSWeb, this doesn't happen, and you need to explicitly indicate line breaks to avoid lines from running out of the screen.", "url": "https://forum.cogsci.nl", "title": "How to add line breaks in OpenSesame text"}
{"content": "OpenSesame supports regular HTML formatting for text. To format text in OpenSesame using HTML tags:\n\n1. Identify the item (e.g., sketchpad, form_text_input, etc.) where you want to format the text.\n2. Use the appropriate HTML tags to format the text:\n - For bold text, use `<b>text</b>`\n - For italic text, use `<i>text</i>`\n - For underlined text, use `<u>text</u>`\n - For text color, use `<span style=\"color: red;\">text</span>` (replace \"red\" with the desired color)\n3. Apply the HTML tags around the text you want to format.\n4. Save the changes to the item.\n5. Run the experiment to verify that the text formatting appears as expected.", "url": "https://forum.cogsci.nl", "title": "How to format text in OpenSesame using HTML tags"}
{"content": "OpenSesame assumes that text is encoded in UTF-8 format and also uses UTF-8 for the log file.\n\nIf you find that text from a file, for example a source file for a LOOP table, is incorrectly encoded (because non-ASCII characters are not shown correctly), this generally means that the file uses a different file encoding. In that case, change the character encoding of the file to UTF-8, which is something that most text editors allow you to do. \n\nSimilarly, if you open an OpenSesame log file and find that it is incorrectly encoded (because non-ASCII characters are not shown correctly), indicate in the text editor or spreadsheet that the file is encoded using UTF-8.\n\nCharacter-encoding issues are especially common on Windows, because most versions of Windows do not use UTF-8 encoding by default.", "url": "https://forum.cogsci.nl", "title": "How to debug text encoding issues in OpenSesame"}
Expand Down
19 changes: 17 additions & 2 deletions sources/topics/opensesame.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Important

- Your knowledge of OpenSesame is outdated. Therefore, strictly follow this documentation.
- If you need more information to answer the question, ask the user for clarification.
- Never put variables in conditional (run-if, show-if, break-if) expressions between square brackets. Use Python syntax instead. Correct: `variable_name == 1` Incorrect: `[variable_name] = 1`
- In Python and JavaScript: remember the distinction between the prepare and the run phase.
Expand Down Expand Up @@ -31,8 +30,24 @@
- Conditional expressions should be syntactically valid Python
- Do not put square brackets around variables

# Example conditional expressions
Example conditional expressions:

correct == 1
response_time < 2000 and correct == 1
count_trial_sequence % 10 == 1

# Built-in variables

The following variables have a special meaning in OpenSesame. Do not make up your own variable names, but use these variable names whenever they are applicable.

Automatically set by response items (KEYBOARD_RESPONSE, MOUSE_RESPONSE, etc.):

- `response`: the participant's last response (key name, mouse button, etc.)
- `response_time`: the response time for the participant's last response in milliseconds
- `correct`: whether the participant's last respones was correct (1) or not (0)
- `acc` or `accuracy`: the percentage of correct responses since the last reset of feedback variables
- `avg_rt` or `average_response_time`: the average response time since the last reset of feedback variables

Used by response items (KEYBOARD_RESPONSE, MOUSE_RESPONSE, etc.):

- `correct_response`: the expected response, which is often specified in a LOOP, which is used to determine whether the participant's response was correct.

0 comments on commit 04d767e

Please sign in to comment.