Skip to main content

llama-index readers imdb_review integration

Project description

IMDB MOVIE REVIEWS LOADER

pip install llama-index-readers-imdb-review

This loader fetches all the reviews of a movie or a TV-series from IMDB official site. This loader is working on Windows machine and it requires further debug on Linux. Fixes are on the way

Install the required dependencies

pip install -r requirements.txt

The IMDB downloader takes in two attributes

  • movie_name_year: The name of the movie or series and year
  • webdriver_engine: To use edge, google or gecko (mozilla) webdriver
  • generate_csv: Whether to generate csv file
  • multithreading: whether to use multithreading or not

Usage

from llama_index.readers.imdb_review import IMDBReviews

loader = IMDBReviews(
    movie_name_year="The Social Network 2010", webdriver_engine="edge"
)
docs = loader.load_data()

The metadata has the following information

  • date of the review (date)
  • title of the review (title)
  • rating of the review (rating)
  • link of the review (link)
  • whether the review is spoiler or not (spoiler)
  • number of people found the review helpful (found_helpful)
  • total number of votes (total)

It will download the files inside the folder movie_reviews with the filename as the movie name

EXAMPLES

This loader can be used with both Langchain and LlamaIndex.

LlamaIndex

from llama_index.core import VectorStoreIndex, download_loader
from llama_index.core import VectorStoreIndex

from llama_index.readers.imdb_review import IMDBReviews

loader = IMDBReviewsloader(
    movie_name_year="The Social Network 2010",
    webdriver_engine="edge",
    generate_csv=False,
    multithreading=False,
)
docs = loader.load_data()

index = VectorStoreIndex.from_documents(documents)
query_engine = index.as_query_engine()

response = query_engine.query(
    "What did the movie say about Mark Zuckerberg?",
)
print(response)

Langchain

from langchain.llms import OpenAI
from langchain.agents.agent_toolkits.pandas import (
    create_pandas_dataframe_agent,
)
from langchain.agents import Tool
from langchain.agents import initialize_agent
from langchain.chat_models import ChatOpenAI

from llama_index.readers.imdb_review import IMDBReviews

loader = IMDBReviewsloader(
    movie_name_year="The Social Network 2010",
    webdriver_engine="edge",
    generate_csv=False,
    multithreading=False,
)
docs = loader.load_data()
tools = [
    Tool(
        name="LlamaIndex",
        func=lambda q: str(index.as_query_engine().query(q)),
        description="useful for when you want to answer questions about the movies and their reviews. The input to this tool should be a complete english sentence.",
        return_direct=True,
    ),
]
llm = ChatOpenAI(temperature=0)
agent = initialize_agent(tools, llm, agent="conversational-react-description")
agent.run("What did the movie say about Mark Zuckerberg?")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llama_index_readers_imdb_review-0.4.0.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llama_index_readers_imdb_review-0.4.0-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file llama_index_readers_imdb_review-0.4.0.tar.gz.

File metadata

File hashes

Hashes for llama_index_readers_imdb_review-0.4.0.tar.gz
Algorithm Hash digest
SHA256 7c1d38166a4b395e61206d5a5e05172c216d2014c80f6a3116ae68ce0369c546
MD5 bac0a23e1446cbee5139a4e7535c1c48
BLAKE2b-256 88591d1c0d3c8793944268b780a8c463280180913f38a829d755789a4c98576a

See more details on using hashes here.

File details

Details for the file llama_index_readers_imdb_review-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_readers_imdb_review-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 29d29bd69a51feeeb9928c2f7f793f4a88b155f2bd1a6e7156a037eeb4ce278f
MD5 96fc4318b9cdf62aacc339b51f52db50
BLAKE2b-256 5de3009203603b6cb6e93f470086a127f82e0ad2e145eb4d9d14487008509214

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page