*[d.page_content + "\n\n" + json.dumps(d.metadata) for d in enhanced_documents],    sep="\n\n---------------\n\n")    Review of The Bee Movie    By Roger Ebert        This is the greatest movie ever made. 4 out of 5 stars.        {"movie_title": "The Bee Movie", "critic": "Roger Ebert", "tone": "positive", "rating": 4}        ---------------        Review of The Godfather    By Anonymous        This movie was super boring. 1 out of 5 stars.        {"movie_title": "The Godfather", "critic": "Anonymous", "tone": "negative", "rating": 1, "reliable": false}Customization‚ÄãYou can pass the underlying tagging chain the standard LLMChain arguments in the document transformer constructor. For example, if you wanted to ask the LLM to focus specific details in the input documents, or extract metadata in a certain style, you could pass in a custom prompt:from langchain.prompts import ChatPromptTemplateprompt = ChatPromptTemplate.from_template(    """Extract relevant information from the following text.Anonymous critics are actually Roger Ebert.{input}""")document_transformer = create_metadata_tagger(schema, llm, prompt=prompt)enhanced_documents = document_transformer.transform_documents(original_documents)print(    *[d.page_content + "\n\n" + json.dumps(d.metadata) for d in enhanced_documents],    sep="\n\n---------------\n\n")    Review of The Bee Movie    By Roger Ebert        This is the greatest movie ever made. 4 out of 5 stars.        {"movie_title": "The Bee Movie", "critic": "Roger Ebert", "tone": "positive", "rating": 4}        ---------------        Review of The Godfather    By Anonymous        This movie was super boring. 1 out of 5 stars.        {"movie_title": "The Godfather", "critic": "Roger Ebert", "tone": "negative", "rating": 1, "reliable": false}PreviousNucliaNextText embedding modelsCustomizationCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.
It can often be useful to tag ingested documents with structured metadata, such as the title, tone, or length of a document, to allow for a more targeted similarity search later. However, for large numbers of documents, performing this labelling process manually can be tedious.
It can often be useful to tag ingested documents with structured metadata, such as the title, tone, or length of a document, to allow for a more targeted similarity search later. However, for large numbers of documents, performing this labelling process manually can be tedious. ->: *[d.page_content + "\n\n" + json.dumps(d.metadata) for d in enhanced_documents],    sep="\n\n---------------\n\n")    Review of The Bee Movie    By Roger Ebert        This is the greatest movie ever made. 4 out of 5 stars.        {"movie_title": "The Bee Movie", "critic": "Roger Ebert", "tone": "positive", "rating": 4}        ---------------        Review of The Godfather    By Anonymous        This movie was super boring. 1 out of 5 stars.        {"movie_title": "The Godfather", "critic": "Anonymous", "tone": "negative", "rating": 1, "reliable": false}Customization‚ÄãYou can pass the underlying tagging chain the standard LLMChain arguments in the document transformer constructor. For example, if you wanted to ask the LLM to focus specific details in the input documents, or extract metadata in a certain style, you could pass in a custom prompt:from langchain.prompts import ChatPromptTemplateprompt = ChatPromptTemplate.from_template(    """Extract relevant information from the following text.Anonymous critics are actually Roger Ebert.{input}""")document_transformer = create_metadata_tagger(schema, llm, prompt=prompt)enhanced_documents = document_transformer.transform_documents(original_documents)print(    *[d.page_content + "\n\n" + json.dumps(d.metadata) for d in enhanced_documents],    sep="\n\n---------------\n\n")    Review of The Bee Movie    By Roger Ebert        This is the greatest movie ever made. 4 out of 5 stars.        {"movie_title": "The Bee Movie", "critic": "Roger Ebert", "tone": "positive", "rating": 4}        ---------------        Review of The Godfather    By Anonymous        This movie was super boring. 1 out of 5 stars.        {"movie_title": "The Godfather", "critic": "Roger Ebert", "tone": "negative", "rating": 1, "reliable": false}PreviousNucliaNextText embedding modelsCustomizationCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.