LLMImageBlobParser#

class langchain_community.document_loaders.parsers.images.LLMImageBlobParser(*, model: BaseChatModel, prompt: str = 'You are an assistant tasked with summarizing images for retrieval. 1. These summaries will be embedded and used to retrieve the raw image. Give a concise summary of the image that is well optimized for retrieval\n2. extract all the text from the image. Do not exclude any content from the page.\nFormat answer in markdown without explanatory text and without markdown delimiter ``` at the beginning. ')[source]#

Parser for analyzing images using a language model (LLM).

model#

The language model to use for analysis.

Type:

BaseChatModel

prompt#

The prompt to provide to the language model.

Type:

str

Initializes the LLMImageBlobParser.

Parameters:
  • model (BaseChatModel) – The language model to use for analysis.

  • prompt (str) – The prompt to provide to the language model.

Methods

__init__(*,Β model[,Β prompt])

Initializes the LLMImageBlobParser.

lazy_parse(blob)

Lazily parse a blob and yields Documents containing the parsed content.

parse(blob)

Eagerly parse the blob into a document or documents.

__init__(*, model: BaseChatModel, prompt: str = 'You are an assistant tasked with summarizing images for retrieval. 1. These summaries will be embedded and used to retrieve the raw image. Give a concise summary of the image that is well optimized for retrieval\n2. extract all the text from the image. Do not exclude any content from the page.\nFormat answer in markdown without explanatory text and without markdown delimiter ``` at the beginning. ')[source]#

Initializes the LLMImageBlobParser.

Parameters:
  • model (BaseChatModel) – The language model to use for analysis.

  • prompt (str) – The prompt to provide to the language model.

lazy_parse(blob: Blob) β†’ Iterator[Document]#

Lazily parse a blob and yields Documents containing the parsed content.

Parameters:

blob (Blob) – The blob to be parsed.

Yields:

Document – A document containing the parsed content and metadata.

Return type:

Iterator[Document]

parse(blob: Blob) β†’ list[Document]#

Eagerly parse the blob into a document or documents.

This is a convenience method for interactive development environment.

Production applications should favor the lazy_parse method instead.

Subclasses should generally not over-ride this parse method.

Parameters:

blob (Blob) – Blob instance

Returns:

List of documents

Return type:

list[Document]