code: def create_qdrant_from_dir(
      dir_path: str,
      max_tokens: int = 4000,
      client: QdrantClient = None,
      collection_name: str = "all-my-documents",
      chunk_mode: str = "multi_lines",
      must_break_at_empty_line: bool = True,
      embedding_model: str = "BAAI/bge-small-en-v1.5",
      custom_text_split_function: Callable = None,
      custom_text_types: List[str] = TEXT_FORMATS,
      recursive: bool = True,
      extra_docs: bool = False,
      parallel: int = 0,
      on_disk: bool = False,
      quantization_config: Optional[models.QuantizationConfig] = None,
      hnsw_config: Optional[models.HnswConfigDiff] = None,
      payload_indexing: bool = False,
      qdrant_client_options: Optional[Dict] = {},
  ):
      """Create a Qdrant collection from all the files in a given directory, the directory can also be a single file or a
        url to a single file.
  
      Args:
          dir_path (str): the path to the directory, file or url.
          max_tokens (Optional, int): the maximum number of tokens per chunk. Default is 4000.
          client (Optional, QdrantClient): the QdrantClient instance. Default is None.
          collection_name (Optional, str): the name of the collection. Default is "all-my-documents".
          chunk_mode (Optional, str): the chunk mode. Default is "multi_lines".
          must_break_at_empty_line (Optional, bool): Whether to break at empty line. Default is True.
          embedding_model (Optional, str): the embedding model to use. Default is "BAAI/bge-small-en-v1.5".
              The list of all the available models can be at https://qdrant.github.io/fastembed/examples/Supported_Models/.
          custom_text_split_function (Optional, Callable): a custom function to split a string into a list of strings.
              Default is None, will use the default function in `autogen.retrieve_utils.split_text_to_chunks`.
          custom_text_types (Optional, List[str]): a list of file types to be processed. Default is TEXT_FORMATS.
          recursive (Optional, bool): whether to search documents recursively in the dir_path. Default is True.
          extra_docs (Optional, bool): whether to add more documents in the collection. Default is False
          parallel (Optional, int): How many parallel workers to use for embedding. Defaults to the number of CPU cores
          on_disk (Optional, bool): Whether to store the collection on disk. Default is False.
          quantization_config: Quantization configuration. If None, quantization will be disabled.
              Ref: https://qdrant.github.io/qdrant/redoc/index.html#tag/collections/operation/create_collection
          hnsw_config: HNSW configuration. If None, default configuration will be used.
              Ref: https://qdrant.github.io/qdrant/redoc/index.html#tag/collections/operation/create_collection
          payload_indexing: Whether to create a payload index for the document field. Default is False.
          qdrant_client_options: (Optional, dict): the options for instantiating the qdrant client.
              Ref: https://github.com/qdrant/qdrant-client/blob/master/qdrant_client/qdrant_client.py#L36-L58.
      """
      if client is None:
          client = QdrantClient(**qdrant_client_options)
          client.set_model(embedding_model)
  
      if custom_text_split_function is not None:
          chunks = split_files_to_chunks(
              get_files_from_dir(
                  dir_path, custom_text_types, recursive
              ),
              custom_text_split_function=custom_text_split_function,
          )
      else:
          chunks = split_files_to_chunks(
              get_files_from_dir(
                  dir_path, custom_text_types, recursive
              ),
              max_tokens,
              chunk_mode,
              must_break_at_empty_line,
          )
      logger.info(f"Found {len(chunks)} chunks.")
  
      collection = None
      # Check if collection by same name exists, if not, create it with custom options
      try:
          collection = client.get_collection(
              collection_name=collection_name
          )
      except Exception:
          client.create_collection(
              collection_name=collection_name,
              vectors_config=client.get_fastembed_vector_params(
                  on_disk=on_disk,
                  quantization_config=quantization_config,
                  hnsw_config=hnsw_config,
              ),
          )
          collection = client.get_collection(
              collection_name=collection_name
          )
  
      length = 0
      if extra_docs:
          length = len(collection.get()["ids"])
  
      # Upsert in batch of 100 or less if the total number of chunks is less than 100
      for i in range(0, len(chunks), min(100, len(chunks))):
          end_idx = i + min(100, len(chunks) - i)
          client.add(
              collection_name,
              documents=chunks[i:end_idx],
              ids=[(j + length) for j in range(i, end_idx)],
              parallel=parallel,
          )
  
      # Create a payload index for the document field
      # Enables highly efficient payload filtering. Reference: https://qdrant.tech/documentation/concepts/indexing/#indexing
      # Creating an index requires additional computational resources and memory.
      # If filtering performance is critical, we can consider creating an index.
      if payload_indexing:
          client.create_payload_index(
              collection_name=collection_name,
              field_name="document",
              field_schema=models.TextIndexParams(
                  type="text",
                  tokenizer=models.TokenizerType.WORD,
                  min_token_len=2,
                  max_token_len=15,
              ),
          )
  
file_path: autogen/autogen/agentchat/contrib/qdrant_retrieve_user_proxy_agent.py
imports: from typing import Callable, Dict, List, Optional
  from autogen.agentchat.contrib.retrieve_user_proxy_agent import RetrieveUserProxyAgent
  from autogen.retrieve_utils import get_files_from_dir, split_files_to_chunks, TEXT_FORMATS
  import logging
label_desc: Use image node_id 1 for calling a global function with example usage: create_qdrant_from_dir(dir_path, max_tokens, client, collection_name, chunk_mode, must_break_at_empty_line, embedding_model, custom_text_split_function, custom_text_types, recursive, extra_docs, parallel, on_disk, quantization_config, hnsw_config, payload_indexing, qdrant_client_options) without return types