How to Set Up Wren AI Using Your Custom LLM or Embedder
We highly recommend using OpenAI o3-mini, GPT-4o or GPT-4o-mini with Wren AI. These models have been extensively tested to ensure optimal performance and compatibility.
While it is technically possible to integrate other AI models, please note that they have not been fully tested with our system. Therefore, using alternative models is at your own risk and may result in unexpected behavior or suboptimal performance.
To set up Wren AI with your custom LLM, Embedder or Document Store, follow these steps:
Check if Wren AI already supports your preferred LLM or embedding models
Please first check whether Wren AI already supports your preferred LLM or embedding models in the LiteLLM documentation. You can also check whether Wren AI already provides a configuration example in the configuration examples here.
- If Wren AI already supports your preferred LLM or embedding models and provides a configuration example, you can set up the configuration by referring to the example and then go to step 4 to launch Wren AI.
- If Wren AI already supports your preferred LLM or embedding models but does not provide a configuration example, please follow the steps below to set up the configuration. We need your help to improve the documentation and add configuration examples — contributions to Wren AI are welcome!
- If Wren AI does not support your preferred LLM or embedding models, please jump to the Adding a Custom LLM, Embedder or Document Store to Wren AI section to add your preferred LLM or embedding models to Wren AI.
Copy and Rename the Configuration Files
First, you need to copy the example configuration file and rename it. This file will be used to configure your custom provider.
-
Replace
<WRENAI_VERSION_NUMBER>with the version number of Wren AI you are using. -
For MacOS or Linux Users: Open your terminal and run the following command:
wget -O config.example.yaml https://raw.githubusercontent.com/canner/WrenAI/<WRENAI_VERSION_NUMBER>/docker/config.example.yaml && \mkdir -p ~/.wrenai && cp config.example.yaml ~/.wrenai/config.yamlwget -O .env.example https://raw.githubusercontent.com/canner/WrenAI/<WRENAI_VERSION_NUMBER>/docker/.env.example && \mkdir -p ~/.wrenai && cp .env.example ~/.wrenai/.env -
For Windows Users: Open PowerShell and execute these commands:
wget -O config.example.yaml https://raw.githubusercontent.com/canner/WrenAI/<WRENAI_VERSION_NUMBER>/docker/config.example.yamlmkdir -p ~/.wrenaicp config.example.yaml ~/.wrenai/config.yamlnotepad ~/.wrenai/config.yaml # Fill in required configurationswget -O .env.example https://raw.githubusercontent.com/canner/WrenAI/<WRENAI_VERSION_NUMBER>/docker/.env.examplemkdir -p ~/.wrenaicp .env.example ~/.wrenai/.env.example.txtnotepad ~/.wrenai/.env.example.txt # Fill in required configurationsmv ~/.wrenai/.env.example.txt ~/.wrenai/.env # Rename the file
Configure Your Provider
Open the ~/.wrenai/config.yaml file and update it to match your custom LLM, Embedder, or Document Store settings. Use the examples below as a starting point. You may also need to update the .env file with required API keys.
-
For custom LLM
-
We are now using LiteLLM to support LLMs, so you can use any LLM supported by LiteLLM.
-
For example, if you want to use
llama3.1:8bfrom Ollama- Add the following configuration to your
config.yamlunder thelitellm_llmsection:
type: llmprovider: litellm_llmmodels:- api_base: http://host.docker.internal:11434/v1 # if you are using mac/windows, don't change this; if you are using linux, please search "Run Ollama in docker container" in this page: https://docs.getwren.ai/oss/installation/custom_llm#running-wren-ai-with-your-custom-llm-embeddermodel: ollama_chat/llama3.1:8b # ollama_chat/<ollama_model_name>timeout: 600kwargs:n: 1temperature: 0 - Add the following configuration to your
-
Please refer to the LiteLLM documentation for more details about each LLM's supported parameters.
- You need to fill in a new model configuration under the
litellm_llmsection — for example, the model name, api_base, api_key_name, keyword arguments, etc. — according to the LiteLLM documentation. (Please refer to the example configuration above.)
- You need to fill in a new model configuration under the
-
-
For custom Embedder
-
We are now using LiteLLM to support embedding models, so you can use any embedding model supported by LiteLLM.
-
For example, if you want to use
nomic-embed-textfrom Ollama, add the following configuration to yourconfig.yamlunder thelitellm_embeddersection. Also make sureembedding_model_dimunder thedocument_storesection is set to the dimension of the embedding model:---type: embedderprovider: litellm_embeddermodels:- model: ollama/nomic-embed-text # put your ollama embedder model name here, openai/<ollama_model_name>api_base: http://host.docker.internal:11434/v1 # if you are using mac/windows, don't change this; if you are using linux, please search "Run Ollama in docker container" in this page: https://docs.getwren.ai/oss/installation/custom_llm#running-wren-ai-with-your-custom-llm-embeddertimeout: 600---type: document_storeprovider: qdrantlocation: http://qdrant:6333embedding_model_dim: 768 # put your embedding model dimension heretimeout: 120recreate_index: true
-
-
After updating the LLM and embedder configurations, you need to replace the corresponding
llmandembeddervalues in the pipeline section. Note that the format ofllmandembeddermust be<provider>.<model_name>, such aslitellm_llm.ollama_chat/llama3.1:8bandlitellm_llm.ollama/nomic-embed-text.
Launch Wren AI
Launch Wren AI by running the launcher app and selecting the "Custom" option from the dropdown menu.
For Ollama Integration:
- Run Ollama as a desktop application:
- Only for Windows/MacOS users.
- Install Ollama from ollama.com.
- Start the Ollama desktop application or run
ollama servein your terminal. - Pull your desired model using the command:
ollama pull <model_name>. - Set the
urlin theollama_embedder/ollama_llmsection ofconfig.yamlto point to your Ollama server (default:http://docker.host.internal:11434).
- Run Ollama in a Docker container:
- For Windows/MacOS/Linux users.
- Run Ollama in a Docker container using the following command:
docker run -d --network wrenai_wren -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama. - Set the
urlin theollama_embedder/ollama_llmsection ofconfig.yamlto point to your Ollama server (default:http://ollama:11434).