Class OpenAIEmbeddingFilter

All Implemented Interfaces:
Closeable, Serializable, AutoCloseable, SelfConfiguring
Direct Known Subclasses:
JinaEmbeddingFilter

@Deprecated public class OpenAIEmbeddingFilter extends AbstractEmbeddingFilter
Deprecated.
since 4.1.0, removed in 4.2.0; see AbstractEmbeddingFilter.
Metadata filter that calls an OpenAI-compatible /v1/embeddings endpoint to produce vectors for each text chunk.

Works with OpenAI, vLLM, Ollama, sentence-transformers servers, and any endpoint that implements the OpenAI Embeddings API.

Configuration key: "openai-embedding-filter"

Since:
Apache Tika 4.0
See Also:
  • Constructor Details

    • OpenAIEmbeddingFilter

      public OpenAIEmbeddingFilter()
      Deprecated.
    • OpenAIEmbeddingFilter

      public OpenAIEmbeddingFilter(InferenceConfig config)
      Deprecated.
  • Method Details

    • getComponentName

      protected String getComponentName()
      Deprecated.
      Description copied from class: AbstractEmbeddingFilter
      The @TikaComponent name this filter's per-request JSON config is keyed by in parse-context (e.g. {"openai-embedding-filter": {...}}).
      Specified by:
      getComponentName in class AbstractEmbeddingFilter
    • close

      public void close() throws IOException
      Deprecated.
      Description copied from class: MetadataFilter
      Releases any resources held by this filter (e.g. HTTP connection pools, thread pools). The default implementation is a no-op; filters that hold long-lived resources should override this.

      Callers that control the filter lifecycle (e.g. PipesServer, try-with-resources blocks) should call this when the filter is no longer needed.

      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class MetadataFilter
      Throws:
      IOException
    • embed

      protected void embed(List<Chunk> chunks, InferenceConfig config, ParseContext parseContext) throws IOException, TikaException
      Deprecated.
      Description copied from class: AbstractEmbeddingFilter
      Call the embeddings endpoint to fill in vectors on each chunk. Implementations should set Chunk.setVector(float[]) on each chunk in the list.
      Specified by:
      embed in class AbstractEmbeddingFilter
      Parameters:
      chunks - the text chunks to embed
      config - the resolved config for this call
      parseContext - the task's ParseContext -- pass to TikaHttpClient calls to bound the request by the task's remaining budget and checkpoint while waiting
      Throws:
      IOException - on HTTP errors
      TikaException - on API-level errors
    • getEmbeddingsPath

      public String getEmbeddingsPath()
      Deprecated.
    • setEmbeddingsPath

      public void setEmbeddingsPath(String embeddingsPath)
      Deprecated.
      Set the URL path for embeddings requests. Default is /v1/embeddings. For Azure OpenAI, use /openai/deployments/{deployment}/embeddings?api-version=2024-02-01.
    • getApiKeyHeaderName

      public String getApiKeyHeaderName()
      Deprecated.
    • setApiKeyHeaderName

      public void setApiKeyHeaderName(String apiKeyHeaderName)
      Deprecated.
      Set the HTTP header name for API key authentication. Default is Authorization. For Azure OpenAI, set to api-key.
    • getApiKeyPrefix

      public String getApiKeyPrefix()
      Deprecated.
    • setApiKeyPrefix

      public void setApiKeyPrefix(String apiKeyPrefix)
      Deprecated.
      Set the prefix prepended to the API key in the auth header. Default is "Bearer " (with trailing space). For Azure OpenAI, set to "" (empty string).