chore:fmt

This commit is contained in:
aries_ckt 2025-04-12 14:34:19 +08:00
parent 5d67f166d9
commit 2fad7485fc
2 changed files with 7 additions and 15 deletions

View File

@ -5,7 +5,7 @@ from __future__ import annotations
import logging import logging
import os import os
from dataclasses import dataclass, field from dataclasses import dataclass, field
from typing import List, Optional, Any from typing import Any, List, Optional
from dbgpt.core import Chunk, Embeddings from dbgpt.core import Chunk, Embeddings
from dbgpt.core.awel.flow import Parameter, ResourceCategory, register_resource from dbgpt.core.awel.flow import Parameter, ResourceCategory, register_resource

View File

@ -288,11 +288,11 @@ class MilvusStore(VectorStoreBase):
def create_collection(self, collection_name: str, **kwargs) -> Any: def create_collection(self, collection_name: str, **kwargs) -> Any:
"""Create a Milvus collection. """Create a Milvus collection.
Create a Milvus collection, indexes it with HNSW, load document Create a Milvus collection, indexes it with HNSW, load document
Args: Args:
collection_name (str): your collection name. collection_name (str): your collection name.
Returns: Returns:
List[str]: document ids. List[str]: document ids.
""" """
try: try:
from pymilvus import ( from pymilvus import (
@ -365,12 +365,7 @@ class MilvusStore(VectorStoreBase):
""" """
try: try:
from pymilvus import ( from pymilvus import (
Collection,
CollectionSchema,
DataType, DataType,
FieldSchema,
connections,
utility,
) )
from pymilvus.orm.types import infer_dtype_bydata # noqa: F401 from pymilvus.orm.types import infer_dtype_bydata # noqa: F401
except ImportError: except ImportError:
@ -387,10 +382,7 @@ class MilvusStore(VectorStoreBase):
self.fields.remove(x.name) self.fields.remove(x.name)
if x.is_primary: if x.is_primary:
self.primary_field = x.name self.primary_field = x.name
if ( if x.dtype == DataType.FLOAT_VECTOR or x.dtype == DataType.BINARY_VECTOR:
x.dtype == DataType.FLOAT_VECTOR
or x.dtype == DataType.BINARY_VECTOR
):
self.vector_field = x.name self.vector_field = x.name
return self._add_documents(texts, metadatas) return self._add_documents(texts, metadatas)