Files
langchain/docs/examples/chains/llm_bash.ipynb
2022-12-07 08:40:08 -08:00

1.9 KiB

BashChain

This notebook showcases using LLMs and a bash process to do perform simple filesystem commands.

In [2]:
from langchain.chains import LLMBashChain
from langchain.llms import OpenAI

llm = OpenAI(temperature=0)

text = "Please write a bash script that prints 'Hello World' to the console."

bash_chain = LLMBashChain(llm=llm, verbose=True)

bash_chain.run(text)
Out [2]:

> Entering new LLMBashChain chain...
Please write a bash script that prints 'Hello World' to the console.

```bash
echo "Hello World"
```['```bash', 'echo "Hello World"', '```']

Answer: Hello World

> Finished LLMBashChain chain.
'Hello World\n'
In [ ]: