This topic describes how to build a cultural tourism assistant using OceanBase multi-model integration.
Concept
Multi-model integration: Multi-model integration is an important aspect of OceanBase's unified product vision. In this topic, multi-model integration mainly refers to hybrid retrieval technology for multiple data types. OceanBase supports integrated queries across vector data, spatial data, document data, and scalar data. With support for various indexes—including vector, spatial, and full-text indexes—it delivers high-performance hybrid search capabilities.
Large language model (LLM): A large language model is a deep learning model trained on vast amounts of text data. It can generate natural language text or understand the meaning of language. Large language models are capable of handling a variety of natural language tasks, such as text classification, question answering, and conversation, making them an important pathway toward artificial intelligence.
Prerequisites
You have deployed OceanBase V4.3.3 or later and created a MySQL-compatible tenant. For more information about deploying OceanBase clusters, see Deployment overview.
The MySQL-compatible tenant has the privileges to insert and query data. For more information about setting privileges, see Directly grant privileges.
You have created a database. For more information about creating a database, see Create a database.
Vector search is enabled. For more information about vector search, see Perform vector search by using SQL statements.
obclient> ALTER SYSTEM SET ob_vector_memory_limit_percentage = 30;(Recommended, not required) Install Python 3.10 and later and the corresponding pip. If your machine has a low Python version, you can use Miniconda to create a new Python 3.10 or later environment. For more information, see Miniconda installation guide.
conda create -n obmms python=3.10 && conda activate obmmsInstall Poetry. You can refer to the following command:
python3 -m ensurepip python3 -m pip install poetryInstall the required Python packages. You can use the following command:
pip install python-dotenv tqdm streamlit pyobvector==0.2.16
Step 1: Obtain the LLM API key
Notice
To activate the large model service in Alibaba Cloud Model Studio, you will need to be redirected to a third-party platform to complete the process. This operation will follow the pricing policies of the third-party platform and may incur corresponding charges. Before proceeding, please visit their official website or review the relevant documentation to confirm and accept their pricing standards. If you do not agree, please do not continue with this operation.
Register for an account with Alibaba Cloud Model Studio, activate the model service, and obtain an API key.



Step 2: Obtain a geographic service API key
Notice
To activate Amap geographic services, you will need to be redirected to a third-party platform to complete the process. This operation will follow the pricing policies of the third-party platform and may incur corresponding charges. Before proceeding, please visit their official website or review the relevant documentation to confirm and accept their pricing standards. If you do not agree, please do not continue with this operation.
Register on the Amap (Gaode) Open Platform and obtain an API key for the Basic LBS service.
Step 3: Download the public dataset
Download the China City Attraction Details dataset from Kaggle.
Step 4: Build your cultural tourism assistant
Clone the project repository
Clone the latest project repository.
git clone https://github.com/oceanbase-devhub/ob-multi-model-search-demo.git cd ob-multi-model-search-demoMove the downloaded
archivedataset ZIP package to theob-multi-model-search-demoproject folder, rename it tocitydata, and decompress it.# Please modify the path to the actual location of archive.zip. mv ./archive.zip ./citydata.zip unzip ./citydata.zip
Install dependencies
Run the following command in the project root directory to install dependencies.
poetry install
Set environment variables
Set the environment variables in the .env file:
vim .env
You need to update the OB_-prefixed variables with your database connection information, and manually add the following variables: update DASHSCOPE_API_KEY with the API key obtained from the Alibaba Cloud Tongyi Lab console, and update AMAP_API_KEY with the API key obtained from the Alibaba Cloud Amap API service. Then, save the file.
# Host address in the database connection string
OB_URL="******"
OB_USER="******"
OB_DB_NAME="******"
# Password in the database connection string
OB_PWD="******"
# Optional SSL CA file path in the database connection string. If you do not need SSL encryption, remove this parameter.
OB_DB_SSL_CA_PATH="******"
# Manually add LLM API key
DASHSCOPE_API_KEY="******"
# Manually add Amap API key
AMAP_API_KEY="******"
Import data
In this step, we will import the data from the downloaded dataset into OceanBase.
Notice
For the first build, we recommend that you select only a portion of the data (such as attractions starting with the letter A) for import. Importing all data will take a long time.
python ./obmms/data/attraction_data_preprocessor.py
If the following progress is displayed, the data is being successfully imported.
...
./citydata/Changde.csv:
100%|███████████████████████████████████████████████████████████████████████████| 100/100 [00:04<00:00, 20.77it/s]
./citydata/Weinan.csv:
100%|█████████████████████████████████████████████████████████████████████████████| 90/90 [00:13<00:00, 6.54it/s]
...
Start the UI chat interface
Run the following command to start the chat interface:
poetry run streamlit run ./ui.py
If no web page is directly displayed, you can visit the URL shown in the terminal to open the tourism assistant application.
You can now view your Streamlit app in your browser.
Local URL: http://localhost:8501
Network URL: http://172.xxx.xxx.xxx:8501
Troubleshooting
Dependency installation issues
Poetry installation failure
If the poetry install command fails, try the following steps:
Update Poetry to the latest version:
pip install --upgrade poetryClear the Poetry cache:
poetry cache clear --all pypiReinstall dependencies:
poetry install --no-cache
Environment configuration issues
Python environment not activated
Notice
Make sure you have activated the correct Python environment (for example, the obmms conda environment) before installing dependencies.
Activate the appropriate conda environment:
conda activate obmms
Incompatible Python version
Make sure you are using Python 3.10 or later:
python --version
If your Python version is too old, create a new environment:
conda create -n obmms python=3.10
conda activate obmms
Database connection issues
If you are having trouble connecting to the database, check the following:
- The database connection information in your
.envfile is correct - The OceanBase cluster is running properly
- Your network connection is stable
- The database user has sufficient permissions
Other common issues
Port already in use
If Streamlit reports that the port is already in use when starting, you can specify a different port:
poetry run streamlit run ./ui.py --server.port 8502
Insufficient memory
If you encounter out-of-memory errors during data import, you can:
- Reduce the batch size of imported data
- Increase your system memory
- Adjust OceanBase's memory configuration
API key issues
Make sure you have correctly configured the following:
- API key (
DASHSCOPE_API_KEY) from Alibaba Cloud Model Studio - Amap API key (
AMAP_API_KEY)
You can set your API keys in the .env file.