chapter1 (1)
chapter1 (1)
ecosystem
D E V E L O P I N G L L M A P P L I C AT I O N S W I T H L A N G C H A I N
Jonathan Bennion
AI Engineer & LangChain Contributor
Meet your instructor...
Contributor to DeepEval
1 https://arxiv.org/pdf/2303.18223.pdf
Data sources
2. Navigate to
https://huggingface.co/settings/tokens
in the rain?
Yes, you can still have fun in the without spending a lot of money?
rain! There are plenty of
Yes, you can still have fun without
spending a lot of money. You could do
activities like hiking, biking, playing
sports, going to the beach, camping...
Examples:
Automate tasks
Data analysis
Jonathan Bennion
AI Engineer & LangChain Contributor
Finding the right model
1 https://huggingface.co/models?pipeline_tag=question-answering&sort=trending
template = "You are an artificial intelligence assistant, answer the question. {question}"
prompt_template = PromptTemplate(template=template, input_variables=["question"])
text='You are an artificial intelligence assistant, answer the question. What is LangChain?'
LangChain is an artificial intelligence language model that uses a neural network to generate human-like text
prompt_template = ChatPromptTemplate.from_messages(
[
("system", "You are soto zen master Roshi."),
("human", "What is the essence of Zen?"),
("ai", "When you are hungry, eat. When you are tired, sleep.")
("human", "Respond to the question: {question}")
]
)
The sound of one hand clapping is not something that can be easily explained or
understood through words alone. It is a question that has been pondered by Zen
practitioners for centuries, and its purpose is to provoke a deeper inquiry into
the nature of reality and the self. In Zen practice, we often engage...
Jonathan Bennion
AI Engineer & LangChain Contributor
Limitations of standard prompt templates
PromptTemplate + ChatPromptTemplate
examples = [
Handling small numbers of examples {
"question": "..."
Don't scale to larger numbers
"answer": "..."
FewShotPromptTemplate
},
...
]
prompt_template = FewShotPromptTemplate(
examples=examples,
examples : the list of dicts
example_prompt=example_prompt,
suffix="Question: {input}", example_prompt : formatted template
input_variables=["input"] suffix : suffix to add to the input
)
input_variables