# SparkLLMTextEmbeddings

> **Class** in `langchain_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-community/embeddings/sparkllm/SparkLLMTextEmbeddings)

SparkLLM embedding model integration.

## Signature

```python
SparkLLMTextEmbeddings()
```

## Description

**Setup:**

To use, you should have the environment variable "SPARK_APP_ID","SPARK_API_KEY"
and "SPARK_API_SECRET" set your APP_ID, API_KEY and API_SECRET or pass it
as a name parameter to the constructor.

.. code-block:: bash

    export SPARK_APP_ID="your-api-id"
    export SPARK_API_KEY="your-api-key"
    export SPARK_API_SECRET="your-api-secret"

Key init args — completion params:
    api_key: Optional[str]
        Automatically inferred from env var `SPARK_API_KEY` if not provided.
    app_id: Optional[str]
        Automatically inferred from env var `SPARK_APP_ID` if not provided.
    api_secret: Optional[str]
        Automatically inferred from env var `SPARK_API_SECRET` if not provided.
    base_url: Optional[str]
        Base URL path for API requests.

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

Instantiate:

    .. code-block:: python

        from langchain_community.embeddings import SparkLLMTextEmbeddings

        embed = SparkLLMTextEmbeddings(
            api_key="...",
            app_id="...",
            api_secret="...",
            # other
        )

**Embed single text:**

.. code-block:: python

    input_text = "The meaning of life is 42"
    embed.embed_query(input_text)

.. code-block:: python

    [-0.4912109375, 0.60595703125, 0.658203125, 0.3037109375, 0.6591796875, 0.60302734375, ...]

**Embed multiple text:**

.. code-block:: python

    input_texts = ["This is a test query1.", "This is a test query2."]
    embed.embed_documents(input_texts)

.. code-block:: python

    [
        [-0.1962890625, 0.94677734375, 0.7998046875, -0.1971435546875, 0.445556640625, 0.54638671875, ...],
        [  -0.44970703125, 0.06585693359375, 0.7421875, -0.474609375, 0.62353515625, 1.0478515625, ...],
    ]

## Extends

- `BaseModel`
- `Embeddings`

## Properties

- `spark_app_id`
- `spark_api_key`
- `spark_api_secret`
- `base_url`
- `domain`
- `model_config`

## Methods

- [`embed_documents()`](https://reference.langchain.com/python/langchain-community/embeddings/sparkllm/SparkLLMTextEmbeddings/embed_documents)
- [`embed_query()`](https://reference.langchain.com/python/langchain-community/embeddings/sparkllm/SparkLLMTextEmbeddings/embed_query)

---

[View source on GitHub](https://github.com/langchain-ai/langchain-community/blob/a6a6079511ac8a5c1293337f88096b8641562e77/libs/community/langchain_community/embeddings/sparkllm.py#L44)