Last active
August 12, 2023 17:30
-
-
Save vhxs/aeb90ecc1bd7a214e7b98c1255405013 to your computer and use it in GitHub Desktop.
Using LangChain's question answering capability to ask questions about what I post on Mastodon
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from langchain.document_loaders import MastodonTootsLoader | |
from langchain.indexes import VectorstoreIndexCreator | |
from langchain.vectorstores.utils import filter_complex_metadata | |
loader = MastodonTootsLoader(mastodon_accounts=["@[email protected]"], number_toots=300) | |
documents = loader.load() | |
documents = filter_complex_metadata(documents) | |
index = VectorstoreIndexCreator().from_documents(documents) | |
print(index.query("What kinds of interests does this user have?")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment