# Discourse AI + Google Search: website + forum | Is this correct?

**URL:** https://meta.discourse.org/t/discourse-ai-google-search-website-forum-is-this-correct/275963
**Category:** Support
**Tags:** ai, ai-bot
**Created:** [August 21, 2023, 12:48am UTC](https://meta.discourse.org/t/discourse-ai-google-search-website-forum-is-this-correct/275963 "2023-08-21T00:48:28Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![janbolmeson](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/janbolmeson/32/192162_2.png) [@janbolmeson](https://meta.discourse.org/u/janbolmeson)
#### Post date: [August 21, 2023, 12:48am UTC](https://meta.discourse.org/t/discourse-ai-google-search-website-forum-is-this-correct/275963/1 "2023-08-21T00:48:28Z")

</div>

Related to: [Discourse AI - AI Bot (chatbot - ChatGPT- Anthropic)](https://meta.discourse.org/t/discourse-ai-ai-bot-chatbot-chatgpt-anthropic/266012) where it says:

> [@Discourse AI - AI bot](https://meta.discourse.org/t/discourse-ai-ai-bot/266012/1):
>
> When configured it can search using Google

> [@Discourse AI - AI bot](https://meta.discourse.org/t/discourse-ai-ai-bot/266012/1):
>
> `ai_google_custom_search_api_key`: (optional) google custom search api key

So, I have been playing around with this and just want to make sure I understand this correctly.

My use-case is as follows (which I think applies to more people):

- I have a website with a lot of blog posts

- I have the forum on the same url

- In my case the forum is not on a subdomain but in [example.com/forum](http://example.com/forum) whereas all the other posts are in e.g. [example.com/blog-post/](http://example.com/blog-post/). But it should not matter that much.

So what I did was:

- Install the Discourse AI (love it btw)

- Setup the custom google search API and CX

And started to play with the ChatBot. One question i told it was to:

> 1. Get me all topics on a subject in the forum. Is it correct that for this it does not need google since it uses internal search? I am 99% sure it is that way.

> 1. I then asked for all posts - except in the forum - on the same topic. I.e. I wanted it fetch them outside the forum. It worked, since it said it said it used Google.

 ![image](https://global.discourse-cdn.com/meta/original/4X/d/7/e/d7e72b489abfbfe5ea8ff0ace4c7a83efa47cd85.png)

> 1. Can I deduce it used the `ai_google_custom_search_api_key` correctly?

Because what I am thinking of is that I setup the Google Search specifically to exclude the forum path. I.e. as below. But is this nescessary or am I overthinking it since it used the `-inurl forum` already in the query… 🤔

 ![image](https://global.discourse-cdn.com/meta/original/4X/6/9/6/696793f7ef4ab57c8bfc702627c686a7da832444.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: [August 21, 2023, 1:22am UTC](https://meta.discourse.org/t/discourse-ai-google-search-website-forum-is-this-correct/275963/2 "2023-08-21T01:22:56Z")

</div>

> [@janbolmeson](#):
>
> Can I deduce it used the `ai_google_custom_search_api_key` correctly?

Everything is 100% (sort of easily) debuggable. If you install [data explorer](https://meta.discourse.org/t/32566?silent=true) you can see the actual JSON payload we injected in the prompt stream. The table `ai_api_audit_logs` contains the exact prompt we generated.

My original use case for Google was just to allow it to search everywhere, not restrict it down. That said, I think you can manage to get something working here. We may need though to adjust the prompt a bit to understand that this this google search is restricted. We may need an extra setting for it.
