generative-ai-cdk-constructs
generative-ai-cdk-constructs copied to clipboard
(New Construct): LangServ Support
Describe the feature
This construct deploys Langserv a FastAPI based framework that helps developers deploy LangChain's Runnables and Chains as REST API in production.
Use Case
Langserv simplifies the deployment of Large language Models from a prototype to production with industry best practices such as
- API docs page with JSONSchema and Swagger
- Efficient /invoke/, /batch/ and /stream/ endpoints with support for many concurrent requests on a single server
- All built with battle-tested open-source Python libraries like FastAPI, Pydantic, uvloop and asyncio
- FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.8+ based on standard Python type hints.
- Observability and Analytics
- LLM Provider Agnostic
Proposed Solution
At a high level this construct will deploy LangServ and LangFuse on AWS using Services such as Fargate, ECS and RDS but will depend on existing constructs such as aws_ecs_patterns. Developers will be able to make custom REST api calls to FastAPI endpoints with support for streaming, batch and invoke. The construct will be LLM provider agnostic such as Bedrock, SageMaker or VLLM on EC2 Instances giving developers flexibility to experiment with different model providers. The construct will also provide monitoring and observability capability using LangFuse giving developers the flexibility to trace and debug LLM applications, monitor latency and model evaluation capabilities.
No response
Other Information
No response
Acknowledgements
- [X] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
### Tasks
Thank you for the suggestion @tech4life87 ! Do you mind describing a few things for us:
- At a high level, how do you propose deploying and running LangServe on AWS? (i.e. what resources, services, etc.)
- Is a LangServe construct related to or enhanced by existing constructs, and if so, how?
- At a high level, do you propose that users should be able to make custom REST APIs with LangServe, and if so, what would be the "entrypoint" for providing their Chains and Runnables?
@laithalsaadoon I just updated the issue with these details.
Hi @tech4life87 , thank your for this suggestion, looks very interesting !
- Do you have an idea of the interface for this construct ?
- Could you walk me through the developer workflow for this construct ?
@tech4life87 any update on this one ?
@krokoko
-
Yes I have an idea of how this would work from my previous work on the same thing.
-
From a developer experience/flow perspective there are two possible paths and I am open to refining it.
- Developer imports the constructs which default to pulling the container from a public ecr repo.
- They do local development and local testing.
- during CDK deploy the container is packaged and deployed to ECS.
options2:
- Developer create a local langserve application.
- The developer then does local development and testing.
- Using the local Dockefile the construct packages the code and deploys to ECS.
I open to ideas of what other developers have done to improve dev experience when it comes to fargate based constructs.
great @tech4life87 , thanks ! I see you mentioned you may be able to implement this feature, would you be able to create a draft of this construct in a branch ?
great @tech4life87 , thanks ! I see you mentioned you may be able to implement this feature, would you be able to create a draft of this construct in a branch ?
Yes I will start working on it
Thank you @tech4life87 ! I will assign the ticket to you for now
Hi @tech4life87 , any update on this ? Thank you !
This issue is now marked as stale because it hasn't seen activity for a while. Add a comment or it will be closed soon. If you wish to exclude this issue from being marked as stale, add the "backlog" label.
@krokoko sorry been super busy with customer project that just completed last week. will resume work on this starting next week
Closing as no activity, @tech4life87 feel free to reopen if you still work on this. Thank you !