@@ -146,7 +146,12 @@ Here's how you can define a collection schema that includes an Array of Structs:
146146``` python
147147from pymilvus import MilvusClient, DataType
148148
149- schema = MilvusClient.create_schema()
149+ client = MilvusClient(
150+ uri = " http://localhost:19530" ,
151+ token = " root:Milvus"
152+ )
153+
154+ schema = client.create_schema()
150155
151156# add the primary field to the collection
152157schema.add_field(field_name = " id" , datatype = DataType.INT64 , is_primary = True , auto_id = True )
@@ -161,7 +166,7 @@ schema.add_field(field_name="title_vector", datatype=DataType.FLOAT_VECTOR, dim=
161166
162167# highlight-start
163168# Create a struct schema
164- struct_schema = MilvusClient .create_struct_field_schema()
169+ struct_schema = client .create_struct_field_schema()
165170
166171# add a scalar field to the struct
167172struct_schema.add_field(" text" , DataType.VARCHAR , max_length = 65535 )
@@ -382,7 +387,7 @@ To index an embedding list, you need to set its index type to `AUTOINDEX` or `H
382387
383388``` python
384389# Create index parameters
385- index_params = MilvusClient .prepare_index_params()
390+ index_params = client .prepare_index_params()
386391
387392# Create an index for the vector field in the collection
388393index_params.add_index(
@@ -474,11 +479,6 @@ Once the schema and index are ready, you can create a collection that includes a
474479</div >
475480
476481``` python
477- client = MilvusClient(
478- uri = " http://localhost:19530" ,
479- token = " root:Milvus"
480- )
481-
482482client.create_collection(
483483 collection_name = " my_collection" ,
484484 schema = schema,
0 commit comments