fusion_hat.voice_assistant モジュール

class fusion_hat.voice_assistant.VoiceAssistant(*args, **kwargs)[ソース]

ベースクラス : object

音声アシスタントクラス

パラメーター:
  • llm (sunfounder_voice_assistant.llm.LLM) -- 言語モデル

  • name (str, optional) -- ロボット名、デフォルトは NAME です

  • with_image (bool, optional) -- 画像を有効化するにはマルチモーダル言語モデルを設定する必要があります。デフォルトは WITH_IMAGE です

  • tts_model (str, optional) -- テキスト読み上げモデル、デフォルトは TTS_MODEL です

  • stt_language (str, optional) -- 音声認識言語、デフォルトは STT_LANGUAGE です

  • keyboard_enable (bool, optional) -- キーボード入力を有効化、デフォルトは KEYBOARD_ENABLE です

  • wake_enable (bool, optional) -- ウェイクワードを有効化、デフォルトは WAKE_ENABLE です

  • wake_word (list, optional) -- ウェイクワード、デフォルトは WAKE_WORD です

  • answer_on_wake (str, optional) -- ウェイクワードで応答、デフォルトは ANSWER_ON_WAKE です

  • welcome (str, optional) -- ウェルカムメッセージ、デフォルトは WELCOME です

  • instructions (str, optional) -- 指示を設定、デフォルトは INSTRUCTIONS です

  • disable_think (bool, optional) -- 思考を無効化、デフォルトは False です

before_listen() None[ソース]

リッスン前

after_listen(stt_result: str) None[ソース]

リッスン後

パラメーター:

stt_result (str) -- 音声認識結果

before_think(text: str) None[ソース]

思考前

パラメーター:

text (str) -- 思考するテキスト

after_think(text: str) None[ソース]

思考後

パラメーター:

text (str) -- 思考するテキスト

on_start() None[ソース]

開始時

on_wake() None[ソース]

ウェイク時

on_heard(text: str) None[ソース]

音声認識時

パラメーター:

text (str) -- 認識されたテキスト

parse_response(text: str) str[ソース]

レスポンスを解析

パラメーター:

text (str) -- 解析するテキスト

戻り値:

解析されたテキスト

戻り値の型:

str

add_trigger(trigger_function: Callable[[], tuple[bool, bool, str]]) None[ソース]

トリガー関数を追加

パラメーター:

trigger_function (Callable[[], tuple[bool, bool, str]]) -- トリガー関数

before_say(text: str) None[ソース]

発話前

パラメーター:

text (str) -- 発話するテキスト

after_say(text: str) None[ソース]

発話後

パラメーター:

text (str) -- 発話するテキスト

on_stop() None[ソース]

停止時

on_finish_a_round() None[ソース]

1 ラウンド終了時

capture_image(path: str) None[ソース]

画像をキャプチャ

パラメーター:

path (str) -- 画像の保存パス

trigger_wake_word() tuple[bool, bool, str][ソース]

ウェイクワードをトリガー

戻り値:

トリガーされました。画像を無効化、メッセージ

戻り値の型:

tuple[bool, bool, str]

trigger_keyboard_input() tuple[bool, bool, str][ソース]

キーボード入力をトリガー

戻り値:

トリガーされました。画像を無効化、メッセージ

戻り値の型:

tuple[bool, bool, str]

init_camera() None[ソース]

カメラを初期化

close_camera() None[ソース]

カメラを閉じる

listen() str[ソース]

リッスン

戻り値:

音声認識結果

戻り値の型:

str

think(text: str, disable_image: bool = False) str[ソース]

思考

パラメーター:
  • text (str) -- 思考するテキスト

  • disable_image (bool, optional) -- 画像を無効化、デフォルトは False です

戻り値:

LLM の応答

戻り値の型:

str

main() None[ソース]

メインループ

run() None[ソース]

実行