etkecc / baibot

🤖 A Matrix bot for using diffent capabilities (text-generation, text-to-speech, speech-to-text, image-generation, etc.) of AI / Large Language Models (OpenAI, Anthropic, etc.)
GNU Affero General Public License v3.0
15 stars 0 forks source link

Current date as context #10

Closed CybotTM closed 1 day ago

CybotTM commented 3 days ago

Hi,

is there any way to autom. give the current date as context?

image

spantaleev commented 11 hours ago

Prompt variables are supported since version 1.1.0.

If you're using matrix-docker-ansible-deploy to deploy the bot, it will now automatically set a prompt which tells the bot its name, model id and current date/time in UTC. See https://github.com/spantaleev/matrix-docker-ansible-deploy/commit/be96be8b3c1234ac8cbe58160d8ef9c76a325884

The default prompt used by the playbook is also the default prompt recommended during agent creation. It currently looks like this:

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 }}.

The prompt for dynamically-created models (per room or globally) will not be adjusted. If you had created agents without a prompt, you would need to update them (see Updating agents) to include one or you'd need to use the 💬 Text Generation / ⌨️ Prompt Override configuration setting.


Some explanation as to why the default prompt is like this follows.

Passing the bot's name is important sometimes when using the mention (@baibot Hello!) feature in multi-user chats (related to the 💬 Text Generation / 🗟 Prefix Requirement Type configuration). Sometimes we're unable to properly strip the bot's name from the message and the model may see the bot's name anyway. I've sometimes seen the model (Anthropic) get confused as to who "baibot" is, so explicitly telling the model its name should be helpful.

I've also seen users ask the model what kind of model it is and it not knowing or replying incorrectly (gpt-4o saying it's gpt-3.5-turbo), so it's helpful to tell the model what its model id is (as defined in the configuration).

It was intentionally decided to avoid local time and timezones when implementing this feature. It's added complexity and sometimes different bot users would be in different timezones anyway. It was decided that it's better to keep timezone-neutral, but explicitly tell the model that the provided time is in UTC, so it can forward that information to users who ask. Certain models can also calculate local time in different timezones correctly out of the UTC value.

spantaleev commented 11 hours ago

Screenshot of the current behavior with the default prompt (in English) and reusing the original question in German:

Screenshot_20240922_122607