चैटबॉट प्रतिक्रियाएँ जनरेट करना

LangChain के साथ Agentic Systems डिज़ाइन करना

Dilini K. Sumanapala, PhD

Founder & AI Engineer, Genverv, Ltd.

ग्राफ इवेंट्स की स्ट्रीमिंग

   

  • रियल-टाइम में इवेंट स्ट्रीम करें

  • हर इवेंट एक वर्कफ़्लो स्टेप है

  • प्रतिक्रियाएँ और टूल कॉल ट्रैक करें

  • चैटबॉट प्रोग्रेस ट्रैक करें

User: Where is the Congo?

Agent: आपके लिए कुछ विवरण जाँच लेता हूँ...
Agent: AIMessage([Tool Call to Google Maps] "the Congo" पर जानकारी खोज रहा है)
Agent: The Democratic Republic of Congo मध्य अफ्रीका में एक देश है.
LangChain के साथ Agentic Systems डिज़ाइन करना

LLM प्रतिक्रियाओं की स्ट्रीमिंग

# Define a function to execute the chatbot based on user input
def stream_graph_updates(user_input: str):


# Start streaming events from the graph with the user's input for event in graph.stream({"messages": [("user", user_input)]}):
# Retrieve and print the chatbot node responses for value in event.values(): print("Agent:", value["messages"])
# Define the user query and run the chatbot user_query = "Who is Mary Shelley?" stream_graph_updates(user_query)
LangChain के साथ Agentic Systems डिज़ाइन करना

LLM प्रतिक्रियाओं की स्ट्रीमिंग

   Agent: [AIMessage(content='Mary Shelley (1797-1851) एक अंग्रेज़ी 
   novelist...

...जो Gothic शैली में अपने अग्रणी कार्य के लिए जानी जाती हैं, खासकर उनके उपन्यास "Frankenstein; or, The Modern Prometheus," जो 1818 में प्रकाशित हुआ. यह उपन्यास अक्सर शुरुआती science fiction उदाहरणों में गिना जाता है और सृजन, ज़िम्मेदारी, और मानवता की प्रकृति जैसे विषयों की पड़ताल करता है, Victor Frankenstein की कहानी के माध्यम से, जो एक असामान्य प्रयोग में एक संवेदनशील प्राणी बनाता है...',
response_metadata={'finish_reason': 'stop', 'model_name': 'gpt-4o-mini-...')]
LangChain के साथ Agentic Systems डिज़ाइन करना

LLMs और hallucinations

Agent: [AIMessage(content='Judith 
Love Cohen एक अमेरिकी aerospace 
engineer थीं, और कई 
space missions पर काम किया, जिनमें Apollo 
program शामिल है... Cohen अभिनेता और लेखक Adam Cohen 
की माँ भी थीं, 
जिन्होंने उनके प्रभाव के बारे में अपनी ज़िंदगी और करियर पर 
बात की है. 
additional_kwargs={}, 
response_metadata={'finish_reason': 
'stop', 'model_name': 
'gpt-4o-mini-...)

   

उदाहरण hallucination

 

  • Judith Love Cohen का मशहूर बेटा Jack Black है, न कि "Adam Cohen".
LangChain के साथ Agentic Systems डिज़ाइन करना

LangGraph डायग्राम जनरेट करें

# Import modules for chatbot diagram
from IPython.display import 
Image, display


# Try generating and displaying # the graph diagram try: display(Image(graph.get_graph() .draw_mermaid_png()))
# Return an exception if necessary except Exception: print("Additional dependencies required.")

बेसिक चैटबॉट LangGraph डायग्राम.

LangChain के साथ Agentic Systems डिज़ाइन करना

अभ्यास करते हैं!

LangChain के साथ Agentic Systems डिज़ाइन करना

Preparing Video For Download...