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 मध्य अफ्रीका में एक देश है.
# 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)
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-...')]
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-...)
# 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.")

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