error : database name param not found when migration to tencent vector db
MichaelYangjson opened this issue · comments
Self Checks
- This is only for bug report, if you would like to ask a question, please head to Discussions.
- I have searched for existing issues search for existing issues, including closed ones.
- I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
- 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
- Please do not modify this template :) and fill in all the required fields.
Dify version
0.6.12
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
migrate vector to tencent error:
Traceback (most recent call last): File "/app/api/core/indexing\_runner.py", line 76, in run self.\_load( File "/app/api/core/indexing\_runner.py", line 689, in \_load tokens += future.result() File "/usr/local/lib/python3.10/concurrent/futures/\_base.py", line 458, in result return self.\_\_get\_result() File "/usr/local/lib/python3.10/concurrent/futures/\_base.py", line 403, in \_\_get\_result raise self.\_exception File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(\*self.args, \*\*self.kwargs) File "/app/api/core/indexing\_runner.py", line 742, in \_process\_chunk index\_processor.load(dataset, chunk\_documents, with\_keywords=False) File "/app/api/core/rag/index\_processor/processor/paragraph\_index\_processor.py", line 59, in load vector = Vector(dataset) File "/app/api/core/rag/datasource/vdb/vector\_factory.py", line 37, in \_\_init\_\_ self.\_vector\_processor = self.\_init\_vector() File "/app/api/core/rag/datasource/vdb/vector\_factory.py", line 49, in \_init\_vector return vector\_factory\_cls().init\_vector(self.\_dataset, self.\_attributes, self.\_embeddings) File "/app/api/core/rag/datasource/vdb/tencent/tencent\_vector.py", line 216, in init\_vector return TencentVector( File "/app/api/core/rag/datasource/vdb/tencent/tencent\_vector.py", line 50, in \_\_init\_\_ self.\_db = self.\_init\_database() File "/app/api/core/rag/datasource/vdb/tencent/tencent\_vector.py", line 61, in \_init\_database return self.\_client.create\_database(database\_name=self.\_client\_config.database) File "/app/api/.venv/lib/python3.10/site-packages/tcvectordb/client/stub.py", line 40, in create\_database db.create\_database(timeout=timeout) File "/app/api/.venv/lib/python3.10/site-packages/tcvectordb/model/database.py", line 48, in create\_database raise exceptions.ParamError( tcvectordb.exceptions.ParamError: <ParamError: (code=-1, message=database name param not found)>
✔️ Expected Behavior
success
❌ Actual Behavior
@MichaelYangjson Hello there! I'm a bot that can help you solve bugs, answer questions, and become a contributor. I'm here to help you while waiting for a human maintainer.
To resolve the "database name param not found" error when migrating a vector to Tencent Vector DB using Dify version 0.6.12, self-hosted via Docker, ensure that the TENCENT_VECTOR_DB_DATABASE
environment variable is set correctly in your .env
file.
Here is the relevant section from the .env.example
file:
# tencent vector configurations, only available when VECTOR_STORE is `tencent`
TENCENT_VECTOR_DB_URL=http://127.0.0.1
TENCENT_VECTOR_DB_API_KEY=dify
TENCENT_VECTOR_DB_TIMEOUT=30
TENCENT_VECTOR_DB_USERNAME=dify
TENCENT_VECTOR_DB_DATABASE=dify
TENCENT_VECTOR_DB_SHARD=1
TENCENT_VECTOR_DB_REPLICAS=2
Make sure that TENCENT_VECTOR_DB_DATABASE
is set to the correct database name. If it is not set or is incorrect, you will encounter the "database name param not found" error.
Additionally, ensure that the TencentConfig
class in your code correctly maps the environment variables to the configuration parameters. The database
parameter should be properly passed to the VectorDBClient
initialization. Here is the relevant part of the code:
class TencentConfig(BaseModel):
url: str
api_key: Optional[str]
timeout: float = 30
username: Optional[str]
database: Optional[str]
index_type: str = "HNSW"
metric_type: str = "L2"
shard: int = 1,
replicas: int = 2,
def to_tencent_params(self):
return {
'url': self.url,
'username': self.username,
'key': self.api_key,
'timeout': self.timeout
}
Ensure that the database
parameter is correctly set and used in the _init_database
method:
def _init_database(self):
exists = False
for db in self._client.list_databases():
if db.database_name == self._client_config.database:
exists = True
break
if exists:
return self._client.database(self._client_config.database)
else:
return self._client.create_database(database_name=self._client_config.database)
By verifying these configurations and ensuring the correct environment variables are set, you should be able to resolve the "database name param not found" error [1][2][3].