# Enabling AI Bot in Chat

**URL:** https://meta.discourse.org/t/enabling-ai-bot-in-chat/286383
**Category:** Feature
**Tags:** chat, completed, ai, ai-bot
**Created:** [November 22, 2023, 9:01am UTC](https://meta.discourse.org/t/enabling-ai-bot-in-chat/286383 "2023-11-22T09:01:29Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![Leo\_Wong](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/leo_wong/32/286938_2.png) [@Leo\_Wong](https://meta.discourse.org/u/Leo_Wong)
#### Post date: [November 22, 2023, 9:01am UTC](https://meta.discourse.org/t/enabling-ai-bot-in-chat/286383/1 "2023-11-22T09:01:29Z")

</div>

> [@Discourse AI - AI bot](https://meta.discourse.org/t/discourse-ai-ai-bot/266012/76):
>
> @joffreyjaffeux had a prototype for streaming API in chat that could give us that. I would like us to also support this modality.

We would love to have ai bot in the chat function. our user uses Chat heavily .

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [November 22, 2023, 9:12am UTC](https://meta.discourse.org/t/enabling-ai-bot-in-chat/286383/2 "2023-11-22T09:12:03Z")

</div>

Can you expand on how you wish it would work?

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [November 22, 2023, 9:42am UTC](https://meta.discourse.org/t/enabling-ai-bot-in-chat/286383/3 "2023-11-22T09:42:48Z")

</div>

My users would use it like

- my vet said dogs can get vitamin D from sunlight
- I don’t think so… everybody says we have to use nutraceuticals
- really? Hi `@helpful-bot` can dogs get vitamin D from the sun?

Something like that. Means I don’t need different personas. But for me that is not a deal breaker. I have that another chatbot in use at channels :smirking_face:

---

<div class="post-metadata">

### Author: ![Leo\_Wong](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/leo_wong/32/286938_2.png) [@Leo\_Wong](https://meta.discourse.org/u/Leo_Wong)
#### Post date: [November 22, 2023, 11:22am UTC](https://meta.discourse.org/t/enabling-ai-bot-in-chat/286383/4 "2023-11-22T11:22:33Z")

</div>

Apologies for the ambiguity. I meant to say that we want our users to be able to summon the bot in the general chat channel by using @botname. Additionally, users within the eligible group should have the capability to directly message the bot. like the screen shots below;

 ![2023-11-22 at 11.19](https://global.discourse-cdn.com/meta/original/4X/c/a/b/cabfb3d48a509afaad29bb45a6fb86bebf56d34c.png) ![2023-11-22 at 11.21](https://global.discourse-cdn.com/meta/original/4X/a/a/3/aa3d37f6fcdd22ee3714ddef8e2393d939940074.png)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [November 22, 2023, 11:04pm UTC](https://meta.discourse.org/t/enabling-ai-bot-in-chat/286383/5 "2023-11-22T23:04:26Z")

</div>

I see, so trying to zero in here there are … with a bit more technical details.

1. @mentioning `@gpt3.5-bot` would select the first prioritized persona… that would usually be forum helper but you could change it.
2. We would also supply context (lets say 1000 tokens of previous chat messages) so it would be lined up. (is this configurable or not? configurable by persona or not?)
3. We clearly need to restrict the group of people who can `@mention` in chat, so we would need a site setting for it.
4. We would need to think about auditability, an easy minimum here would be to ship a [data explorer](https://meta.discourse.org/t/32566?silent=true) query.
5. Given recent chat refactors, we can open “unlimited” new discussions with a bot, so we could design something there for sure.
6. If we allow @mentioning in chat… why not also allow it in forum posts to the same group? different group.

Given all of this… my V0 suggestion would be:

1. Add site setting `ai_bot_chat_enabled_groups`
2. Hard code 1000 tokens of context for now - choose first prioritized persona
3. Only do `@mention` support for V0

* * *

V1

1. Streaming and cancel support

* * *

V2

1. Add optional support for “Group DMs with ai bots”
2. Ensure we also have a nice UI to find all this stuff and minimize overhead of doing this.

* * *

V3

1. Optionally allow personas to also stage a dedicated user with a dedicated avatar. Then you can interact with multiple bots in chat. In this mode persona would have a user/model selected as well.

2. Also move some configuration to persona UI … which persona is enabled for chat?

* * *

V4

1. Think about limits - maximum token usage per day per user, stuff like that

* * *

V5

1. Think about also adding some of this into standard topics - (needs site setting, etc…) eg: `@summary_bot summarize this topic up till now`

* * *

Overall I like a lot of this, just need to figure out how we line this stuff into our roadmap.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [November 23, 2023, 8:57am UTC](https://meta.discourse.org/t/enabling-ai-bot-in-chat/286383/7 "2023-11-23T08:57:06Z")

</div>

In the meantime, if you are self-hosted, you can always consider [Discourse Chatbot](https://meta.discourse.org/t/discourse-chatbot-now-smarter-than-chatgpt/256652), which has supported Chat from the very beginning (and indeed was the first AI Chatbot for Discourse).

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [November 23, 2023, 1:54pm UTC](https://meta.discourse.org/t/enabling-ai-bot-in-chat/286383/8 "2023-11-23T13:54:58Z")

</div>

> [@sam](#):
>
> Given all of this… my V0 suggestion would be:
> 
> 1. Add site setting `ai_bot_chat_enabled_groups`
> 2. Hard code 1000 tokens of context for now - choose first prioritized persona
> 3. Only do `@mention` support for V0

This sounds like a very solid plan.

> [@sam](#):
>
> @mentioning `@gpt3.5-bot` would select the first prioritized persona… that would usually be forum helper but you could change it.

Maybe we start with a setting for a default chat persona, and eventually migrate to per-channel?

> [@sam](#):
>
> We clearly need to restrict the group of people who can `@mention` in chat, so we would need a site setting for it.

100%

> [@sam](#):
>
> If we allow @mentioning in chat… why not also allow it in forum posts to the same group? different group.

I think chat is a good place to start, then eventually port same behavior to topics.

---

<div class="post-metadata">

### Author: ![Saif](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/saif/32/318253_2.png) [@Saif](https://meta.discourse.org/u/Saif)
#### Post date: [November 23, 2023, 10:38pm UTC](https://meta.discourse.org/t/enabling-ai-bot-in-chat/286383/10 "2023-11-23T22:38:09Z")

</div>

> [@sam](#):
>
> Given all of this… my V0 suggestion would be:
> 
> 1. Add site setting `ai_bot_chat_enabled_groups`
> 2. Hard code 1000 tokens of context for now - choose first prioritized persona
> 3. Only do `@mention` support for V0

I pretty much agree with your and @Falco’s thoughts here, the only thing to add would be to make sure it’s working with Chat Threads as well, if not V0 then V1/V2

(Optional) One additional thing that might be worth adding down the line is an option here to initiate a chat with the bot, my thinking is that for certain users might not even know they can do that!

 ![CleanShot 2023-11-23 at 17.39.15@2x](https://global.discourse-cdn.com/meta/original/4X/4/4/2/442a8d2d8430e0cf9a4fc127b115a99ed49b3695.png)

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [December 4, 2023, 7:39pm UTC](https://meta.discourse.org/t/enabling-ai-bot-in-chat/286383/11 "2023-12-04T19:39:29Z")

</div>

Seems ok for a V0. I think having a better UI to create bots and be able to define allowed groups from this UI would be far better than a site setting in mid/long term.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [December 4, 2023, 8:33pm UTC](https://meta.discourse.org/t/enabling-ai-bot-in-chat/286383/12 "2023-12-04T20:33:59Z")

</div>

Persona editor is how we will get there, for sure.

We already have all the bones for attaching a new user to a persona

---

<div class="post-metadata">

### Author: ![fbpbdmin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fbpbdmin/32/300893_2.png) [@fbpbdmin](https://meta.discourse.org/u/fbpbdmin)
#### Post date: [April 2, 2024, 4:25pm UTC](https://meta.discourse.org/t/enabling-ai-bot-in-chat/286383/13 "2024-04-02T16:25:47Z")

</div>

AI bot in chat will be much better than current private messaging to AI…  
hope could add this enhancement soon…

btw, seems gemini API usage will not be free soon… hmm…

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [April 3, 2024, 12:51am UTC](https://meta.discourse.org/t/enabling-ai-bot-in-chat/286383/14 "2024-04-03T00:51:48Z")

</div>

> [@fbpbdmin](#):
>
> AI bot in chat will be much better than current private messaging to AI…

I have been experimenting with this, it comes with quite a few limitations given keeping track of history is hard, markdown is not as complete and more… It is not a slam dunk. Yet it is easy to start conversations but it not a complete replacement.

Can you expand expand exactly why you think it is much better?

Gemini 1.0 pro is not that great, I would avoid it anyway, if you are looking for a cheap LLM then Claude 3 Haiku is the way to go.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [May 9, 2024, 4:44am UTC](https://meta.discourse.org/t/enabling-ai-bot-in-chat/286383/15 "2024-05-09T04:44:02Z")

</div>

This is now implemented! :confetti_ball:

Guide at:

> [@AI bot - Chat and PM integration](https://meta.discourse.org/t/discoruse-ai-chat-integration/307353):
>
> bookmark This guide explains how to integrate [AI bot - Agents](https://meta.discourse.org/t/ai-bot-agents/306099) into your chat and personal message (PM) experience. person_raising_hand Required user level: Administrator Configuring chat and PM for Agentsinformation_source In order to integrate with chat or topic mentions, an agent must have a User created and have a Default Language Model selected. Enable Allow Personal Messages, this will allow users to send PMs to the agent. Enable Allow Topic Mentions, this will all…

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [May 11, 2024, 7:00am UTC](https://meta.discourse.org/t/enabling-ai-bot-in-chat/286383/16 "2024-05-11T07:00:39Z")

</div>

This topic was automatically closed after 2 days. New replies are no longer allowed.
