Langchain
Library for accessing different AI models and create agents
from langchain import OpenAI, ChatOpenAI, ConversationChain
llm1 = OpenAI(temperature=0)
# gpt-3.5-turbo also an option
llm2 = ChatOpenAI(temperature=0.9, model_name='gpt-4')
conversation = ConversationChain(llm=llm, verbose=True)
conversation.predict(input="Hi there!")Prompts
from langchain import PromptTemplate
template = """
I want you to act as a naming consultant for new companies.
Here are some examples of good company names:
- search engine, Google
- social media, Facebook
- video sharing, YouTube
The name should be short, catchy and easy to remember.
What is a good name for a company that makes {product}?
"""
prompt = PromptTemplate(
input_variables=["product"],
template=template,
)
chain = LLMChain(llm=llm, prompt=prompt)
chain.run("Interdimensial AI News")Incontext Learning
Other Example
Tools
Last updated