Prompt engineering with LangChain: Prompt Selection with AI and LLMs

preview_player
Показать описание
Join Richard Walker from Lucidate as he guides you through an in-depth exploration of Prompt Engineering and LangChain - essential tools for AI-driven decision-making in today's complex financial landscape. Understand how diverse prompt techniques, including Chain of Thoughts, Tree of Thoughts, Self-Consistency, and ReAct prompts, can transform the way we approach problem-solving in the realm of artificial intelligence.

This video demystifies Prompt Selection, an innovative approach that enables AI systems to determine the optimal prompt engineering strategy based on the problem at hand. We'll showcase the utilization of specialized Large Language Models (LLMs) such as GPT, Orca, Falcon, BloombergGPT, and BioGPT, to provide tailored responses for a range of scenarios.

Watch a practical demonstration of this system in action, featuring real-world problems from seminal research papers. For senior-level Lucidate members, we offer an exclusive code walkthrough to help you implement these strategies in your business. Write LangChain agents and LangChain prompt templates in python.

Uncover the potential of AI in the world of business, as LangChain facilitates seamless integration of AI applications, document sources, and conventional applications.

0:00 - Introduction
0:13 - Importance of Different Prompt Techniques
1:30 - Review of Forest of Thoughts
2:00 - How to Choose the Right Technique with Prompt selection
2:36 - The Prompt Selection Prompt
3:10 - Prompt selection in action
3:53 - Demo application
6:17 - Future development
7:19 - Code on GitHub
8:24 - Closing and Additional Resources

We invite you to explore the code on our GitHub (link below) and welcome your insights and comments. Be sure to like this video and subscribe to our channel for more insightful content. For an even deeper understanding of these applications, consider joining Lucidate.

For more details:
🔗 Code on GitHub:

🔗 Join Lucidate:

Prompt selector prompt:
Consider the following problem or puzzle: {question}. Based on the characteristics of the problem, identify the most suitable approach among the three techniques described below :
1. This technique involves searching for new information, generating reasoning traces and task-specific actions in an interleaved manner. Starting with incomplete information this technique will prompt for the need to get additional helpful information at each step. It allows for dynamic reasoning to create, maintain, and adjust high-level plans for acting, while also interacting with external sources to incorporate additional information into reasoning [1].
2. This technique involves exploring multiple reasoning paths. It treats the problem as a search over a tree structure, with each node representing a partial solution and the branches corresponding to operators that modify the solution. It involves thought decomposition, thought generation, state evaluation, and a search algorithm [2].
3. This technique focuses on generating a coherent series of intermediate reasoning steps that lead to the final answer. It mimics a step-by-step thought process similar to how humans solve complex problems. The approach provides interpretability, decomposes multi-step problems into intermediate steps, and allows for additional computation allocation [3].
Based on the characteristics of the given problem or puzzle, select the technique that aligns most closely with the nature of the problem. It is important to first provide the number of the technique that best solves the problem, followed by a period. Then you may provide your reason why you have chosen this technique.
Рекомендации по теме
Комментарии
Автор

Great stuff. Really love your videos. Here is my version of the prompt, which was simply to prompt the prompter on the best prompt to prompt further. As expected it preferred one/few-shot and/or more summarization::

"Prompt selector prompt:
Consider the following problem or puzzle: {question}. Based on the characteristics of the problem, identify the most suitable approach among the three techniques described below:

ReAct Technique: This technique involves searching for new information, generating reasoning traces, and task-specific actions in an interleaved manner. Starting with incomplete information, this technique will prompt for the need to get additional helpful information at each step. It allows for dynamic reasoning to create, maintain, and adjust high-level plans for acting, while also interacting with external sources to incorporate additional information into reasoning. This technique is best suited for problems requiring active inquiry and iterative refinement of solutions [1].

Tree-of-Thoughts Technique: This technique involves exploring multiple reasoning paths. It treats the problem as a search over a tree structure, with each node representing a partial solution and the branches corresponding to operators that modify the solution. It involves thought decomposition, thought generation, state evaluation, and a search algorithm. This technique is best suited for problems that can be broken down into sub-problems, each with its own set of potential solutions [2].

Chain-of-Thoughts Technique: This technique focuses on generating a coherent series of intermediate reasoning steps that lead to the final answer. It mimics a step-by-step thought process similar to how humans solve complex problems. The approach provides interpretability, decomposes multi-step problems into intermediate steps, and allows for additional computation allocation. This technique is best suited for problems requiring a sequence of interrelated steps or calculations [3].

Based on the characteristics of the given problem or puzzle, select the technique that aligns most closely with the nature of the problem. It is important to first provide the number of the technique that best solves the problem, followed by a period. Then you may provide your reason why you have chosen this technique."

interspacer
Автор

This is exactly what i was looking for/thinking about ❤

lokiholland
Автор

This is the very problem that I am working on! Good video. I thought I would start at prompt rewriting first. That is sending the prompt to a dedicated model for prompt rewriting to a more suitable format, THEN sending the prompt down the right path. I am still working to get the AMD and the NVIDIA GPU's to play nice.

Dr_Tripper
Автор

If you provide the LLM Aggregator with the prompt type selected and your assessment of the answer, it can go back and make improvement edits to the Decision Prompt.

i_accept_all_cookies
Автор

Great work! Your becoming one of my go to places for LLM understanding🥳🦾🤩

klammer
Автор

2:27 why is her monitor facing the wrong way?

austinduke
Автор

A suggestion, not sure it’s an improvement but if anyone has any success with it or refines it further, please let me know.

Imagine you are faced with a problem or puzzle that requires careful consideration and the selection of an appropriate problem-solving technique. Your goal is to evaluate the given problem's characteristics and choose the most suitable technique among the three options described below. Additionally, you need to provide a clear reason for your choice. Let's work through the process step by step, incorporating both chain of thought and tree of thought reasoning.

Consider the following steps to evaluate and select the technique:

Step 1: Problem Evaluation
- Clearly define the problem or puzzle you are presented with.

Step 2: Technique Descriptions
- Review the three techniques below, each labeled with a number, and consider their descriptions carefully:

1. Technique 1:
- This technique involves interleaved search for new information, reasoning traces, and task-specific actions.
- It prompts the need for additional helpful information at each step.
- Dynamic reasoning and interaction with external sources are key features.

2. Technique 2:
- This technique treats the problem as a search over a tree structure.
- Each node represents a partial solution, and branches correspond to solution-modifying operators.
- Thought decomposition, thought generation, state evaluation, and a search algorithm play essential roles.

3. Technique 3:
- This technique focuses on generating a coherent series of intermediate reasoning steps.
- It mimics a step-by-step thought process similar to how humans solve complex problems.
- The approach provides interpretability, decomposition of multi-step problems, and allows for additional computation allocation.

Step 3: Tree of Thought Reasoning
- For each technique, utilize tree of thought reasoning to evaluate its suitability by considering the branches of thought, sub-branches, factors, potential outcomes, advantages, disadvantages, and connections.

Step 4: Technique Selection
- Based on your evaluation, select the technique number that aligns most closely with the characteristics of the given problem.
- Clearly state the technique number and follow it with a period.

Step 5: Reasoning Explanation
- Provide a concise and coherent reason for your choice, highlighting the key insights and relationships you've identified during

StoutProper
Автор

It would be nice if you can do a code run through!

xfloryx
Автор

Instead of asking an LLM to select an appropriate reasoning model, what if each "agent" has its own model and we have them reason among themselves (e.g., expanding and narrowing the possibility space) to come up with the best possible answer/solution. If the solution created by these "producers" has an end user, we can also have it "judged" by the opposite panel of users using the same process? Let's say there's a problem to a project, we get these "producer agents" to come up with a solution and then ask the LLM to take on the roles of the "user agents" and the values/priority of the project specification and critique the solution. This could even be fed back into a loop to initiate another round of brainstorming with positive/negative feedback to add/reduce weight to a particular agent's output. Okay, I'm just rambling at this point lol.

neoleegdg