Skip to content

Commit

Permalink
Fix Mistral tool use
Browse files Browse the repository at this point in the history
  • Loading branch information
smathot committed Jul 26, 2024
1 parent 1af1b31 commit ec450e9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sigmund/model/_mistral_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ def __init__(self, sigmund, model, **kwargs):
from mistralai.client import MistralClient
BaseModel.__init__(self, sigmund, **kwargs)
self._model = model
# Mistral doesn't allow a tool to be specified by name. So if this
# happens, we instead use the 'any' option, which forces use of the
# best fitting tool, which in the case of a single tool boils down to
# the same thing as forcing the tool by name.
if self._tool_choice not in [None, 'none', 'auto', 'any']:
self._tool_choice = 'any'
self._client = MistralClient(api_key=config.mistral_api_key)
self._async_client = MistralAsyncClient(api_key=config.mistral_api_key)

Expand Down
2 changes: 2 additions & 0 deletions sources/topics/keyboard_response_item.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
- Correct response: Indicates which response should be considered correct. Specify a key name (e.g. 'space') or a Python expression that refers to a variable (e.g. `{my_correct_response}`). Usually this field is left empty, in which case the variable `correct_response` is automatically used when defined.
- Timeout: a numeric duration in milliseconds or 'infinite' for no timeout. When a timeout occurs, the `response` variable is set to `None`.

A common issue is that a `sketchpad` with a 'keypress' duration is followed by a `keyboard_respones`. In that case, the participant has to press twice in a row (once for the `sketchpad` and once for the `keyboard_response`). The solution is to set the duration of the `sketchpad` to 0, so that the `sketchpad` advances immediately to the `keyboard_response`.

More information:

- <https://osdoc.cogsci.nl/4.0/manual/response/keyboard/>

0 comments on commit ec450e9

Please sign in to comment.