0
0
LangChainframework~10 mins

Monitoring and alerting in production in LangChain - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the monitoring library.

LangChain
from langchain.monitoring import [1]
Drag options to blanks, or click blank then click option'
APrometheus
BMonitor
CAlertManager
DLogger
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Prometheus' which is a monitoring system but not imported directly here.
Using 'AlertManager' which is for alerts but not the main monitor class.
2fill in blank
medium

Complete the code to create a monitor instance for your LangChain app.

LangChain
monitor = [1]()
Drag options to blanks, or click blank then click option'
AAlertManager
BPrometheus
CLogger
DMonitor
Attempts:
3 left
💡 Hint
Common Mistakes
Trying to instantiate 'Logger' which is for logging, not monitoring.
Using 'Prometheus' which is not a class here.
3fill in blank
hard

Fix the error in the alert setup code by completing the missing alert type.

LangChain
monitor.setup_alert(alert_type='[1]', threshold=5)
Drag options to blanks, or click blank then click option'
Awebhook
Bsms
Cemail
Dlog
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'email' without configuring email server.
Using 'sms' which requires phone integration.
4fill in blank
hard

Fill both blanks to create a metric and register it with the monitor.

LangChain
metric = [1]('request_count', description='Count of requests')
monitor.[2](metric)
Drag options to blanks, or click blank then click option'
ACounter
BGauge
Cregister_metric
Dadd_metric
Attempts:
3 left
💡 Hint
Common Mistakes
Using Gauge which measures values that can go up and down.
Using 'register_metric' which is not the correct method name.
5fill in blank
hard

Fill all three blanks to create an alert rule for high latency.

LangChain
alert_rule = {
  '[1]': 'latency',
  'condition': lambda x: x [2] 1000,
  'action': '[3]'
}
Drag options to blanks, or click blank then click option'
Ametric
B>
Csend_alert
Dthreshold
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'threshold' as a key instead of 'metric'.
Using '<' instead of '>' in the condition.