0% found this document useful (0 votes)
19 views1 page

Langchain 02 Chaining

Uploaded by

smarteddy17
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views1 page

Langchain 02 Chaining

Uploaded by

smarteddy17
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

In [ ]: %pip install google-cloud-aiplatform

%pip install langchain

In [ ]: from langchain.llms import VertexAI


from langchain import LLMChain
from langchain import PromptTemplate

llm = VertexAI()

template = """List ONLY 1 DevOps Tool related to {topic}. List only the name of the tool.

EXAMPLE: TOOL_NAME

YOUR RESPONSE:
"""

prompt_template = PromptTemplate(input_variables=["topic"], template=template)

tool_chain = LLMChain(llm=llm, prompt=prompt_template)

In [ ]: template = """Write a short summary about {tool}

YOUR RESPONSE:
"""
prompt_template = PromptTemplate(input_variables=["tool"], template=template)

summary_chain = LLMChain(llm=llm, prompt=prompt_template)

In [ ]: from langchain.chains import SimpleSequentialChain

complete_chain = SimpleSequentialChain(chains=[tool_chain, summary_chain], verbose=True)

#summary = complete_chain.run("Continuous Integration")

summary = complete_chain.run("Infrastructure as Code")

#summary = complete_chain.run("Container Orchestration")

You might also like