Created
April 10, 2023 03:18
-
-
Save rajtilakjee/25eab349552a7550f731e2b33603e2b8 to your computer and use it in GitHub Desktop.
LangChain to control Terminal using Bash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from langchain.agents.agent_toolkits import create_python_agent | |
from langchain.tools.python.tool import PythonREPLTool | |
from langchain.python import PythonREPL | |
from langchain.llms.openai import OpenAI | |
from langchain.agents import load_tools | |
from langchain.utilities import BashProcess | |
bash = BashProcess() | |
agent_executor = create_python_agent( | |
llm=OpenAI(temperature=0, max_tokens=1000), | |
tool=PythonREPLTool(), | |
verbose=True | |
) | |
agent_executor.run("""You have access to the terminal through the bash variable. Open the browser, go to youtube and search for Lex Fridman. Then write the text contents from the page into a file called page.txt""") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment