No project description provided
Project description
MastodonFetcher Node for Haystack
This custom component for Haystack is designed to fetch the latest posts from a given Mastodon username and return the contents as a list of Haystack Documents. This way, it can be used as a replacement for a retriever node in a pipeline.
Instllation
pip install mastodon-fetcher-haystack
Usage in Haystack
- The node expects a full Mastodon username as the
query
input. E.g. 'tuana@sigmoid.social'. - You can set the number of posts you want to retrieve by setting the
last_k_posts
parameter while initializing the MastodonFetcher, or in therun
method. This can be a maximum of 40.
from mastodon_fetcher_haystack.mastodon_fetcher import MastodonFetcher
mastodon_fetcher = MastodonFetcher()
mastodon_fetcher.run(query="tuana@sigmoid.social")
In a pipeline
from haystack import Pipeline
from mastodon_fetcher_haystack.mastodon_fetcher import MastodonFetcher
mastodon_fetcher = MastodonFetcher(last_k_posts=15)
prompt_node = PromptNode(default_prompt_template="YOUR_PROMPT_TEMPLATE", model_name_or_path="text-davinci-003", api_key="YOUR_API_KEY")
pipeline = Pipeline()
pipeline.add_node(component=mastodon_fetcher, name="MastodonFetcher", inputs=["Query"])
pipeline.add_nide(component=prompt_node, name="PromptNode", inputs=["MastodonFetcher"])
pipeline.run(query="tuana@sigmoid.social")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for mastodon_fetcher_haystack-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 15fe3c6a3316412659577f7c2347b03fb7debe3ce71a003f473a66d3d6ca1350 |
|
MD5 | 40de1c5dfb23c0f8ddd8550302cb9cdf |
|
BLAKE2b-256 | 0a2ead3a6662b9e524a47a325710e0d9a6450989b7d84f9ccb98a658298cef06 |
Close
Hashes for mastodon_fetcher_haystack-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4620723e3f693c94bfe1ad9bccac451a75d1f6e7ac945c04341da5d497f50aa3 |
|
MD5 | 2359160d60ab3db8bc26b36bd7db0c9d |
|
BLAKE2b-256 | d69a18984d1ff6af9dbf59045e0ecd8f7a169a58418d2989272540b261539625 |