Demonstrate the use of conditionals in LangGraph
Sushma Rao
Expert Vetted freelancer on Upwork(Top 1%) | Backend & GenAI | Langchain Langgraph LLM| AI ML development/Automation | Algorithms expert| Cloud development I help clients get more business through software development
Use case: Symptoms and diagnosis Medical chatbot Document retrieval is presented to the doctor for further analysis
What’s New in this article?
Pre-requisites
Flow design and diagram
The flow of the code is as follows:
领英推荐
LangGraph
The graph is designed to retrieve, and grade documents, generate answers, and classify them into useful and not useful. In scenarios where it is not useful, the fallback mechanism is activated and results are used as a final answer.
The output of the code with various questions is here
Conclusion
By using the approaches demonstrated one can create as many conditionals in langgraph to ensure the accuracy of the output. Various thresholds for evaluating the results can be set. Confidence scores, and relevance scores(>0.8 in the pre-trained model). One can switch to different models with better results.
Data & AI Leader | Supply Chain, Manufacturing & Commercial | GenAI & AI at Scale | Digital Transformation | Cloud & Data Modernization | $100MM+ Value Creator | AI Strategy & Innovation | COE Builder | Business Partner
5 个月Interesting!