Repository: activeloopai/Hub
File: deeplake/core/vectorstore/vector_search/utils.py (Python)

Code before:
            raise ValueError(
                "Cannot specify embedding tensors in both `tensors` and `embedding_tensor`."
            )

    for k, v in filtered.items():
        funcs.append(v[0])
        data.append(v[1])
        tensors_.append(k)
        del tensors[k]

    if embedding_function:
        return embedding_function, embedding_data, embedding_tensor, tensors
    return funcs, data, tensors_, tensors


def parse_add_arguments(
    dataset,
    embedding_function=None,
    initial_embedding_function=None,
    embedding_data=None,
    embedding_tensor=None,
    **tensors,
):
    """Parse the input argument to the Vector Store add function to infer whether they are a valid combination."""
    if initial_embedding_function and not isinstance(initial_embedding_function, list):
        initial_embedding_function = [initial_embedding_function]
    if embedding_data and not isinstance(embedding_data[0], list):
        embedding_data = [embedding_data]
    if embedding_tensor and not isinstance(embedding_tensor, list):
        embedding_tensor = [embedding_tensor]

    if embedding_function:
        if not embedding_data:
            raise ValueError(
                f"embedding_data is not specified. When using embedding_function it is also necessary to specify the data that you want to embed"
            )

        if not isinstance(embedding_function, list):
            embedding_function = [embedding_function] * len(embedding_data)

        embedding_tensor = get_embedding_tensors(embedding_tensor, tensors, dataset)

        assert len(embedding_function) == len(
            embedding_data
        ), "embedding_function and embedding_data must be of the same length"
        assert len(embedding_function) == len(
            embedding_tensor
        ), "embedding_function and embedding_tensor must be of the same length"

        check_tensor_name_consistency(tensors, dataset.tensors, embedding_tensor)
        return (embedding_function, embedding_data, embedding_tensor, tensors)

Review comment (suggestion):
```
vectorstore.add(
    embedding_data = [texts1, texts2]
    embedding_tensors = ["embedding_1", "embedding_2"]
)
```

Initial embedding function should get applied

Code after:
                "Cannot specify embedding data in both `tensors` and `embedding_data`."
            )

        if embedding_tensor:
            raise ValueError(
                "Cannot specify embedding tensors in both `tensors` and `embedding_tensor`."
            )
    else:
        return embedding_function, embedding_data, embedding_tensor, tensors

    # separate embedding functions, data and tensors
    for k, v in filtered.items():
        funcs.append(v[0])
        data.append(v[1])
        tensors_.append(k)
        # remove embedding tensors (tuple format) from tensors
        del tensors[k]

    return funcs, data, tensors_, tensors


def parse_add_arguments(
    dataset,
    embedding_function=None,
    initial_embedding_function=None,
    embedding_data=None,
    embedding_tensor=None,
    **tensors,
):
    """Parse the input argument to the Vector Store add function to infer whether they are a valid combination."""
    if embedding_data and not isinstance(next(iter(embedding_data)), list):
        embedding_data = [embedding_data]
    if embedding_tensor and not isinstance(embedding_tensor, list):
        embedding_tensor = [embedding_tensor]

    if embedding_function:
        if not embedding_data:
            raise ValueError(
                f"embedding_data is not specified. When using embedding_function it is also necessary to specify the data that you want to embed"
            )

        # if single embedding function is specified, use it for all embedding data
        if not isinstance(embedding_function, list):
            embedding_function = [embedding_function] * len(embedding_data)

        embedding_tensor = get_embedding_tensors(embedding_tensor, tensors, dataset)

        assert len(embedding_function) == len(
            embedding_data
        ), "embedding_function and embedding_data must be of the same length"
        assert len(embedding_function) == len(