Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to import the LangSmith tracer.
LangChain
from langchain.tracing import [1]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Importing a non-existent class like 'LangTracer' or 'SmithTracer'.
Using a generic name like 'Tracer' which is not the correct class.
✗ Incorrect
The correct import is LangSmithTracer from langchain.tracing.
2fill in blank
mediumComplete the code to enable LangSmith tracing in LangChain.
LangChain
import [1] [1].tracing_enabled = True
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Trying to set tracing on
langsmith or tracing modules.Using the tracer class name instead of the module name.
✗ Incorrect
You enable tracing by setting tracing_enabled to True on the langchain module.
3fill in blank
hardFix the error in initializing the LangSmith tracer with the API key.
LangChain
tracer = LangSmithTracer(api_key=[1]) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the API key without quotes causing a NameError.
Passing None or a wrong variable name.
✗ Incorrect
The API key must be passed as a string, so it needs quotes around it.
4fill in blank
hardFill both blanks to set the tracer and enable tracing in LangChain.
LangChain
import [1] from langchain.tracing import [2] [1].tracer = [2](api_key='YOUR_API_KEY') [1].tracing_enabled = True
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up module and class names.
Forgetting to enable tracing after setting the tracer.
✗ Incorrect
You import langchain and LangSmithTracer, then set the tracer and enable tracing.
5fill in blank
hardFill all three blanks to create a LangChain client with LangSmith tracing enabled.
LangChain
import [1] from langchain.tracing import [2] [1].tracer = [2](api_key='YOUR_API_KEY') [1].tracing_enabled = True client = [1].Client()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong tracer class names like
LangChainTracer.Not enabling tracing before creating the client.
✗ Incorrect
You import langchain and LangSmithTracer, set the tracer and enable tracing on langchain, then create a client from langchain.Client().