Default template

Set up AI search

By Nolan Shaffer.

Last edited by nolans2022photos. Created .

To set up AI search, you’ll need a working Google Gemini API Key. Once you’ve set up a Google Cloud service account, this is very easy to do.

Go to Google AI Studio and click Create API key. Select the Google Cloud Project you set up and click Create API key in existing project.

Add the key to your environmental variables:

LLM_API_KEY=asdfasdfllmkeyasdfasdf
`

You can also adjust the environmental variable LLM_API_CALLS.

LLM_API_CALLS=number

You should also adjust the token limit based on the latest model. You can find that information for Gemini here. For Gemini 1.5 Flash, the latest model as of November 8th, 2024, the token limit is 1,000,000.

LLM_TOKEN_LIMIT=1000000

This will be the number of times a user question gets sent to the LLM. More times may yield better results in some cases. Because of the randomness and inaccuracies of LLMs, sending the query multiple times could result in higher quality answers, for instance if the LLM can’t find the answer on one request, it might be able to find it on two.

This will increase response time (though only slightly). The main trade off is that the Google Gemini API allows for a max of 15 API calls per minute and 1,500 per day on the free tier, so you don’t want to overwhelm it. *The recommended value for this is 1, and if you’re getting bad results you should increase it in small increments.*