GenAI with Python: Construct Agents from Scratch (Complete Tutorial)

-

with Ollama, LangChain, LangGraph (No GPU, No APIKEY)

Photo by Mathieu Stern on Unsplash

(All images are by the writer unless otherwise noted)

Intro

Prompt Engineering is the practice of designing and refining prompts (text inputs) to boost the behavior of Large Language Models (LLMs). The goal is to get the specified responses from the model by rigorously crafting the instructions. Essentially the most used prompting techniques are:

  • Chain-of-Thought: involves generating a step-by-step reasoning process to achieve a conclusion. The model is pushed to “think out loud” by explicitly laying out the logical steps that result in the ultimate answer.
  • ReAct (Reason+Act): combines reasoning with motion. The model not only thinks through an issue but in addition takes actions based on its reasoning. So it’s more interactive because the model alternates between reasoning steps and actions, refining its approach iteratively. Mainly, it’s a loop of “thought”, “motion”, “commentary”.

Let’s make an example: imagine asking an AI to “find one of the best laptop under $1000”.

Normal Answer: “Lenovo Thinkpad”.

– Chain-of-Thought Answer: “I would like to contemplate aspects like performance, battery life, and…

ASK ANA

What are your thoughts on this topic?
Let us know in the comments below.

0 0 votes
Article Rating
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Share this article

Recent posts

0
Would love your thoughts, please comment.x
()
x