Python package to create langchain tool from the Tool Directory For LangChain.
Project description
pytool-directory
Python package to create the LangChain tool from the Tool Directory For LangChain.
Can create LangChain tool from definition in the Tool Directory.
Installation
pip install pytool-directory
Usage
- Search tools for your destination from Tool Directory For LangChain.
- Load tools from the name of integration.
from tool_directory import ToolLoader
tools = ToolLoader('openweather').get_tools(parameters={'appid': 'YOUR_APP_ID_FOR_OPENWEATHER'})
- Ask question to LLM with tools.
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
Use a tool for the OpenWeather API to get the weather information on specified location.
This example execute following conversation via ChatGPT.
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
- Fork and clone repository.
- Install development dependencies.
pip install '.[dev]'
- Install pre-commit hook for linter and formatter.
pre-commit install
- Commit your changes and send pull request.
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
pytool_directory-0.0.2.tar.gz
(5.8 kB
view hashes)
Built Distribution
Close
Hashes for pytool_directory-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fed08fdaad3fc87ddc6e0e3416fdab9f99400496e20e396b126fb3edcea7c90c |
|
MD5 | 755a5d3b5cbb1f9ba41282de335ea986 |
|
BLAKE2b-256 | a16995a8d8095415c4c66c56b529b89829748ce2785209d5af81f06493bc7614 |