@@ -37,7 +37,7 @@ class WeaviateConfig:
3737 # vectorIndexConfig parameters
3838 ef : Optional [int ] = None
3939 ef_construction : Optional [int ] = None
40- timeout_config : Optional [Tuple [int , int ]] = None
40+ timeout_config : Optional [Tuple [int , int ]] = field ( default = ( 10 , 60 ))
4141 max_connections : Optional [int ] = None
4242 dynamic_ef_min : Optional [int ] = None
4343 dynamic_ef_max : Optional [int ] = None
@@ -48,6 +48,13 @@ class WeaviateConfig:
4848 skip : Optional [bool ] = None
4949 columns : Optional [Union [List [Tuple [str , str ]], Dict [str , str ]]] = None
5050 distance : Optional [str ] = None
51+ # weaviate python client parameters
52+ batch_size : Optional [int ] = field (default = 50 )
53+ dynamic_batching : Optional [bool ] = field (default = False )
54+
55+ def __post_init__ (self ):
56+ if isinstance (self .timeout_config , list ):
57+ self .timeout_config = tuple (self .timeout_config )
5158
5259
5360_banned_classname_chars = [
@@ -98,7 +105,6 @@ def _init_storage(
98105 :raises ValueError: only one of name or docs can be used for initialization,
99106 raise an error if both are provided
100107 """
101-
102108 config = copy .deepcopy (config )
103109 if not config :
104110 config = WeaviateConfig ()
@@ -367,17 +373,14 @@ def _doc2weaviate_create_payload(self, value: 'Document'):
367373 vector = self ._map_embedding (value .embedding ),
368374 )
369375
370- def _map_id (self , doc_id : str ):
371- """the function maps doc id to weaviate id
372-
373- :param doc_id: id of the document
374- :return: weaviate object id
375- """
376- # appending class name to doc id to handle the case:
377- # daw1 = DocumentArrayWeaviate([Document(id=str(i), text='hi') for i in range(3)])
378- # daw2 = DocumentArrayWeaviate([Document(id=str(i), text='bye') for i in range(3)])
379- # daw2[0, 'text'] == 'hi' # this will be False if we don't append class name
380- return str (uuid .uuid5 (uuid .NAMESPACE_URL , doc_id + self ._class_name ))
376+ @staticmethod
377+ def _map_id (doc_id : str ):
378+ # if doc_id is a random ID in hex format, just translate back to UUID str
379+ # otherwise, create UUID5 from doc_id
380+ try :
381+ return str (uuid .UUID (hex = doc_id ))
382+ except ValueError :
383+ return str (uuid .uuid5 (uuid .NAMESPACE_URL , doc_id ))
381384
382385 def _map_embedding (self , embedding : 'ArrayType' ):
383386 if embedding is not None :
0 commit comments