0
0
LangChainframework~10 mins

LangServe for API deployment 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 LangServe class from langchain.servers.

LangChain
from langchain.servers import [1]
Drag options to blanks, or click blank then click option'
ALangServe
BLangChain
CServerAPI
DLangServer
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'LangChain' instead of 'LangServe'.
Using 'LangServer' which is incorrect.
2fill in blank
medium

Complete the code to create a LangServe instance with a given chain named 'my_chain'.

LangChain
server = LangServe(chain=[1])
Drag options to blanks, or click blank then click option'
Aserver
Bmy_chain
Cchain
Dapi
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the string 'chain' instead of the variable.
Using 'server' which is the LangServe instance itself.
3fill in blank
hard

Fix the error in the code to start the LangServe API server.

LangChain
server.[1]()
Drag options to blanks, or click blank then click option'
Astart
Brun
Claunch
Dserve
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'run' or 'start' which are common but incorrect here.
4fill in blank
hard

Fill both blanks to define a simple LangServe API with a chain and start it.

LangChain
from langchain.servers import [1]
server = [2](chain=my_chain)
server.serve()
Drag options to blanks, or click blank then click option'
ALangServe
BLangChain
CServerAPI
DLangServer
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing import and instance names.
Using 'LangChain' or 'LangServer' instead.
5fill in blank
hard

Fill all three blanks to create a LangServe server with a chain, specify a port, and start the server.

LangChain
from langchain.servers import [1]
server = [2](chain=my_chain, port=[3])
server.serve()
Drag options to blanks, or click blank then click option'
ALangServe
BLangChain
C8080
D5000
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong class names.
Choosing port 8080 which is valid but not the expected answer here.