refactor(api): type VDB config params dicts with TypedDicts#34677
Merged
asukaminato0721 merged 1 commit intolanggenius:mainfrom Apr 7, 2026
Merged
Conversation
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-07 13:15:10.049764478 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-07 13:15:00.198656348 +0000
@@ -147,9 +147,9 @@
ERROR `None` is not subscriptable [unsupported-operation]
--> core/rag/datasource/vdb/lindorm/lindorm_vector.py:392:30
ERROR Cannot index into `Coroutine[Unknown, Unknown, Unknown]` [bad-index]
- --> core/rag/datasource/vdb/milvus/milvus_vector.py:86:50
+ --> core/rag/datasource/vdb/milvus/milvus_vector.py:96:50
ERROR Argument `dict[Unknown, Unknown] | str` is not assignable to parameter `version` with type `str` in function `packaging.version.parse` [bad-argument-type]
- --> core/rag/datasource/vdb/milvus/milvus_vector.py:104:34
+ --> core/rag/datasource/vdb/milvus/milvus_vector.py:114:34
ERROR Argument `Literal['HNSW']` is not assignable to parameter `index_type` with type `VecIndexType` in function `pyobvector.client.index_param.IndexParams.add_index` [bad-argument-type]
--> core/rag/datasource/vdb/oceanbase/oceanbase_vector.py:160:28
ERROR Class member `OceanBaseVector.add_texts` overrides parent class `BaseVector` in an inconsistent manner [bad-override]
@@ -167,46 +167,46 @@
ERROR No matching overload found for function `sqlalchemy.sql.sqltypes.UUID.__init__` called with arguments: (as_uuid=Literal[True]) [no-matching-overload]
--> core/rag/datasource/vdb/pgvecto_rs/pgvecto_rs.py:67:32
ERROR Argument `str | None` is not assignable to parameter `database_name` with type `str` in function `tcvectordb.rpc.client.stub.RPCVectorDBClient.describe_collection` [bad-argument-type]
- --> core/rag/datasource/vdb/tencent/tencent_vector.py:69:35
+ --> core/rag/datasource/vdb/tencent/tencent_vector.py:82:35
ERROR Object of class `FilterIndex` has no attribute `dimension`
ERROR Argument `str | None` is not assignable to parameter `database_name` with type `str` in function `tcvectordb.rpc.client.stub.RPCVectorDBClient.create_database_if_not_exists` [bad-argument-type]
- --> core/rag/datasource/vdb/tencent/tencent_vector.py:81:73
+ --> core/rag/datasource/vdb/tencent/tencent_vector.py:94:73
ERROR Argument `str | None` is not assignable to parameter `database_name` with type `str` in function `tcvectordb.rpc.client.stub.RPCVectorDBClient.exists_collection` [bad-argument-type]
- --> core/rag/datasource/vdb/tencent/tencent_vector.py:92:31
+ --> core/rag/datasource/vdb/tencent/tencent_vector.py:105:31
ERROR Argument `SparseIndex` is not assignable to parameter `object` with type `FilterIndex | VectorIndex` in function `list.append` [bad-argument-type]
- --> core/rag/datasource/vdb/tencent/tencent_vector.py:137:32
+ --> core/rag/datasource/vdb/tencent/tencent_vector.py:150:32
ERROR Argument `str | None` is not assignable to parameter `database_name` with type `str` in function `tcvectordb.rpc.client.stub.RPCVectorDBClient.create_collection` [bad-argument-type]
- --> core/rag/datasource/vdb/tencent/tencent_vector.py:140:35
+ --> core/rag/datasource/vdb/tencent/tencent_vector.py:153:35
ERROR Argument `list[FilterIndex | VectorIndex]` is not assignable to parameter `indexes` with type `list[IndexField]` in function `tcvectordb.rpc.client.stub.RPCVectorDBClient.create_collection` [bad-argument-type]
- --> core/rag/datasource/vdb/tencent/tencent_vector.py:145:29
+ --> core/rag/datasource/vdb/tencent/tencent_vector.py:158:29
ERROR Argument `SparseIndex` is not assignable to parameter `object` with type `FilterIndex | VectorIndex` in function `list.append` [bad-argument-type]
- --> core/rag/datasource/vdb/tencent/tencent_vector.py:156:36
+ --> core/rag/datasource/vdb/tencent/tencent_vector.py:169:36
ERROR Argument `str | None` is not assignable to parameter `database_name` with type `str` in function `tcvectordb.rpc.client.stub.RPCVectorDBClient.create_collection` [bad-argument-type]
- --> core/rag/datasource/vdb/tencent/tencent_vector.py:158:35
+ --> core/rag/datasource/vdb/tencent/tencent_vector.py:171:35
ERROR Argument `list[FilterIndex | VectorIndex]` is not assignable to parameter `indexes` with type `list[IndexField]` in function `tcvectordb.rpc.client.stub.RPCVectorDBClient.create_collection` [bad-argument-type]
- --> core/rag/datasource/vdb/tencent/tencent_vector.py:163:29
+ --> core/rag/datasource/vdb/tencent/tencent_vector.py:176:29
ERROR Class member `TencentVector.add_texts` overrides parent class `BaseVector` in an inconsistent manner [bad-override]
- --> core/rag/datasource/vdb/tencent/tencent_vector.py:171:9
+ --> core/rag/datasource/vdb/tencent/tencent_vector.py:184:9
ERROR Argument `str | None` is not assignable to parameter `database_name` with type `str` in function `tcvectordb.rpc.client.stub.RPCVectorDBClient.upsert` [bad-argument-type]
- --> core/rag/datasource/vdb/tencent/tencent_vector.py:195:31
+ --> core/rag/datasource/vdb/tencent/tencent_vector.py:208:31
ERROR Argument `str | None` is not assignable to parameter `database_name` with type `str` in function `tcvectordb.rpc.client.stub.RPCVectorDBClient.query` [bad-argument-type]
- --> core/rag/datasource/vdb/tencent/tencent_vector.py:203:27
+ --> core/rag/datasource/vdb/tencent/tencent_vector.py:216:27
ERROR Argument `str | None` is not assignable to parameter `database_name` with type `str` in function `tcvectordb.rpc.client.stub.RPCVectorDBClient.delete` [bad-argument-type]
- --> core/rag/datasource/vdb/tencent/tencent_vector.py:223:31
+ --> core/rag/datasource/vdb/tencent/tencent_vector.py:236:31
ERROR Argument `str | None` is not assignable to parameter `database_name` with type `str` in function `tcvectordb.rpc.client.stub.RPCVectorDBClient.delete` [bad-argument-type]
- --> core/rag/datasource/vdb/tencent/tencent_vector.py:228:27
+ --> core/rag/datasource/vdb/tencent/tencent_vector.py:241:27
ERROR Argument `str | None` is not assignable to parameter `database_name` with type `str` in function `tcvectordb.rpc.client.stub.RPCVectorDBClient.search` [bad-argument-type]
- --> core/rag/datasource/vdb/tencent/tencent_vector.py:239:27
+ --> core/rag/datasource/vdb/tencent/tencent_vector.py:252:27
ERROR Argument `Filter | None` is not assignable to parameter `filter` with type `Filter | str` in function `tcvectordb.rpc.client.stub.RPCVectorDBClient.search` [bad-argument-type]
- --> core/rag/datasource/vdb/tencent/tencent_vector.py:242:20
+ --> core/rag/datasource/vdb/tencent/tencent_vector.py:255:20
ERROR Argument `str | None` is not assignable to parameter `database_name` with type `str` in function `tcvectordb.rpc.client.stub.RPCVectorDBClient.hybrid_search` [bad-argument-type]
- --> core/rag/datasource/vdb/tencent/tencent_vector.py:259:27
+ --> core/rag/datasource/vdb/tencent/tencent_vector.py:272:27
ERROR Argument `list[list[float | int]] | list[list[list[float | int]]]` is not assignable to parameter `data` with type `list[list[float | int]] | None` in function `tcvectordb.model.document.KeywordSearch.__init__` [bad-argument-type]
- --> core/rag/datasource/vdb/tencent/tencent_vector.py:270:26
+ --> core/rag/datasource/vdb/tencent/tencent_vector.py:283:26
ERROR Argument `Filter | None` is not assignable to parameter `filter` with type `Filter | str` in function `tcvectordb.rpc.client.stub.RPCVectorDBClient.hybrid_search` [bad-argument-type]
- --> core/rag/datasource/vdb/tencent/tencent_vector.py:279:20
+ --> core/rag/datasource/vdb/tencent/tencent_vector.py:292:20
ERROR Argument `str | None` is not assignable to parameter `database_name` with type `str` in function `tcvectordb.rpc.client.stub.RPCVectorDBClient.drop_collection` [bad-argument-type]
- --> core/rag/datasource/vdb/tencent/tencent_vector.py:303:31
+ --> core/rag/datasource/vdb/tencent/tencent_vector.py:316:31
ERROR Unpacked keyword argument `str | Unknown` is not assignable to parameter `port` with type `int | None` in function `qdrant_client.qdrant_client.QdrantClient.__init__` [bad-argument-type]
--> core/rag/datasource/vdb/tidb_on_qdrant/tidb_on_qdrant_vector.py:87:51
ERROR Unpacked keyword argument `str | Unknown` is not assignable to parameter `grpc_port` with type `int` in function `qdrant_client.qdrant_client.QdrantClient.__init__` [bad-argument-type]
|
asukaminato0721
approved these changes
Apr 7, 2026
HanqingZ
pushed a commit
to HanqingZ/dify
that referenced
this pull request
Apr 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #32863 (
api/core/rag/datasource/vdb/)Summary
TencentParamsDictTypedDict intencent_vector.py, annotateTencentConfig.to_tencent_paramsMilvusParamsDictTypedDict inmilvus_vector.py, annotateMilvusConfig.to_milvus_paramsWhy this change
Both
to_tencent_paramsandto_milvus_paramsreturn fixed-key dicts with no conditional keys but had no return type annotation. The TypedDicts make the connection parameter shapes explicit and checkable.Changes
api/core/rag/datasource/vdb/tencent/tencent_vector.py: DefineTencentParamsDict(url,username,key,timeout), annotateto_tencent_paramsapi/core/rag/datasource/vdb/milvus/milvus_vector.py: DefineMilvusParamsDict(uri,token,user,password,db_name,analyzer_params), annotateto_milvus_params