From be96be8b3c1234ac8cbe58160d8ef9c76a325884 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Sun, 22 Sep 2024 11:59:14 +0300 Subject: [PATCH] Pin baibot to v1.1.1 and add default prompt for all statically-defined agents The playbook did not use to define a prompt for statically-defined agents. Since prompt variables support landed in v1.1.0 (see https://github.com/etkecc/baibot/commit/2a5a2d6a4dbf5fd7cb504ac07d4187fdc32ae395) it makes sense to make use of it for a better out-of-the-box experience (see https://github.com/etkecc/baibot/issues/10). --- docs/configuring-playbook-bot-baibot.md | 24 +++++++++++++++++-- .../matrix-bot-baibot/defaults/main.yml | 15 ++++++------ 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/docs/configuring-playbook-bot-baibot.md b/docs/configuring-playbook-bot-baibot.md index e39d8ee52..6024015e5 100644 --- a/docs/configuring-playbook-bot-baibot.md +++ b/docs/configuring-playbook-bot-baibot.md @@ -154,6 +154,11 @@ matrix_bot_baibot_config_agents_static_definitions_anthropic_config_api_key: "YO # If you'd like to use another text-generation agent, uncomment and adjust: # matrix_bot_baibot_config_agents_static_definitions_anthropic_config_text_generation_model_id: claude-3-5-sonnet-20240620 +# The playbook defines a default prompt for all statically-defined agents. +# You can adjust it in the `matrix_bot_baibot_config_agents_static_definitions_prompt` variable, +# or you can adjust it below only for the Anthropic agent. +# matrix_bot_baibot_config_agents_static_definitions_anthropic_config_text_generation_prompt: "{{ matrix_bot_baibot_config_agents_static_definitions_prompt }}" + # See `defaults/main.yml` in the baibot role for more configuration options. ``` @@ -176,6 +181,11 @@ matrix_bot_baibot_config_agents_static_definitions_groq_config_api_key: "YOUR_AP # Specify the text-generation agent you'd like to use matrix_bot_baibot_config_agents_static_definitions_groq_config_text_generation_model_id: "llama3-70b-8192" +# The playbook defines a default prompt for all statically-defined agents. +# You can adjust it in the `matrix_bot_baibot_config_agents_static_definitions_prompt` variable, +# or you can adjust it below only for the Groq agent. +# matrix_bot_baibot_config_agents_static_definitions_groq_config_text_generation_prompt: "{{ matrix_bot_baibot_config_agents_static_definitions_prompt }}" + # Uncomment and adjust if you're not happy with these speech-to-text defaults: # # matrix_bot_baibot_config_agents_static_definitions_groq_config_speech_to_text_enabled: true @@ -202,6 +212,11 @@ matrix_bot_baibot_config_agents_static_definitions_mistral_enabled: true matrix_bot_baibot_config_agents_static_definitions_mistral_config_api_key: "YOUR_API_KEY_HERE" +# The playbook defines a default prompt for all statically-defined agents. +# You can adjust it in the `matrix_bot_baibot_config_agents_static_definitions_prompt` variable, +# or you can adjust it below only for the Mistral agent. +# matrix_bot_baibot_config_agents_static_definitions_mistral_config_text_generation_prompt: "{{ matrix_bot_baibot_config_agents_static_definitions_prompt }}" + # Uncomment and adjust if you're not happy with these defaults: # matrix_bot_baibot_config_agents_static_definitions_mistral_config_text_generation_model_id: mistral-large-latest @@ -228,6 +243,11 @@ matrix_bot_baibot_config_agents_static_definitions_openai_enabled: true matrix_bot_baibot_config_agents_static_definitions_openai_config_api_key: "YOUR_API_KEY_HERE" +# The playbook defines a default prompt for all statically-defined agents. +# You can adjust it in the `matrix_bot_baibot_config_agents_static_definitions_prompt` variable, +# or you can adjust it below only for the OpenAI agent. +# matrix_bot_baibot_config_agents_static_definitions_openai_config_text_generation_prompt: "{{ matrix_bot_baibot_config_agents_static_definitions_prompt }}" + # If you'd like to use another text-generation agent, uncomment and adjust: # matrix_bot_baibot_config_agents_static_definitions_openai_config_text_generation_model_id: gpt-4o @@ -273,7 +293,7 @@ matrix_bot_baibot_config_agents_static_definitions_custom: api_key: "YOUR_API_KEY_HERE" text_generation: model_id: gpt-3.5-turbo-0125 - prompt: You are a brief, but helpful bot. + prompt: "{{ matrix_bot_baibot_config_agents_static_definitions_prompt }}" temperature: 1.0 max_response_tokens: 4096 max_context_tokens: 16385 @@ -290,7 +310,7 @@ matrix_bot_baibot_config_agents_static_definitions_custom: api_key: "" text_generation: model_id: "llama3.1:8b" - prompt: "You are an assistant based on the Llama3.1:8b model. Be brief in your responses." + prompt: "{{ matrix_bot_baibot_config_agents_static_definitions_prompt }}" temperature: 1.0 max_response_tokens: 4096 max_context_tokens: 128000 diff --git a/roles/custom/matrix-bot-baibot/defaults/main.yml b/roles/custom/matrix-bot-baibot/defaults/main.yml index b07a2f906..4b4401ace 100644 --- a/roles/custom/matrix-bot-baibot/defaults/main.yml +++ b/roles/custom/matrix-bot-baibot/defaults/main.yml @@ -11,7 +11,7 @@ matrix_bot_baibot_container_repo_version: "{{ 'main' if matrix_bot_baibot_versio matrix_bot_baibot_container_src_files_path: "{{ matrix_base_data_path }}/baibot/container-src" # renovate: datasource=docker depName=ghcr.io/etkecc/baibot -matrix_bot_baibot_version: latest +matrix_bot_baibot_version: v1.1.1 matrix_bot_baibot_container_image: "{{ matrix_bot_baibot_container_image_name_prefix }}etkecc/baibot:{{ matrix_bot_baibot_version }}" matrix_bot_baibot_container_image_name_prefix: "{{ 'localhost/' if matrix_bot_baibot_container_image_self_build else 'ghcr.io/' }}" matrix_bot_baibot_container_image_force_pull: "{{ matrix_bot_baibot_container_image.endswith(':latest') }}" @@ -155,6 +155,7 @@ matrix_bot_baibot_config_agents_static_definitions_auto: |- }} matrix_bot_baibot_config_agents_static_definitions_custom: [] +matrix_bot_baibot_config_agents_static_definitions_prompt: "{% raw %}You are a brief, but helpful bot called {{ baibot_name }} powered by the {{ baibot_model_id }} model. The date/time now is: {{ baibot_now_utc }}.{% endraw %}" ######################################################################################## # # @@ -195,7 +196,7 @@ matrix_bot_baibot_config_agents_static_definitions_anthropic_config_text_generat matrix_bot_baibot_config_agents_static_definitions_anthropic_config_text_generation_model_id: claude-3-5-sonnet-20240620 # The prompt text to use (can be null or empty to not use a prompt). # See: https://huggingface.co/docs/transformers/en/tasks/prompting -matrix_bot_baibot_config_agents_static_definitions_anthropic_config_text_generation_prompt: null +matrix_bot_baibot_config_agents_static_definitions_anthropic_config_text_generation_prompt: "{{ matrix_bot_baibot_config_agents_static_definitions_prompt }}" # The temperature parameter controls the randomness of the generated text. # See: https://blogs.novita.ai/what-are-large-language-model-settings-temperature-top-p-and-max-tokens/#what-is-llm-temperature matrix_bot_baibot_config_agents_static_definitions_anthropic_config_text_generation_temperature: 1.0 @@ -248,7 +249,7 @@ matrix_bot_baibot_config_agents_static_definitions_groq_config_text_generation_e matrix_bot_baibot_config_agents_static_definitions_groq_config_text_generation_model_id: "" # The prompt text to use (can be null or empty to not use a prompt). # See: https://huggingface.co/docs/transformers/en/tasks/prompting -matrix_bot_baibot_config_agents_static_definitions_groq_config_text_generation_prompt: null +matrix_bot_baibot_config_agents_static_definitions_groq_config_text_generation_prompt: "{{ matrix_bot_baibot_config_agents_static_definitions_prompt }}" # The temperature parameter controls the randomness of the generated text. # See: https://blogs.novita.ai/what-are-large-language-model-settings-temperature-top-p-and-max-tokens/#what-is-llm-temperature matrix_bot_baibot_config_agents_static_definitions_groq_config_text_generation_temperature: 1.0 @@ -267,7 +268,7 @@ matrix_bot_baibot_config_agents_static_definitions_groq_config_speech_to_text_mo ######################################################################################## # # -# Mistral agent configuration # +# Mistral agent configuration # # # ######################################################################################## @@ -304,7 +305,7 @@ matrix_bot_baibot_config_agents_static_definitions_mistral_config_text_generatio matrix_bot_baibot_config_agents_static_definitions_mistral_config_text_generation_model_id: mistral-large-latest # The prompt text to use (can be null or empty to not use a prompt). # See: https://huggingface.co/docs/transformers/en/tasks/prompting -matrix_bot_baibot_config_agents_static_definitions_mistral_config_text_generation_prompt: null +matrix_bot_baibot_config_agents_static_definitions_mistral_config_text_generation_prompt: "{{ matrix_bot_baibot_config_agents_static_definitions_prompt }}" # The temperature parameter controls the randomness of the generated text. # See: https://blogs.novita.ai/what-are-large-language-model-settings-temperature-top-p-and-max-tokens/#what-is-llm-temperature matrix_bot_baibot_config_agents_static_definitions_mistral_config_text_generation_temperature: 1.0 @@ -313,7 +314,7 @@ matrix_bot_baibot_config_agents_static_definitions_mistral_config_text_generatio ######################################################################################## # # -# /Mistral agent configuration # +# /Mistral agent configuration # # # ######################################################################################## @@ -358,7 +359,7 @@ matrix_bot_baibot_config_agents_static_definitions_openai_config_text_generation matrix_bot_baibot_config_agents_static_definitions_openai_config_text_generation_model_id: gpt-4o # The prompt text to use (can be null or empty to not use a prompt). # See: https://huggingface.co/docs/transformers/en/tasks/prompting -matrix_bot_baibot_config_agents_static_definitions_openai_config_text_generation_prompt: null +matrix_bot_baibot_config_agents_static_definitions_openai_config_text_generation_prompt: "{{ matrix_bot_baibot_config_agents_static_definitions_prompt }}" # The temperature parameter controls the randomness of the generated text. # See: https://blogs.novita.ai/what-are-large-language-model-settings-temperature-top-p-and-max-tokens/#what-is-llm-temperature matrix_bot_baibot_config_agents_static_definitions_openai_config_text_generation_temperature: 1.0