Build a cultural tourism assistant with seekdb multi-model integration
This topic demonstrates how to build your cultural tourism assistant using seedb's multi-model integration technology.
In this example, we build an attraction recommendation application through seekdb's multi-model integration of spatial data and vector search. This application can use hybrid search of GIS and vector data to find related attractions, combined with a large language model (LLM) Agent workflow to implement a simple travel planning assistant.
How it works
-
Spatial data processing technology: GIS systems provide precise geographic positioning and optimal route planning.
-
Vector data processing technology: Uses a pre-trained model (BGE-m3) to convert unstructured data of attractions into vector representations, and leverages seedb's vector search capabilities to efficiently process similarity searches.
-
Large language model Agent technology: At the intelligent interaction level, uses LLM Agent technology combined with Prompt Engineering to understand user intent and enable multi-turn conversations, achieving task decomposition and planning. This enhances the system's interactive experience, accurately understanding your needs and providing personalized services.
-
Content-based recommendation algorithm: Combines collaborative filtering and content-based recommendation algorithms, incorporating contextual information such as season and ratings to achieve personalized recommendations.
Concepts
-
Multi-model integration: Multi-model integration is an important capability of seekdb. In this topic, multi-model integration mainly refers to multi-model data hybrid search technology. seekdb supports integrated queries across vector data, spatial data, document data, and scalar data. With support for various indexes—including vector indexes, spatial indexes, and full-text indexes—it provides 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 text. Large language models can handle various natural language tasks, such as text classification, question answering, and conversation, making them an important pathway toward artificial intelligence.
Prerequisites
-
You have deployed seekdb. For more information about deploying seekdb, see Deployment overview.
-
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 obmms -
Install Poetry. You can refer to the following command:
python3 -m ensurepip
python3 -m pip install poetry -
Install the required Python packages. You can refer to the following command:
pip install python-dotenv tqdm streamlit pyobvector==0.2.16
Step 1: Obtain the LLM API key
- 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
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-demo -
Move 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="******" ## Format: IP:<port>
OB_USER="******" ## Username
OB_DB_NAME="******" ## Database 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 seekdb.
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
External 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 poetry -
Clear the Poetry cache:
poetry cache clear --all pypi -
Reinstall dependencies:
poetry install --no-cache
Environment configuration issues
Python environment not activated
Make sure you have activated the correct Python environment (such as the obmms conda environment) before installing dependencies.
Make sure you have activated the correct conda environment:
conda activate obmms
Python version incompatibility
Make sure you are using Python 3.10 or later:
python --version
If the version is too low, recreate the environment:
conda create -n obmms python=3.10
conda activate obmms
Database connection issues
If you encounter database connection issues, check:
- Whether the database connection information in the
.envfile is correct - Whether seekdb is running normally
- Whether the network connection is normal
- Whether the database user has sufficient privileges
Other common issues
Port occupied
If Streamlit prompts that the port is occupied when starting, you can specify another port:
poetry run streamlit run ./ui.py --server.port 8502
Insufficient memory
If you encounter memory issues during data import, you can:
- Reduce the batch import data volume
- Increase system memory
- Adjust seekdb memory configuration
API key issues
Make sure you have correctly configured:
- Alibaba Cloud Bailian API key (DASHSCOPE_API_KEY)
- Amap API key (AMAP_API_KEY)
API keys can be configured in the .env file.