LM Studio Embeddings icon

LM Studio Embeddings

Embedding model provider for LM Studio (supplyData only)

Overview

This node integrates with an LM Studio server to generate vector embeddings from text inputs using specified embedding models. It is designed to process batches of documents or single queries, converting them into numerical vectors that can be used for tasks such as semantic search, clustering, recommendation systems, or natural language understanding.

Typical use cases include:

  • Generating embeddings for a collection of documents to enable similarity searches.
  • Creating vector representations of user queries for matching against indexed data.
  • Preprocessing textual data for machine learning pipelines requiring fixed-length numeric input.

For example, you might input multiple sentences or paragraphs and receive their corresponding embeddings in batch, or embed a single query string to compare against existing embeddings.

Properties

Name Meaning
Connection hint Informational notice reminding users to ensure the LM Studio server is reachable and CORS is configured if needed.
Model The name of the embedding model served by LM Studio to use for generating embeddings (e.g., sentence-transformers/all-MiniLM-L6-v2). This is required.
LM Studio Base URL The base URL of the LM Studio server endpoint (no trailing slash). Defaults to http://localhost:8080.
API Key (optional) Optional API key for authenticating requests to LM Studio. Can also be provided via credentials.
Batch Size Number of documents to send per request batch when embedding multiple texts. Default is 16.
Strip New Lines Whether to remove newline characters (\n and \r\n) from input texts before embedding. Default is true.
Timeout (seconds) Request timeout duration in seconds. Set to -1 for no timeout. Default is 120 seconds.
Dimensions (optional) Expected length of the embedding vector, if supported by the LM Studio model. Default is 0 (unspecified).
Encoding Format Encoding format requested from LM Studio. Options are float or f16. Default is float.

Output

The node outputs JSON data containing arrays of floating-point numbers representing the embeddings for each input text. Specifically:

  • For batch inputs, the output is an array where each element corresponds to the embedding vector of one input document.
  • For single query inputs, the output is a single embedding vector.

Each embedding vector is a numeric array whose length may correspond to the model's dimensionality (optionally specified).

If binary data were involved, it would represent encoded embeddings, but this node only outputs JSON numeric arrays.

Dependencies

  • Requires access to an LM Studio server hosting embedding models accessible via HTTP POST requests.
  • Optionally requires an API key credential for authentication if the LM Studio server is secured.
  • Network connectivity and proper CORS configuration on the LM Studio server are necessary.
  • No other external dependencies beyond standard fetch API usage.

Troubleshooting

  • Timeouts: If requests take longer than the configured timeout, the node aborts the request and throws a timeout error. Increase the timeout or check server responsiveness.
  • Connection issues: Ensure the LM Studio Base URL is correct and the server is reachable. Verify network and CORS settings.
  • Authentication errors: If the server requires an API key, provide it either in the node property or via credentials. Missing or invalid keys will cause authorization failures.
  • Unexpected response shape: Errors indicating missing or malformed data or embedding arrays suggest server-side issues or incompatible model responses.
  • Batch size too large: Very large batch sizes may cause performance degradation or server errors. Adjust batch size accordingly.

Links and References

Discussion