import langchain
from langchain.cache import InMemoryCache
from langchain.chains import LLMChain
from langchain.llms import OpenAI
from langchain.prompts import PromptTemplate

langchain.llm_cache = InMemoryCache()


llm = OpenAI(temperature=0.9)
prompt = PromptTemplate(
    input_variables=["product"],
    template="What is a good name for a company that makes {product}?",
)


chain = LLMChain(llm=llm, prompt=prompt)

if __name__ == "__main__":
    # Run the chain only specifying the input variable.
    print(chain.run("colorful socks"))

langchain.chains.LLMChain langchain.prompts.PromptTemplate langchain.cache.InMemoryCache langchain.llms.OpenAI
[((199, 214), 'langchain.cache.InMemoryCache', 'InMemoryCache', ([], {}), '()\n', (212, 214), False, 'from langchain.cache import InMemoryCache\n'), ((223, 246), 'langchain.llms.OpenAI', 'OpenAI', ([], {'temperature': '(0.9)'}), '(temperature=0.9)\n', (229, 246), False, 'from langchain.llms import OpenAI\n'), ((256, 372), 'langchain.prompts.PromptTemplate', 'PromptTemplate', ([], {'input_variables': "['product']", 'template': '"""What is a good name for a company that makes {product}?"""'}), "(input_variables=['product'], template=\n    'What is a good name for a company that makes {product}?')\n", (270, 372), False, 'from langchain.prompts import PromptTemplate\n'), ((389, 421), 'langchain.chains.LLMChain', 'LLMChain', ([], {'llm': 'llm', 'prompt': 'prompt'}), '(llm=llm, prompt=prompt)\n', (397, 421), False, 'from langchain.chains import LLMChain\n')]