from typing import List

from langchain_core.embeddings import Embeddings


class __ModuleName__Embeddings(Embeddings):
    """__ModuleName__ embedding model integration.

    # TODO: Replace with relevant packages, env vars.
    Setup:
        Install `__package_name__` and set environment variable
        `__MODULE_NAME___API_KEY`.

        ```bash
        pip install -U __package_name__
        export __MODULE_NAME___API_KEY="your-api-key"
        ```

    # TODO: Populate with relevant params.
    Key init args — completion params:
        model: str
            Name of __ModuleName__ model to use.

    See full list of supported init args and their descriptions in the params section.

    # TODO: Replace with relevant init params.
    Instantiate:
        ```python
        from __module_name__ import __ModuleName__Embeddings

        embed = __ModuleName__Embeddings(
            model="...",
            # api_key="...",
            # other params...
        )
        ```

    Embed single text:
        ```python
        input_text = "The meaning of life is 42"
        embed.embed_query(input_text)
        ```

        ```python
        # TODO: Example output.
        ```

    # TODO: Delete if token-level streaming isn't supported.
    Embed multiple text:
        ```python
        input_texts = ["Document 1...", "Document 2..."]
        embed.embed_documents(input_texts)
        ```

        ```python
        # TODO: Example output.
        ```

    # TODO: Delete if native async isn't supported.
    Async:
        ```python
        await embed.aembed_query(input_text)

        # multiple:
        # await embed.aembed_documents(input_texts)
        ```

        ```python
        # TODO: Example output.

        ```
    """

    def __init__(self, model: str):
        self.model = model

    def embed_documents(self, texts: List[str]) -> List[List[float]]:
        """Embed search docs."""
        return [[0.5, 0.6, 0.7] for _ in texts]

    def embed_query(self, text: str) -> List[float]:
        """Embed query text."""
        return self.embed_documents([text])[0]

    # optional: add custom async implementations here
    # you can also delete these, and the base class will
    # use the default implementation, which calls the sync
    # version in an async executor:

    # async def aembed_documents(self, texts: List[str]) -> List[List[float]]:
    #     """Asynchronous Embed search docs."""
    #     ...

    # async def aembed_query(self, text: str) -> List[float]:
    #     """Asynchronous Embed query text."""
    #     ...
