SolarEmbeddings#

class langchain_community.embeddings.solar.SolarEmbeddings[source]#

Bases: BaseModel, Embeddings

Deprecated since version 0.0.34: Use :class:`~langchain_upstage.ChatUpstage` instead. It will be removed in None==1.0.

Solar’s embedding service.

To use, you should have the environment variable``SOLAR_API_KEY`` set with your API token, or pass it as a named parameter to the constructor.

Example

from langchain_community.embeddings import SolarEmbeddings
embeddings = SolarEmbeddings()

query_text = "This is a test query."
query_result = embeddings.embed_query(query_text)

document_text = "This is a test document."
document_result = embeddings.embed_documents([document_text])

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

param endpoint_url: str = 'https://api.upstage.ai/v1/solar/embeddings'#

Endpoint URL to use.

param model: str = 'solar-1-mini-embedding-query'#

Embeddings model name to use.

param solar_api_key: SecretStr | None = None#

API Key for Solar API.

async aembed_documents(texts: list[str]) β†’ list[list[float]]#

Asynchronous Embed search docs.

Parameters:

texts (list[str]) – List of text to embed.

Returns:

List of embeddings.

Return type:

list[list[float]]

async aembed_query(text: str) β†’ list[float]#

Asynchronous Embed query text.

Parameters:

text (str) – Text to embed.

Returns:

Embedding.

Return type:

list[float]

embed(text: str) β†’ List[List[float]][source]#
Parameters:

text (str)

Return type:

List[List[float]]

embed_documents(texts: List[str]) β†’ List[List[float]][source]#

Embed documents using a Solar embedding endpoint.

Parameters:

texts (List[str]) – The list of texts to embed.

Returns:

List of embeddings, one for each text.

Return type:

List[List[float]]

embed_query(text: str) β†’ List[float][source]#

Embed a query using a Solar embedding endpoint.

Parameters:

text (str) – The text to embed.

Returns:

Embeddings for the text.

Return type:

List[float]

classmethod validate_environment(values: Dict) β†’ Dict[source]#

Validate api key exists in environment.

Parameters:

values (Dict)

Return type:

Dict

Examples using SolarEmbeddings