swarms-tools


Nameswarms-tools JSON
Version 0.1.3 PyPI version JSON
download
home_pagehttps://github.com/The-Swarm-Corporation/swarms-tools
SummaryPaper - Pytorch
upload_time2025-01-24 02:32:41
maintainerNone
docs_urlNone
authorKye Gomez
requires_python<4.0,>=3.10
licenseMIT
keywords artificial intelligence deep learning optimizers prompt engineering
VCS
bugtrack_url
requirements requests loguru
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Swarms Tools

[![Join our Discord](https://img.shields.io/badge/Discord-Join%20our%20server-5865F2?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/agora-999382051935506503) [![Subscribe on YouTube](https://img.shields.io/badge/YouTube-Subscribe-red?style=for-the-badge&logo=youtube&logoColor=white)](https://www.youtube.com/@kyegomez3242) [![Connect on LinkedIn](https://img.shields.io/badge/LinkedIn-Connect-blue?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/kye-g-38759a207/) [![Follow on X.com](https://img.shields.io/badge/X.com-Follow-1DA1F2?style=for-the-badge&logo=x&logoColor=white)](https://x.com/kyegomezb)


Welcome to **Swarms Tools**, the ultimate package for integrating **cutting-edge APIs** into Python functions with seamless multi-agent system compatibility. Designed for enterprises at the forefront of innovation, **Swarms Tools** is your key to simplifying complexity and unlocking operational excellence.

---

## πŸš€ Features

- **Unified API Integration**: Ready-to-use Python functions for financial data, social media, IoT, and more.
- **Enterprise-Grade Design**: Comprehensive type hints, structured outputs, and robust documentation.
- **Agent-Ready Framework**: Optimized for seamless integration into Swarms' multi-agent orchestration systems.
- **Expandable Architecture**: Easily extend functionality with a standardized schema for new tools.

---

## πŸ”§ Installation

```bash
pip3 install -U swarms-tools
```

---

## πŸ“‚ Directory Structure

```plaintext
swarms-tools/
β”œβ”€β”€ swarms_tools/
β”‚   β”œβ”€β”€ finance/
β”‚   β”‚   β”œβ”€β”€ htx_tool.py
β”‚   β”‚   β”œβ”€β”€ eodh_api.py
β”‚   β”‚   └── coingecko_tool.py
β”‚   β”œβ”€β”€ social_media/
β”‚   β”‚   β”œβ”€β”€ telegram_tool.py
β”‚   β”œβ”€β”€ utilities/
β”‚   β”‚   └── logging.py
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ test_financial_data.py
β”‚   └── test_social_media.py
└── README.md
```

---

## πŸ’Ό Use Cases



## Finance

Explore our diverse range of financial tools, designed to streamline your operations. If you need a tool not listed, feel free to submit an issue or accelerate integration by contributing a pull request with your tool of choice.

| **Tool Name**             | **Function**             | **Description**                                                                 |
|---------------------------|--------------------------|---------------------------------------------------------------------------------|
| `fetch_stock_news`        | `fetch_stock_news`       | Fetches the latest stock news and updates.                                     |
| `fetch_htx_data`          | `fetch_htx_data`         | Retrieves financial data from the HTX platform.                                |
| `yahoo_finance_api`       | `yahoo_finance_api`      | Fetches comprehensive stock data from Yahoo Finance, including prices and trends. |
| `coin_gecko_coin_api`     | `coin_gecko_coin_api`    | Fetches cryptocurrency data from CoinGecko, including market and price information. |
| `helius_api_tool`         | `helius_api_tool`        | Retrieves blockchain account, transaction, or token data using the Helius API. |
| `okx_api_tool`            | `okx_api_tool`           | Fetches detailed cryptocurrency data for coins from the OKX exchange.         |


### Financial Data Retrieval
Enable precise and actionable financial insights:

#### Example 1: Fetch Historical Data
```python
from swarms_tools import fetch_htx_data

# Fetch historical trading data for "Swarms Corporation"
response = fetch_htx_data("swarms")
print(response)
```

#### Example 2: Stock News Analysis
```python
from swarms_tools import fetch_stock_news

# Retrieve latest stock news for Apple
news = fetch_stock_news("AAPL")
print(news)
```

#### Example 3: Cryptocurrency Metrics
```python
from swarms_tools import coin_gecko_coin_api

# Fetch live data for Bitcoin
crypto_data = coin_gecko_coin_api("bitcoin")
print(crypto_data)
```

### Social Media Automation
Streamline communication and engagement:

#### Example: Telegram Bot Messaging
```python
from swarms_tools import telegram_dm_or_tag_api

def send_alert(response: str):
    telegram_dm_or_tag_api(response)

# Send a message to a user or group
send_alert("Mission-critical update from Swarms.")
```

---

## Dex Screener

This is a tool that allows you to fetch data from the Dex Screener API. It supports multiple chains and multiple tokens.

```python
from swarms_tools.finance.dex_screener import (
    fetch_latest_token_boosts,
    fetch_dex_screener_profiles,
)


fetch_dex_screener_profiles()
fetch_latest_token_boosts()

```

---


## Structs
The tool chainer enables the execution of multiple tools in a sequence, allowing for the aggregation of their results in either a parallel or sequential manner.

```python
# Example usage
from loguru import logger

from swarms_tools.structs import tool_chainer


if __name__ == "__main__":
    logger.add("tool_chainer.log", rotation="500 MB", level="INFO")

    # Example tools
    def tool1():
        return "Tool1 Result"

    def tool2():
        return "Tool2 Result"

    # def tool3():
    #     raise ValueError("Simulated error in Tool3")

    tools = [tool1, tool2]

    # Parallel execution
    parallel_results = tool_chainer(tools, parallel=True)
    print("Parallel Results:", parallel_results)

    # Sequential execution
    # sequential_results = tool_chainer(tools, parallel=False)
    # print("Sequential Results:", sequential_results)

```
---

## Social Media

- Twitter API Tool

```python
import os
from time import time

from swarm_models import OpenAIChat
from swarms import Agent
from dotenv import load_dotenv

from swarms_tools.social_media.twitter_tool import TwitterTool

load_dotenv()

model_name = "gpt-4o"

model = OpenAIChat(
    model_name=model_name,
    max_tokens=3000,
    openai_api_key=os.getenv("OPENAI_API_KEY"),
)


medical_coder = Agent(
    agent_name="Medical Coder",
    system_prompt="""
    You are a highly experienced and certified medical coder with extensive knowledge of ICD-10 coding guidelines, clinical documentation standards, and compliance regulations. Your responsibility is to ensure precise, compliant, and well-documented coding for all clinical cases.

    ### Primary Responsibilities:
    1. **Review Clinical Documentation**: Analyze all available clinical records, including specialist inputs, physician notes, lab results, imaging reports, and discharge summaries.
    2. **Assign Accurate ICD-10 Codes**: Identify and assign appropriate codes for primary diagnoses, secondary conditions, symptoms, and complications.
    3. **Ensure Coding Compliance**: Follow the latest ICD-10-CM/PCS coding guidelines, payer-specific requirements, and organizational policies.
    4. **Document Code Justification**: Provide clear, evidence-based rationale for each assigned code.

    ### Detailed Coding Process:
    - **Review Specialist Inputs**: Examine all relevant documentation to capture the full scope of the patient's condition and care provided.
    - **Identify Diagnoses**: Determine the primary and secondary diagnoses, as well as any symptoms or complications, based on the documentation.
    - **Assign ICD-10 Codes**: Select the most accurate and specific ICD-10 codes for each identified diagnosis or condition.
    - **Document Supporting Evidence**: Record the documentation source (e.g., lab report, imaging, or physician note) for each code to justify its assignment.
    - **Address Queries**: Note and flag any inconsistencies, missing information, or areas requiring clarification from providers.

    ### Output Requirements:
    Your response must be clear, structured, and compliant with professional standards. Use the following format:

    1. **Primary Diagnosis Codes**:
        - **ICD-10 Code**: [e.g., E11.9]
        - **Description**: [e.g., Type 2 diabetes mellitus without complications]
        - **Supporting Documentation**: [e.g., Physician's note dated MM/DD/YYYY]
        
    2. **Secondary Diagnosis Codes**:
        - **ICD-10 Code**: [Code]
        - **Description**: [Description]
        - **Order of Clinical Significance**: [Rank or priority]

    3. **Symptom Codes**:
        - **ICD-10 Code**: [Code]
        - **Description**: [Description]

    4. **Complication Codes**:
        - **ICD-10 Code**: [Code]
        - **Description**: [Description]
        - **Relevant Documentation**: [Source of information]

    5. **Coding Notes**:
        - Observations, clarifications, or any potential issues requiring provider input.

    ### Additional Guidelines:
    - Always prioritize specificity and compliance when assigning codes.
    - For ambiguous cases, provide a brief note with reasoning and flag for clarification.
    - Ensure the output format is clean, consistent, and ready for professional use.
    """,
    llm=model,
    max_loops=1,
    dynamic_temperature_enabled=True,
)


# Define your options with the necessary credentials
options = {
    "id": "29998836",
    "name": "mcsswarm",
    "description": "An example Twitter Plugin for testing.",
    "credentials": {
        "apiKey": os.getenv("TWITTER_API_KEY"),
        "apiSecretKey": os.getenv("TWITTER_API_SECRET_KEY"),
        "accessToken": os.getenv("TWITTER_ACCESS_TOKEN"),
        "accessTokenSecret": os.getenv("TWITTER_ACCESS_TOKEN_SECRET"),
    },
}

# Initialize the TwitterTool with your options
twitter_plugin = TwitterTool(options)

# # Post a tweet
# post_tweet_fn = twitter_plugin.get_function('post_tweet')
# post_tweet_fn("Hello world!")


# Assuming `twitter_plugin` and `medical_coder` are already initialized
post_tweet = twitter_plugin.get_function("post_tweet")

# Set to track posted tweets and avoid duplicates
posted_tweets = set()


def post_unique_tweet():
    """
    Generate and post a unique tweet. Skip duplicates.
    """
    tweet_prompt = (
        "Share an intriguing, lesser-known fact about a medical disease, and include an innovative, fun, or surprising way to manage or cure it! "
        "Make the response playful, engaging, and inspiringβ€”something that makes people smile while learning. No markdown, just plain text!"
    )

    # Generate a new tweet text
    tweet_text = medical_coder.run(tweet_prompt)

    # Check for duplicates
    if tweet_text in posted_tweets:
        print("Duplicate tweet detected. Skipping...")
        return

    # Post the tweet
    try:
        post_tweet(tweet_text)
        print(f"Posted tweet: {tweet_text}")
        # Add the tweet to the set of posted tweets
        posted_tweets.add(tweet_text)
    except Exception as e:
        print(f"Error posting tweet: {e}")


# Loop to post tweets every 10 seconds
def start_tweet_loop(interval=10):
    """
    Continuously post tweets every `interval` seconds.

    Args:
        interval (int): Time in seconds between tweets.
    """
    print("Starting tweet loop...")
    while True:
        post_unique_tweet()
        time.sleep(interval)


# Start the loop
start_tweet_loop(10)


```

## 🧩 Standardized Schema

Every tool in **Swarms Tools** adheres to a strict schema for maintainability and interoperability:

### Schema Template

1. **Functionality**:
   - Encapsulate API logic into a modular, reusable function.

2. **Typing**:
   - Leverage Python type hints for input validation and clarity.

   Example:
   ```python
   def fetch_data(symbol: str, date_range: str) -> str:
       """
       Fetch financial data for a given symbol and date range.

       Args:
           symbol (str): Ticker symbol of the asset.
           date_range (str): Timeframe for the data (e.g., '1d', '1m', '1y').

       Returns:
           dict: A dictionary containing financial metrics.
       """
       pass
   ```

3. **Documentation**:
   - Include detailed docstrings with parameter explanations and usage examples.

4. **Output Standardization**:
   - Ensure consistent outputs (e.g., strings) for easy downstream agent integration.

5. **API-Key Management**:
    - All API keys must be fetched with `os.getenv("YOUR_KEY")`


---

## πŸ“– Documentation

Comprehensive documentation is available to guide developers and enterprises. Visit our [official docs](https://docs.swarms.world) for detailed API references, usage examples, and best practices.

---

## πŸ›  Contributing

We welcome contributions from the global developer community. To contribute:

1. **Fork the Repository**: Start by forking the repository.
2. **Create a Feature Branch**: Use a descriptive branch name: `feature/add-new-tool`.
3. **Commit Your Changes**: Write meaningful commit messages.
4. **Submit a Pull Request**: Open a pull request for review.

---

## πŸ›‘οΈ License

This project is licensed under the **MIT License**. See the [LICENSE](LICENSE) file for details.

---

## 🌠 Join the Future

Explore the limitless possibilities of agent-based systems. Together, we can build a smarter, faster, and more interconnected world.

**Visit us:** [Swarms Corporation](https://swarms.ai)  
**Follow us:** [Twitter](https://twitter.com/swarms_corp)

---

**"The future belongs to those who dare to automate it."**  
**β€” The Swarms Corporation**


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/The-Swarm-Corporation/swarms-tools",
    "name": "swarms-tools",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": "artificial intelligence, deep learning, optimizers, Prompt Engineering",
    "author": "Kye Gomez",
    "author_email": "kye@apac.ai",
    "download_url": "https://files.pythonhosted.org/packages/53/16/70031f2010d71a2d2807aa7396d28823f556466fc6a51f6af5cebd9fa203/swarms_tools-0.1.3.tar.gz",
    "platform": null,
    "description": "# Swarms Tools\n\n[![Join our Discord](https://img.shields.io/badge/Discord-Join%20our%20server-5865F2?style=for-the-badge&logo=discord&logoColor=white)](https://discord.gg/agora-999382051935506503) [![Subscribe on YouTube](https://img.shields.io/badge/YouTube-Subscribe-red?style=for-the-badge&logo=youtube&logoColor=white)](https://www.youtube.com/@kyegomez3242) [![Connect on LinkedIn](https://img.shields.io/badge/LinkedIn-Connect-blue?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/kye-g-38759a207/) [![Follow on X.com](https://img.shields.io/badge/X.com-Follow-1DA1F2?style=for-the-badge&logo=x&logoColor=white)](https://x.com/kyegomezb)\n\n\nWelcome to **Swarms Tools**, the ultimate package for integrating **cutting-edge APIs** into Python functions with seamless multi-agent system compatibility. Designed for enterprises at the forefront of innovation, **Swarms Tools** is your key to simplifying complexity and unlocking operational excellence.\n\n---\n\n## \ud83d\ude80 Features\n\n- **Unified API Integration**: Ready-to-use Python functions for financial data, social media, IoT, and more.\n- **Enterprise-Grade Design**: Comprehensive type hints, structured outputs, and robust documentation.\n- **Agent-Ready Framework**: Optimized for seamless integration into Swarms' multi-agent orchestration systems.\n- **Expandable Architecture**: Easily extend functionality with a standardized schema for new tools.\n\n---\n\n## \ud83d\udd27 Installation\n\n```bash\npip3 install -U swarms-tools\n```\n\n---\n\n## \ud83d\udcc2 Directory Structure\n\n```plaintext\nswarms-tools/\n\u251c\u2500\u2500 swarms_tools/\n\u2502   \u251c\u2500\u2500 finance/\n\u2502   \u2502   \u251c\u2500\u2500 htx_tool.py\n\u2502   \u2502   \u251c\u2500\u2500 eodh_api.py\n\u2502   \u2502   \u2514\u2500\u2500 coingecko_tool.py\n\u2502   \u251c\u2500\u2500 social_media/\n\u2502   \u2502   \u251c\u2500\u2500 telegram_tool.py\n\u2502   \u251c\u2500\u2500 utilities/\n\u2502   \u2502   \u2514\u2500\u2500 logging.py\n\u251c\u2500\u2500 tests/\n\u2502   \u251c\u2500\u2500 test_financial_data.py\n\u2502   \u2514\u2500\u2500 test_social_media.py\n\u2514\u2500\u2500 README.md\n```\n\n---\n\n## \ud83d\udcbc Use Cases\n\n\n\n## Finance\n\nExplore our diverse range of financial tools, designed to streamline your operations. If you need a tool not listed, feel free to submit an issue or accelerate integration by contributing a pull request with your tool of choice.\n\n| **Tool Name**             | **Function**             | **Description**                                                                 |\n|---------------------------|--------------------------|---------------------------------------------------------------------------------|\n| `fetch_stock_news`        | `fetch_stock_news`       | Fetches the latest stock news and updates.                                     |\n| `fetch_htx_data`          | `fetch_htx_data`         | Retrieves financial data from the HTX platform.                                |\n| `yahoo_finance_api`       | `yahoo_finance_api`      | Fetches comprehensive stock data from Yahoo Finance, including prices and trends. |\n| `coin_gecko_coin_api`     | `coin_gecko_coin_api`    | Fetches cryptocurrency data from CoinGecko, including market and price information. |\n| `helius_api_tool`         | `helius_api_tool`        | Retrieves blockchain account, transaction, or token data using the Helius API. |\n| `okx_api_tool`            | `okx_api_tool`           | Fetches detailed cryptocurrency data for coins from the OKX exchange.         |\n\n\n### Financial Data Retrieval\nEnable precise and actionable financial insights:\n\n#### Example 1: Fetch Historical Data\n```python\nfrom swarms_tools import fetch_htx_data\n\n# Fetch historical trading data for \"Swarms Corporation\"\nresponse = fetch_htx_data(\"swarms\")\nprint(response)\n```\n\n#### Example 2: Stock News Analysis\n```python\nfrom swarms_tools import fetch_stock_news\n\n# Retrieve latest stock news for Apple\nnews = fetch_stock_news(\"AAPL\")\nprint(news)\n```\n\n#### Example 3: Cryptocurrency Metrics\n```python\nfrom swarms_tools import coin_gecko_coin_api\n\n# Fetch live data for Bitcoin\ncrypto_data = coin_gecko_coin_api(\"bitcoin\")\nprint(crypto_data)\n```\n\n### Social Media Automation\nStreamline communication and engagement:\n\n#### Example: Telegram Bot Messaging\n```python\nfrom swarms_tools import telegram_dm_or_tag_api\n\ndef send_alert(response: str):\n    telegram_dm_or_tag_api(response)\n\n# Send a message to a user or group\nsend_alert(\"Mission-critical update from Swarms.\")\n```\n\n---\n\n## Dex Screener\n\nThis is a tool that allows you to fetch data from the Dex Screener API. It supports multiple chains and multiple tokens.\n\n```python\nfrom swarms_tools.finance.dex_screener import (\n    fetch_latest_token_boosts,\n    fetch_dex_screener_profiles,\n)\n\n\nfetch_dex_screener_profiles()\nfetch_latest_token_boosts()\n\n```\n\n---\n\n\n## Structs\nThe tool chainer enables the execution of multiple tools in a sequence, allowing for the aggregation of their results in either a parallel or sequential manner.\n\n```python\n# Example usage\nfrom loguru import logger\n\nfrom swarms_tools.structs import tool_chainer\n\n\nif __name__ == \"__main__\":\n    logger.add(\"tool_chainer.log\", rotation=\"500 MB\", level=\"INFO\")\n\n    # Example tools\n    def tool1():\n        return \"Tool1 Result\"\n\n    def tool2():\n        return \"Tool2 Result\"\n\n    # def tool3():\n    #     raise ValueError(\"Simulated error in Tool3\")\n\n    tools = [tool1, tool2]\n\n    # Parallel execution\n    parallel_results = tool_chainer(tools, parallel=True)\n    print(\"Parallel Results:\", parallel_results)\n\n    # Sequential execution\n    # sequential_results = tool_chainer(tools, parallel=False)\n    # print(\"Sequential Results:\", sequential_results)\n\n```\n---\n\n## Social Media\n\n- Twitter API Tool\n\n```python\nimport os\nfrom time import time\n\nfrom swarm_models import OpenAIChat\nfrom swarms import Agent\nfrom dotenv import load_dotenv\n\nfrom swarms_tools.social_media.twitter_tool import TwitterTool\n\nload_dotenv()\n\nmodel_name = \"gpt-4o\"\n\nmodel = OpenAIChat(\n    model_name=model_name,\n    max_tokens=3000,\n    openai_api_key=os.getenv(\"OPENAI_API_KEY\"),\n)\n\n\nmedical_coder = Agent(\n    agent_name=\"Medical Coder\",\n    system_prompt=\"\"\"\n    You are a highly experienced and certified medical coder with extensive knowledge of ICD-10 coding guidelines, clinical documentation standards, and compliance regulations. Your responsibility is to ensure precise, compliant, and well-documented coding for all clinical cases.\n\n    ### Primary Responsibilities:\n    1. **Review Clinical Documentation**: Analyze all available clinical records, including specialist inputs, physician notes, lab results, imaging reports, and discharge summaries.\n    2. **Assign Accurate ICD-10 Codes**: Identify and assign appropriate codes for primary diagnoses, secondary conditions, symptoms, and complications.\n    3. **Ensure Coding Compliance**: Follow the latest ICD-10-CM/PCS coding guidelines, payer-specific requirements, and organizational policies.\n    4. **Document Code Justification**: Provide clear, evidence-based rationale for each assigned code.\n\n    ### Detailed Coding Process:\n    - **Review Specialist Inputs**: Examine all relevant documentation to capture the full scope of the patient's condition and care provided.\n    - **Identify Diagnoses**: Determine the primary and secondary diagnoses, as well as any symptoms or complications, based on the documentation.\n    - **Assign ICD-10 Codes**: Select the most accurate and specific ICD-10 codes for each identified diagnosis or condition.\n    - **Document Supporting Evidence**: Record the documentation source (e.g., lab report, imaging, or physician note) for each code to justify its assignment.\n    - **Address Queries**: Note and flag any inconsistencies, missing information, or areas requiring clarification from providers.\n\n    ### Output Requirements:\n    Your response must be clear, structured, and compliant with professional standards. Use the following format:\n\n    1. **Primary Diagnosis Codes**:\n        - **ICD-10 Code**: [e.g., E11.9]\n        - **Description**: [e.g., Type 2 diabetes mellitus without complications]\n        - **Supporting Documentation**: [e.g., Physician's note dated MM/DD/YYYY]\n        \n    2. **Secondary Diagnosis Codes**:\n        - **ICD-10 Code**: [Code]\n        - **Description**: [Description]\n        - **Order of Clinical Significance**: [Rank or priority]\n\n    3. **Symptom Codes**:\n        - **ICD-10 Code**: [Code]\n        - **Description**: [Description]\n\n    4. **Complication Codes**:\n        - **ICD-10 Code**: [Code]\n        - **Description**: [Description]\n        - **Relevant Documentation**: [Source of information]\n\n    5. **Coding Notes**:\n        - Observations, clarifications, or any potential issues requiring provider input.\n\n    ### Additional Guidelines:\n    - Always prioritize specificity and compliance when assigning codes.\n    - For ambiguous cases, provide a brief note with reasoning and flag for clarification.\n    - Ensure the output format is clean, consistent, and ready for professional use.\n    \"\"\",\n    llm=model,\n    max_loops=1,\n    dynamic_temperature_enabled=True,\n)\n\n\n# Define your options with the necessary credentials\noptions = {\n    \"id\": \"29998836\",\n    \"name\": \"mcsswarm\",\n    \"description\": \"An example Twitter Plugin for testing.\",\n    \"credentials\": {\n        \"apiKey\": os.getenv(\"TWITTER_API_KEY\"),\n        \"apiSecretKey\": os.getenv(\"TWITTER_API_SECRET_KEY\"),\n        \"accessToken\": os.getenv(\"TWITTER_ACCESS_TOKEN\"),\n        \"accessTokenSecret\": os.getenv(\"TWITTER_ACCESS_TOKEN_SECRET\"),\n    },\n}\n\n# Initialize the TwitterTool with your options\ntwitter_plugin = TwitterTool(options)\n\n# # Post a tweet\n# post_tweet_fn = twitter_plugin.get_function('post_tweet')\n# post_tweet_fn(\"Hello world!\")\n\n\n# Assuming `twitter_plugin` and `medical_coder` are already initialized\npost_tweet = twitter_plugin.get_function(\"post_tweet\")\n\n# Set to track posted tweets and avoid duplicates\nposted_tweets = set()\n\n\ndef post_unique_tweet():\n    \"\"\"\n    Generate and post a unique tweet. Skip duplicates.\n    \"\"\"\n    tweet_prompt = (\n        \"Share an intriguing, lesser-known fact about a medical disease, and include an innovative, fun, or surprising way to manage or cure it! \"\n        \"Make the response playful, engaging, and inspiring\u2014something that makes people smile while learning. No markdown, just plain text!\"\n    )\n\n    # Generate a new tweet text\n    tweet_text = medical_coder.run(tweet_prompt)\n\n    # Check for duplicates\n    if tweet_text in posted_tweets:\n        print(\"Duplicate tweet detected. Skipping...\")\n        return\n\n    # Post the tweet\n    try:\n        post_tweet(tweet_text)\n        print(f\"Posted tweet: {tweet_text}\")\n        # Add the tweet to the set of posted tweets\n        posted_tweets.add(tweet_text)\n    except Exception as e:\n        print(f\"Error posting tweet: {e}\")\n\n\n# Loop to post tweets every 10 seconds\ndef start_tweet_loop(interval=10):\n    \"\"\"\n    Continuously post tweets every `interval` seconds.\n\n    Args:\n        interval (int): Time in seconds between tweets.\n    \"\"\"\n    print(\"Starting tweet loop...\")\n    while True:\n        post_unique_tweet()\n        time.sleep(interval)\n\n\n# Start the loop\nstart_tweet_loop(10)\n\n\n```\n\n## \ud83e\udde9 Standardized Schema\n\nEvery tool in **Swarms Tools** adheres to a strict schema for maintainability and interoperability:\n\n### Schema Template\n\n1. **Functionality**:\n   - Encapsulate API logic into a modular, reusable function.\n\n2. **Typing**:\n   - Leverage Python type hints for input validation and clarity.\n\n   Example:\n   ```python\n   def fetch_data(symbol: str, date_range: str) -> str:\n       \"\"\"\n       Fetch financial data for a given symbol and date range.\n\n       Args:\n           symbol (str): Ticker symbol of the asset.\n           date_range (str): Timeframe for the data (e.g., '1d', '1m', '1y').\n\n       Returns:\n           dict: A dictionary containing financial metrics.\n       \"\"\"\n       pass\n   ```\n\n3. **Documentation**:\n   - Include detailed docstrings with parameter explanations and usage examples.\n\n4. **Output Standardization**:\n   - Ensure consistent outputs (e.g., strings) for easy downstream agent integration.\n\n5. **API-Key Management**:\n    - All API keys must be fetched with `os.getenv(\"YOUR_KEY\")`\n\n\n---\n\n## \ud83d\udcd6 Documentation\n\nComprehensive documentation is available to guide developers and enterprises. Visit our [official docs](https://docs.swarms.world) for detailed API references, usage examples, and best practices.\n\n---\n\n## \ud83d\udee0 Contributing\n\nWe welcome contributions from the global developer community. To contribute:\n\n1. **Fork the Repository**: Start by forking the repository.\n2. **Create a Feature Branch**: Use a descriptive branch name: `feature/add-new-tool`.\n3. **Commit Your Changes**: Write meaningful commit messages.\n4. **Submit a Pull Request**: Open a pull request for review.\n\n---\n\n## \ud83d\udee1\ufe0f License\n\nThis project is licensed under the **MIT License**. See the [LICENSE](LICENSE) file for details.\n\n---\n\n## \ud83c\udf20 Join the Future\n\nExplore the limitless possibilities of agent-based systems. Together, we can build a smarter, faster, and more interconnected world.\n\n**Visit us:** [Swarms Corporation](https://swarms.ai)  \n**Follow us:** [Twitter](https://twitter.com/swarms_corp)\n\n---\n\n**\"The future belongs to those who dare to automate it.\"**  \n**\u2014 The Swarms Corporation**\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Paper - Pytorch",
    "version": "0.1.3",
    "project_urls": {
        "Documentation": "https://github.com/The-Swarm-Corporation/swarms-tools",
        "Homepage": "https://github.com/The-Swarm-Corporation/swarms-tools",
        "Repository": "https://github.com/The-Swarm-Corporation/swarms-tools"
    },
    "split_keywords": [
        "artificial intelligence",
        " deep learning",
        " optimizers",
        " prompt engineering"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "97c53849b119c89aa9e0d0e05926716d82e444544e222499d4cc60af0c2869f3",
                "md5": "90d12c9d62a05e048aeaee3b54875ad3",
                "sha256": "47708402501b995fb8967ebff547417939e88d362c724b66fbfcbcf2107d5083"
            },
            "downloads": -1,
            "filename": "swarms_tools-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "90d12c9d62a05e048aeaee3b54875ad3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 44234,
            "upload_time": "2025-01-24T02:32:39",
            "upload_time_iso_8601": "2025-01-24T02:32:39.642232Z",
            "url": "https://files.pythonhosted.org/packages/97/c5/3849b119c89aa9e0d0e05926716d82e444544e222499d4cc60af0c2869f3/swarms_tools-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "531670031f2010d71a2d2807aa7396d28823f556466fc6a51f6af5cebd9fa203",
                "md5": "aa2cfdce917676ec571ffc798102d2cb",
                "sha256": "8e70e23f1e375c55282229866eb7d94d9195f16664e8b6c118c2536f0eaaf453"
            },
            "downloads": -1,
            "filename": "swarms_tools-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "aa2cfdce917676ec571ffc798102d2cb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 37785,
            "upload_time": "2025-01-24T02:32:41",
            "upload_time_iso_8601": "2025-01-24T02:32:41.692649Z",
            "url": "https://files.pythonhosted.org/packages/53/16/70031f2010d71a2d2807aa7396d28823f556466fc6a51f6af5cebd9fa203/swarms_tools-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-24 02:32:41",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "The-Swarm-Corporation",
    "github_project": "swarms-tools",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "requests",
            "specs": []
        },
        {
            "name": "loguru",
            "specs": []
        }
    ],
    "lcname": "swarms-tools"
}
        
Elapsed time: 3.78425s