Skip to content

refactor(api): type VDB config params dicts with TypedDicts#34677

Merged
asukaminato0721 merged 1 commit intolanggenius:mainfrom
statxc:refactor/typed-dict-vdb-config-params
Apr 7, 2026
Merged

refactor(api): type VDB config params dicts with TypedDicts#34677
asukaminato0721 merged 1 commit intolanggenius:mainfrom
statxc:refactor/typed-dict-vdb-config-params

Conversation

@statxc
Copy link
Copy Markdown
Contributor

@statxc statxc commented Apr 7, 2026

Part of #32863 (api/core/rag/datasource/vdb/)

Summary

  • Add TencentParamsDict TypedDict in tencent_vector.py, annotate TencentConfig.to_tencent_params
  • Add MilvusParamsDict TypedDict in milvus_vector.py, annotate MilvusConfig.to_milvus_params

Why this change

Both to_tencent_params and to_milvus_params return 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: Define TencentParamsDict (url, username, key, timeout), annotate to_tencent_params
  • api/core/rag/datasource/vdb/milvus/milvus_vector.py: Define MilvusParamsDict (uri, token, user, password, db_name, analyzer_params), annotate to_milvus_params

@statxc statxc requested a review from JohnJyong as a code owner April 7, 2026 13:13
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. refactor labels Apr 7, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 7, 2026

Pyrefly Diff

base → 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]

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Apr 7, 2026
@asukaminato0721 asukaminato0721 added this pull request to the merge queue Apr 7, 2026
Merged via the queue into langgenius:main with commit e645cbd Apr 7, 2026
26 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer refactor size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants