langchain-ai / langserve

LangServe 🦜️🏓
Other
1.89k stars 211 forks source link

[RFC] Introduce Pluto as a deployment option for LangServe apps #659

Closed jianzs closed 2 weeks ago

jianzs commented 4 months ago

Hi, I am working on a project called Pluto, which is a cloud-native application development tool. It simplifies cloud application development by providing a streamlined programming interface for leveraging cloud features and building business logic. Developers can define their dependent services and resources, such as Lambda, Bucket, and etc. by defining a variable. Pluto will automatically provision the resources and deploy the application to the cloud. Developer use the Pluto without need to learn complex cloud technologies, such as Terraform, Pulumi or AWS CDK.

To help the LangServe app developers that don't have much experience with cloud to deploy their apps on the cloud. I have added a new section in the README.md file to introduce Pluto as a deployment option for LangServe apps.

In summary, there are two steps to adapt the LangServe application to the Pluto application so that Pluto can deploy it to AWS.

  1. First, put the code related to the FastAPI app into a function and make this function return the FastAPI app instance. Here we assume that the function name is return_fastapi_app.
  2. Then, replace the entire if __name__ == "__main__" code block with the following 4 statements. The router_name can be modified. It is related to the name of the Api Gateway instance created on AWS.
from mangum import Mangum
from pluto_client import Router

router = Router("router_name")
router.all("/*", lambda *args, **kwargs: Mangum(return_fastapi_app(), api_gateway_base_path="/dev")(*args, **kwargs), raw=True)

For more information, please refer to this link.

I'm not entirely sure if this is an optimal interface for developing LangServe applications. Do you believe it's an effective method for LangServe app developers to deploy their applications in the cloud? I would appreciate any suggestions or queries that you might have. Thank you!

cla-bot[bot] commented 4 months ago

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have the username @jianzs on file. In order for us to review and merge your code, please complete the Individual Contributor License Agreement here https://forms.gle/AQFbtkWRoHXUgipM6 .

This process is done manually on our side, so after signing the form one of the maintainers will add you to the contributors list.

For more details about why we have a CLA and other contribution guidelines please see: https://github.com/langchain-ai/langserve/blob/main/CONTRIBUTING.md.

eyurtsev commented 2 weeks ago

Hi @jianzs thanks for the PR -- I don't have an interest in adding this into the docs for now.