0
0
LangChainframework~20 mins

LangChain ecosystem (LangSmith, LangGraph, LangServe) - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
LangChain Ecosystem Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
component_behavior
intermediate
1:30remaining
What is the primary role of LangSmith in the LangChain ecosystem?

LangSmith is a part of the LangChain ecosystem. What does it mainly help developers do?

AIt serves as a hosting platform for deploying language model APIs.
BIt provides tools for tracking, evaluating, and debugging language model runs.
CIt is a visualization tool for creating flowcharts of language model chains.
DIt is a database system optimized for storing large text corpora.
Attempts:
2 left
💡 Hint

Think about monitoring and improving model outputs.

📝 Syntax
intermediate
2:00remaining
Which code snippet correctly creates a LangGraph to visualize a chain?

Choose the code that correctly initializes a LangGraph object and adds a simple chain for visualization.

A
from langchain.graphs import LangGraph
graph = LangGraph()
graph.add_chain(my_chain)
graph.render()
B
from langchain.graph import LangGraph
graph = LangGraph()
graph.add(my_chain)
graph.show()
C
import langchain.graphs as lg
graph = lg.LangGraph()
graph.insert_chain(my_chain)
graph.display()
D
from langchain.graphs import LangGraph
graph = LangGraph(my_chain)
graph.render()
Attempts:
2 left
💡 Hint

Check the correct import path and method names for LangGraph.

state_output
advanced
2:00remaining
What is the output of this LangServe server code when a POST request with text 'Hello' is sent?

Consider this LangServe server code snippet:

from langchain.servers import LangServe

app = LangServe()

@app.route('/process')
async def process(request):
    data = await request.json()
    text = data.get('text', '')
    return {'response': text.upper()}

What will the server respond with when it receives a POST request to '/process' with JSON body {"text": "Hello"}?

LangChain
from langchain.servers import LangServe

app = LangServe()

@app.route('/process')
async def process(request):
    data = await request.json()
    text = data.get('text', '')
    return {'response': text.upper()}
ATypeError: 'NoneType' object is not subscriptable
B{"response": "Hello"}
C{"response": "HELLO"}
DSyntaxError: invalid syntax in async function
Attempts:
2 left
💡 Hint

Look at how the text is transformed before returning.

🔧 Debug
advanced
2:00remaining
Which option causes a runtime error when using LangSmith to log a run?

Given this code snippet to log a run in LangSmith:

from langchain_experimental.langsmith import Client
client = Client()
run = client.start_run(name="TestRun")
run.log_output(output)
run.end()

Which option below will cause a runtime error?

LangChain
from langchain_experimental.langsmith import Client
client = Client()
run = client.start_run(name="TestRun")
run.log_output(output)
run.end()
Aoutput is an integer and run.log_output(output) works fine.
Boutput is a string 'Result data' and run.log_output(output) works fine.
Coutput is a dictionary and run.log_output(output) works fine.
Doutput is None and run.log_output(output) raises AttributeError.
Attempts:
2 left
💡 Hint

Consider what happens if output is None when calling log_output.

🧠 Conceptual
expert
2:30remaining
How do LangServe and LangGraph complement each other in a LangChain application?

In a LangChain app, LangServe is used to deploy language model APIs, and LangGraph is used to visualize chains. How do these two components work together effectively?

ALangServe hosts the API endpoints while LangGraph helps developers visualize and debug the chain flows that the API serves.
BLangServe automatically generates graphs for LangGraph to display without developer input.
CLangGraph deploys the API and LangServe visualizes the chain execution.
DLangServe and LangGraph are unrelated and cannot be used together.
Attempts:
2 left
💡 Hint

Think about deployment vs visualization roles.