text: Skip to main contentğŸ¦œï¸�ğŸ”— LangChainDocsUse casesIntegrationsAPILangSmithJS/TS DocsCTRLKIntegrationsCallbacksChat modelsDocument loadersDocument transformersDoctran Extract PropertiesDoctran Interrogate DocumentsDoctran Translate Documentshtml2textOpenAI Functions Metadata TaggerLLMsMemoryRetrieversText embedding modelsAgent toolkitsToolsVector storesGrouped by providerIntegrationsDocument transformersOpenAI Functions Metadata TaggerOn this pageOpenAI Functions Metadata TaggerIt can often be useful to tag ingested documents with structured metadata, such as the title, tone, or length of a document, to allow for more targeted similarity search later. However, for large numbers of documents, performing this labelling process manually can be tedious.The OpenAIMetadataTagger document transformer automates this process by extracting metadata from each provided document according to a provided schema. It uses a configurable OpenAI Functions-powered chain under the hood, so if you pass a custom LLM instance, it must be an OpenAI model with functions support. Note: This document transformer works best with complete documents, so it's best to run it first with whole documents before doing any other splitting or processing!For example, let's say you wanted to index a set of movie reviews. You could initialize the document transformer with a valid JSON Schema object as follows:from langchain.schema import Documentfrom langchain.chat_models import ChatOpenAIfrom langchain.document_transformers.openai_functions import create_metadata_taggerschema = {    "properties": {        "movie_title": {"type": "string"},        "critic": {"type": "string"},        "tone": {"type": "string", "enum": ["positive", "negative"]},        "rating": {