Class OpenAIImageEmbeddingParser
- All Implemented Interfaces:
Closeable,Serializable,AutoCloseable,Initializable,SelfConfiguring,ContentEnricher,Engine,Parser
/v1/embeddings with image input) and
stores the resulting vector in metadata.
An annotating content enricher for image types (experimental; 4.2 gives annotators a list of
their own): named in "text-recognizers", it runs on
embedded images and on the pages the PDF parser's ocr.strategy renders. Each
rendered page image is sent to the embedding endpoint and the
vector is stored as a serialized Chunk with a
PaginatedLocator (when page number metadata is available).
The image is sent in the Jina CLIP format:
{"input": [{"image": "data:image/png;base64,..."}]}.
Configuration key: "openai-image-embedding-parser"
Thread safety: instances are safe for concurrent parse(org.apache.tika.io.TikaInputStream, org.xml.sax.ContentHandler, org.apache.tika.metadata.Metadata, org.apache.tika.parser.ParseContext) calls once
fully constructed. Setters must not be called concurrently with
parse(org.apache.tika.io.TikaInputStream, org.xml.sax.ContentHandler, org.apache.tika.metadata.Metadata, org.apache.tika.parser.ParseContext).
- Since:
- Apache Tika 4.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.OpenAIImageEmbeddingParser(JsonConfig jsonConfig) Deprecated.Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Deprecated.Releases what the engine holds (a client, a native handle); nothing by default.Deprecated.Deprecated.Deprecated.Deprecated.Deprecated.longDeprecated.longDeprecated.getModel()Deprecated.Deprecated.getSupportedTypes(ParseContext context) Deprecated.Returns the set of media types supported by this parser when used with the given parse context.longDeprecated.voidDeprecated.Called after all properties have been set to allow for validation and initialization that depends on multiple properties.booleanDeprecated.booleanDeprecated.voidparse(TikaInputStream tis, ContentHandler handler, Metadata metadata, ParseContext parseContext) Deprecated.Parses a document stream into a sequence of XHTML SAX events.voidDeprecated.voidsetApiKeyHeaderName(String apiKeyHeaderName) Deprecated.Set the HTTP header name for API key authentication.voidsetApiKeyPrefix(String apiKeyPrefix) Deprecated.Set the prefix prepended to the API key in the auth header.voidsetBaseUrl(String baseUrl) Deprecated.voidsetEmbeddingsPath(String embeddingsPath) Deprecated.Set the URL path for embeddings requests.voidsetLiftToParent(boolean liftToParent) Deprecated.voidsetMaxFileSizeToEmbed(long maxFileSizeToEmbed) Deprecated.voidsetMinFileSizeToEmbed(long minFileSizeToEmbed) Deprecated.voidDeprecated.voidsetOutputField(String outputField) Deprecated.voidsetSkipEmbedding(boolean skipEmbedding) Deprecated.voidsetTimeoutMillis(long timeoutMillis) Deprecated.
-
Constructor Details
-
OpenAIImageEmbeddingParser
public OpenAIImageEmbeddingParser()Deprecated. -
OpenAIImageEmbeddingParser
Deprecated. -
OpenAIImageEmbeddingParser
Deprecated.
-
-
Method Details
-
getSupportedTypes
Deprecated.Description copied from interface:ParserReturns the set of media types supported by this parser when used with the given parse context.- Specified by:
getSupportedTypesin interfaceParser- Parameters:
context- parse context- Returns:
- immutable set of media types
-
parse
public void parse(TikaInputStream tis, ContentHandler handler, Metadata metadata, ParseContext parseContext) throws IOException, SAXException, TikaException Deprecated.Description copied from interface:ParserParses a document stream into a sequence of XHTML SAX events. Fills in related document metadata in the given metadata object.The given document stream is consumed but not closed by this method. The responsibility to close the stream remains on the caller.
Information about the parsing context can be passed in the context parameter. See the parser implementations for the kinds of context information they expect.
- Specified by:
parsein interfaceParser- Parameters:
handler- handler for the XHTML SAX events (output)metadata- document metadata (input and output)parseContext- parse context- Throws:
IOException- if the document stream could not be readSAXException- if the SAX events could not be processedTikaException- if the document could not be parsed
-
initialize
Deprecated.Description copied from interface:InitializableCalled after all properties have been set to allow for validation and initialization that depends on multiple properties.- Specified by:
initializein interfaceInitializable- Throws:
TikaConfigException- if there is a problem with the configuration
-
close
Deprecated.Description copied from interface:EngineReleases what the engine holds (a client, a native handle); nothing by default.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceEngine- Throws:
IOException
-
getBaseUrl
Deprecated. -
setBaseUrl
Deprecated.- Throws:
TikaConfigException
-
getModel
Deprecated. -
setModel
Deprecated. -
getApiKey
Deprecated. -
setApiKey
Deprecated.- Throws:
TikaConfigException
-
getTimeoutMillis
public long getTimeoutMillis()Deprecated. -
setTimeoutMillis
public void setTimeoutMillis(long timeoutMillis) Deprecated. -
isSkipEmbedding
public boolean isSkipEmbedding()Deprecated. -
setSkipEmbedding
public void setSkipEmbedding(boolean skipEmbedding) Deprecated. -
getMinFileSizeToEmbed
public long getMinFileSizeToEmbed()Deprecated. -
setMinFileSizeToEmbed
public void setMinFileSizeToEmbed(long minFileSizeToEmbed) Deprecated. -
getMaxFileSizeToEmbed
public long getMaxFileSizeToEmbed()Deprecated. -
setMaxFileSizeToEmbed
public void setMaxFileSizeToEmbed(long maxFileSizeToEmbed) Deprecated. -
getOutputField
Deprecated. -
setOutputField
Deprecated. -
isLiftToParent
public boolean isLiftToParent()Deprecated. -
setLiftToParent
public void setLiftToParent(boolean liftToParent) Deprecated. -
getEmbeddingsPath
Deprecated. -
setEmbeddingsPath
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
Deprecated. -
setApiKeyHeaderName
Deprecated.Set the HTTP header name for API key authentication. Default isAuthorization. For Azure OpenAI, set toapi-key. -
getApiKeyPrefix
Deprecated. -
setApiKeyPrefix
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).
-
openai-embedding-engineunder"engines"and bind it with anIMAGES"inference"binding and theembedtask: a document tree's images go in requests of the engine's batch size instead of one per image, and the vectors land whereChunkTargetputs them.