Metadata-Version: 2.1
Name: pytool-directory
Version: 0.0.2
Summary: Python package to create langchain tool from the Tool Directory For LangChain.
Author: Sheile
License: MIT
Project-URL: Homepage, https://github.com/dialogplay/pytool-directory
Project-URL: Bug Tracker, https://github.com/dialogplay/pytool-directory/issues
Project-URL: Source, https://github.com/dialogplay/pytool-directory
Keywords: langchain,gpt,dialogplay
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pydantic
Requires-Dist: requests
Requires-Dist: openai
Requires-Dist: langchain
Requires-Dist: PyYAML
Provides-Extra: dev
Requires-Dist: pre-commit; extra == "dev"
Requires-Dist: flake8; extra == "dev"
Requires-Dist: pyproject-flake8; extra == "dev"
Requires-Dist: flake8-quotes; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: pytest-describe; extra == "dev"
Requires-Dist: pytest-watcher; extra == "dev"
Requires-Dist: requests-mock; extra == "dev"

pytool-directory
=========================
[![Unittest](https://github.com/dialogplay/pytool-directory/actions/workflows/unittest.yaml/badge.svg)](https://github.com/dialogplay/pytool-directory/actions/workflows/unittest.yaml)

Python package to create the [LangChain](https://github.com/langchain-ai/langchain) tool from the [Tool Directory For LangChain](https://github.com/dialogplay/tool-directory/).

Can create LangChain tool from definition in the Tool Directory.

Installation
-------------------------
```bash
pip install pytool-directory
```

Usage
-------------------------
1. Search tools for your destination from [Tool Directory For LangChain](https://github.com/dialogplay/tool-directory).
2. Load tools from the name of integration.
```python
from tool_directory import ToolLoader
tools = ToolLoader('openweather').get_tools(parameters={'appid': 'YOUR_APP_ID_FOR_OPENWEATHER'})
```
3. Ask question to LLM with tools.
```python
llm = ChatOpenAI(temperature=0, model_name='gpt-4')
agent = initialize_agent(tools, llm, agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION, verbose=True)
answer = agent('Please tell me about the temperature in tokyo.')
```

Examples
-------------------------
### [langchain_with_tools.py](https://github.com/dialogplay/pytool-directory/blob/main/examples/langchain_with_tools.py)
Use a tool for the OpenWeather API to get the weather information on specified location.

This example execute following conversation via ChatGPT.

```text
User: Please tell me about the temperature in tokyo.
Bot: The current temperature in Tokyo is 29.54°C, but it feels like 32.72°C. The minimum and maximum temperatures today are 27.74°C and 30.45°C respectively. The humidity is 64%.
```

Contribution
-------------------------
1. Fork and clone repository.
2. Install development dependencies.
```bash
pip install '.[dev]'
```

3. Install pre-commit hook for linter and formatter.
```bash
pre-commit install
```

4. Commit your changes and send pull request.
