diff --git a/libs/cli/langchain_cli/integration_template/integration_template/embeddings.py b/libs/cli/langchain_cli/integration_template/integration_template/embeddings.py index 4827798ef7..174c567da8 100644 --- a/libs/cli/langchain_cli/integration_template/integration_template/embeddings.py +++ b/libs/cli/langchain_cli/integration_template/integration_template/embeddings.py @@ -4,14 +4,70 @@ from langchain_core.embeddings import Embeddings class __ModuleName__Embeddings(Embeddings): - """__ModuleName__Embeddings embedding model. + """__ModuleName__ embedding model integration. - Example: + # TODO: Replace with relevant packages, env vars. + Setup: + Install ``__package_name__`` and set environment variable ``__MODULE_NAME___API_KEY``. + + .. code-block:: 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: .. code-block:: python from __module_name__ import __ModuleName__Embeddings - model = __ModuleName__Embeddings() + embed = __ModuleName__Embeddings( + model="...", + # api_key="...", + # other params... + ) + + Embed single text: + .. code-block:: python + + input_text = "The meaning of life is 42" + embed.embed_query(input_text) + + .. code-block:: python + + # TODO: Example output. + + # TODO: Delete if token-level streaming isn't supported. + Embed multiple text: + .. code-block:: python + + input_texts = ["Document 1...", "Document 2..."] + embed.embed_documents(input_texts) + + .. code-block:: python + + # TODO: Example output. + + # TODO: Delete if native async isn't supported. + Async: + .. code-block:: python + + await embed.aembed_query(input_text) + + # multiple: + # await embed.aembed_documents(input_texts) + + .. code-block:: python + + # TODO: Example output. + """ def embed_documents(self, texts: List[str]) -> List[List[float]]: