# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['tree_of_thoughts']

package_data = \
{'': ['*']}

install_requires = \
['numpy', 'queue', 'swarms', 'transformers']

setup_kwargs = {
    'name': 'tree-of-thoughts',
    'version': '0.4.7',
    'description': 'Tree of Thoughts - Pytorch',
    'long_description': '[![Multi-Modality](imags/agorabanner.png)](https://discord.gg/qUtxnK2NMf)\n\n![Tree of Thoughts Banner](images/treeofthoughts.png)\n\n![Discord](https://img.shields.io/discord/999382051935506503)\n[![Twitter](https://img.shields.io/twitter/url?style=social&url=https%3A%2F%2Fgithub.com%2Fkyegomez%2Ftree-of-thoughts)](https://twitter.com/intent/tweet?text=Check%20out%20this%20amazing%20project%20on%20improving%20AI%20reasoning%20-%20Tree%20of%20Thoughts!%20https://github.com/kyegomez/tree-of-thoughts)\n[![LinkedIn](https://img.shields.io/badge/Share-LinkedIn-blue?style=social&logo=linkedin)](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fgithub.com%2Fkyegomez%2Ftree-of-thoughts)\n[![Facebook](https://img.shields.io/badge/Share-Facebook-blue?style=social&logo=facebook)](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fgithub.com%2Fkyegomez%2Ftree-of-thoughts)\n[![Reddit](https://img.shields.io/badge/Share-Reddit-orange?style=social&logo=reddit)](https://www.reddit.com/submit?url=https%3A%2F%2Fgithub.com%2Fkyegomez%2Ftree-of-thoughts&title=Check%20out%20this%20amazing%20project%20on%20improving%20AI%20reasoning%20-%20Tree%20of%20Thoughts%21)\n[![Hacker News](https://img.shields.io/badge/Share-Hacker%20News-orange?style=social&logo=y-combinator)](https://news.ycombinator.com/submitlink?u=https%3A%2F%2Fgithub.com%2Fkyegomez%2Ftree-of-thoughts&t=Check%20out%20this%20amazing%20project%20on%20improving%20AI%20reasoning%20-%20Tree%20of%20Thoughts%21)\n[![Pinterest](https://img.shields.io/badge/Share-Pinterest-red?style=social&logo=pinterest)](https://pinterest.com/pin/create/button/?url=https%3A%2F%2Fgithub.com%2Fkyegomez%2Ftree-of-thoughts&media=https%3A%2F%2Fgithub.com%2Fkyegomez%2Ftree-of-thoughts%2Fraw%2Fmain%2Ftree-of-thoughts.jpeg&description=Check%20out%20this%20amazing%20project%20on%20improving%20AI%20reasoning%20-%20Tree%20of%20Thoughts%21)\n[![WhatsApp](https://img.shields.io/badge/Share-WhatsApp-green?style=social&logo=whatsapp)](https://api.whatsapp.com/send?text=Check%20out%20this%20amazing%20project%20on%20improving%20AI%20reasoning%20-%20Tree%20of%20Thoughts%21%20https%3A%2F%2Fgithub.com%2Fkyegomez%2Ftree-of-thoughts)\n\n\n[Paper link](https://arxiv.org/pdf/2305.10601.pdf)\n[Author\'s implementation](https://github.com/princeton-nlp/tree-of-thought-llm)\n\n## Introduction\n\nTree of Thoughts (ToT) is a powerful and flexible algorithm that significantly advances model reasoning by up to 70%. This plug-and-play version allows you to connect your own models and experience superintelligence!\n\n\n## Install\n\n```bash\npip install tree-of-thoughts\n```\n\n## Usage\n```python\nimport os\nfrom tree_of_thoughts import ToTAgent, MonteCarloSearch\nfrom dotenv import load_dotenv\nfrom swarms import Agent, OpenAIChat\n\nload_dotenv()\n\n# Get the API key from the environment\napi_key = os.environ.get("OPENAI_API_KEY")\n\n# Initialize an agent from swarms\nagent = Agent(\n    agent_name="tree_of_thoughts",\n    agent_description="This agent uses the tree_of_thoughts library to generate thoughts.",\n    system_prompt=None,\n    llm = OpenAIChat(),   \n)\n\n# Initialize the ToTAgent class with the API key\nmodel = ToTAgent(\n    agent,\n    strategy="cot",\n    evaluation_strategy="value",\n    enable_react=True,\n    k=3,\n)\n\n\n# Initialize the MonteCarloSearch class with the model\ntree_of_thoughts = MonteCarloSearch(model)\n\n# Define the initial prompt\ninitial_prompt = """\n\n\nInput: 2 8 8 14\nPossible next steps:\n2 + 8 = 10 (left: 8 10 14)\n8 / 2 = 4 (left: 4 8 14)\n14 + 2 = 16 (left: 8 8 16)\n2 * 8 = 16 (left: 8 14 16)\n8 - 2 = 6 (left: 6 8 14)\n14 - 8 = 6 (left: 2 6 8)\n14 /  2 = 7 (left: 7 8 8)\n14 - 2 = 12 (left: 8 8 12)\nInput: use 4 numbers and basic arithmetic operations (+-*/) to obtain 24 in 1 equation\nPossible next steps:\n"""\n\n# Define the number of thoughts to generate\nnum_thoughts = 1\nmax_steps = 3\nmax_states = 4\npruning_threshold = 0.5\n\n\n# Generate the thoughts\nsolution = tree_of_thoughts.solve(\n    initial_prompt=initial_prompt,\n    num_thoughts=num_thoughts,\n    max_steps=max_steps,\n    max_states=max_states,\n    pruning_threshold=pruning_threshold,\n    # sleep_time=sleep_time\n)\n\nprint(f"Solution: {solution}")\n\n\n```\n\n\n### ToT with HF LLM\n\nTo run Hugging Face Transformers with Tree of Thoughts:\n```python\nimport os\nfrom tree_of_thoughts import ToTAgent, MonteCarloSearch\nfrom dotenv import load_dotenv\nfrom swarms import Agent, HuggingfaceLLM\n\nload_dotenv()\n\n# Get the API key from the environment\napi_key = os.environ.get("OPENAI_API_KEY")\n\n# Initialize an agent from swarms\nagent = Agent(\n    agent_name="tree_of_thoughts",\n    agent_description=(\n        "This agent uses the tree_of_thoughts library to generate thoughts."\n    ),\n    system_prompt=None,\n    llm=HuggingfaceLLM(\n        "EleutherAI/gpt-neo-2.7B",\n    ),\n)\n\n# Initialize the ToTAgent class with the API key\nmodel = ToTAgent(\n    agent,\n    strategy="cot",\n    evaluation_strategy="value",\n    enable_react=True,\n    k=3,\n)\n\n\n# Initialize the MonteCarloSearch class with the model\ntree_of_thoughts = MonteCarloSearch(model)\n\n# Define the initial prompt\ninitial_prompt = """\n\n\nInput: 2 8 8 14\nPossible next steps:\n2 + 8 = 10 (left: 8 10 14)\n8 / 2 = 4 (left: 4 8 14)\n14 + 2 = 16 (left: 8 8 16)\n2 * 8 = 16 (left: 8 14 16)\n8 - 2 = 6 (left: 6 8 14)\n14 - 8 = 6 (left: 2 6 8)\n14 /  2 = 7 (left: 7 8 8)\n14 - 2 = 12 (left: 8 8 12)\nInput: use 4 numbers and basic arithmetic operations (+-*/) to obtain 24 in 1 equation\nPossible next steps:\n"""\n\n# Define the number of thoughts to generate\nnum_thoughts = 1\nmax_steps = 3\nmax_states = 4\npruning_threshold = 0.5\n\n\n# Generate the thoughts\nsolution = tree_of_thoughts.solve(\n    initial_prompt=initial_prompt,\n    num_thoughts=num_thoughts,\n    max_steps=max_steps,\n    max_states=max_states,\n    pruning_threshold=pruning_threshold,\n    # sleep_time=sleep_time\n)\n\nprint(f"Solution: {solution}")\n\n```\n\n### Basic Prompts\n- Copy and paste this into your llm!\n\n```\n"Three experts with exceptional logical thinking skills are collaboratively answering a question using the tree of thoughts method. Each expert will share their thought process in detail, taking into account the previous thoughts of others and admitting any errors. They will iteratively refine and expand upon each other\'s ideas, giving credit where it\'s due. The process continues until a conclusive answer is found. Organize the entire response in a markdown table format. The task is:\n```\n\n\n\n# Acknowledgements\n\nThanks to: Shunyu Yao Princeton University, Dian Yu Google DeepMind, Jeffrey Zhao, Google DeepMind, Izhak Shafran Google DeepMind, Thomas L. Griffiths, Princeton University, Yuan Cao Google DeepMind, Karthik Narasimha, Princeton University for sharing this amazing work with the world!\n\nAnd, thanks to Phil Wang or Lucidrains for inspiring me to devote myself to open source AI Research\n\n# License\nApache',
    'author': 'Kye Gomez',
    'author_email': 'kye@apac.ai',
    'maintainer': 'None',
    'maintainer_email': 'None',
    'url': 'https://github.com/kyegomez/tree-of-thoughts',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'python_requires': '>=3.6,<4.0',
}


setup(**setup_kwargs)
