Skip to main content

PyPI

🎾 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

For Haystack 2.0-Beta onwards:

pip install mastodon-fetcher-haystack

For Haystack 1.x

pip install mastodon-fetcher-haystack==0.0.1

Usage in Haystack 2.0-Beta onwards

  1. The node expects a full Mastodon username as the username input. E.g. 'tuana@sigmoid.social'.
  2. You can set the number of posts you want to retrieve by setting the last_k_posts parameter while initializing the MastodonFetcher, or in the run method. This can be a maximum of 40.
from mastodon_fetcher_haystack.mastodon_fetcher import MastodonFetcher

mastodon_fetcher = MastodonFetcher()
mastodon_fetcher.run(username="tuana@sigmoid.social")

In a pipeline

from haystack import Pipeline
from mastodon_fetcher_haystack.mastodon_fetcher import MastodonFetcher
from haystack.components.generators import OpenAIGenerator
from haystack.components.builders import PromptBuilder

prompt_builder = PromptBuilder(template='YOUR_PROMPT_TEMPLATE')
llm = OpenAIGenerator(api_key'YOUR_OPENAI_API_KEY')

pipe = Pipeline()
pipe.add_component("fetcher", mastodon_fetcher)
pipe.add_component("prompt_builder", prompt_builder)
pipe.add_component("llm", llm)

pipe.connect("fetcher.documents", "prompt_builder.documents")
pipe.connect("prompt_builder.prompt", "llm.prompt")
pipe.run(data={"fetcher": {"username": "tuana@sigmoid.social"}})

Usage in Haystack 1.x

  1. The node expects a full Mastodon username as the query input. E.g. 'tuana@sigmoid.social'.
  2. You can set the number of posts you want to retrieve by setting the last_k_posts parameter while initializing the MastodonFetcher, or in the run 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")

Metadata

Release files for mastodon-fetcher-haystack 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mastodon-fetcher-haystack 0.1.0
File Size Uploaded Provenance
mastodon_fetcher_haystack-0.1.0.tar.gz 4.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mastodon-fetcher-haystack 0.1.0
File Interpreter ABI Platform
mastodon_fetcher_haystack-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.2 kB

Release files / mastodon_fetcher_haystack-0.1.0.tar.gz

Download URL mastodon_fetcher_haystack-0.1.0.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a838535e38925eb5a33e8ff4137432c81a5b6bc18e22c5e9659d209fa105a110
BLAKE2b-256 checksum
How to use checksums
e3af5d051987aa4e93aa705377ec2c2e8e94480f689514faff2e65f4abaa9096
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.26.0

Release files / mastodon_fetcher_haystack-0.1.0-py3-none-any.whl

Download URL mastodon_fetcher_haystack-0.1.0-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5f4125213d29b67f5f17b2cca18e1feea6ee373cbb7833a648da860e98f1afd4
BLAKE2b-256 checksum
How to use checksums
ee428bc108cc3ff24de6dead76f34f185317415be35319d3b97e60843611a2c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-httpx/0.26.0

Security for mastodon-fetcher-haystack 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page