Skip to content

How to add playground while using APIHandler? #467

Answered by eyurtsev
mesutgurlek asked this question in Q&A
Discussion options

You must be logged in to vote

When you use the APIHandler you are responsible for creating the endpoints. It provides flexibility to control the request path completely, but at the cost of extra work to create the endpoints manually.

add_routes is a wrapper around APIHandler to automatically register all the needed endpoints.

https://github.com/langchain-ai/langserve/blob/main/langserve/server.py#L231

Take a look at the code to see how it registers the playground endpoint.

Make sure to assign a correct path to the runnable when using APIHandler since that's needed to server playground assets.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mesutgurlek
Comment options

Answer selected by eyurtsev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants