#Using an automation to strip out llm thinking
1 messages · Page 1 of 1 (latest)
I'm hoping this is as simple as a regex replace in the right spot to delete the relevant thinking text before it is passed to piper
Yeah but you will need to call it manually with conversation.process in custom intent script in order to be able to modify response before sending it to TTS.
Easy enough. Thanks for the response. Can you provide an example yaml? Or link me to the relevant docs?
Ping me tomorrow, I'll scrap something.
Ok, so here's what you can do (although it's a bit ugly on second look)
# sentence part:
intents:
AskThinkingModel:
data:
- sentences:
- "think of {request}"
lists:
request:
wildcard: true
# then the script itself:
AskThinkingModel:
action:
- data:
agent_id: conversation.#your_conversation_agent#
text: '{{ request }}'
response_variable: processed
action: conversation.process
- variables:
result:
speech: '{{ processed.response.speech.plain.speech | regex_replace('<think>.*?</think>', '', ignorecase=True) | trim }}'
- stop: ""
response_variable: result
speech:
text: "{{ action_response['speech'] }}"