* updates needed for demo Signed-off-by: Chun Tao <chun.tao@intel.com> * original pr content Signed-off-by: Chun Tao <chun.tao@intel.com> * Revert "updates needed for demo" This reverts commit f0c7a026305ace410610c9dba771699e13dde8ea. Signed-off-by: Chun Tao <chun.tao@intel.com> * remove improper images Signed-off-by: Chun Tao <chun.tao@intel.com> * Addressed some comments on previous pr Signed-off-by: Chun Tao <chun.tao@intel.com> * Add Dockerfile for cpu support Signed-off-by: Chun Tao <chun.tao@intel.com> * CODEOWNER: Update comp CODEOWNER (#757) Signed-off-by: Yeoh, Hoong Tee <hoong.tee.yeoh@intel.com> Signed-off-by: Chun Tao <chun.tao@intel.com> * Add stable diffusion microservice (#729) * add stable diffusion microservice. Signed-off-by: Ye, Xinyu <xinyu.ye@intel.com> * added test. Signed-off-by: Ye, Xinyu <xinyu.ye@intel.com> * changed output to images bytes data Signed-off-by: Ye, Xinyu <xinyu.ye@intel.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * unified inference and wrapper into one microservice. Signed-off-by: Ye, Xinyu <xinyu.ye@intel.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix test. Signed-off-by: Ye, Xinyu <xinyu.ye@intel.com> --------- Signed-off-by: Ye, Xinyu <xinyu.ye@intel.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Signed-off-by: Chun Tao <chun.tao@intel.com> * Compatible with different platforms. (#766) * Compatible with different platforms. Signed-off-by: ZePan110 <ze.pan@intel.com> * Fix issue. Signed-off-by: ZePan110 <ze.pan@intel.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix issue Signed-off-by: ZePan110 <ze.pan@intel.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Signed-off-by: ZePan110 <ze.pan@intel.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Signed-off-by: Chun Tao <chun.tao@intel.com> * Optimize path and link validity check. (#745) Signed-off-by: ZePan110 <ze.pan@intel.com> Signed-off-by: Chun Tao <chun.tao@intel.com> * Add timeout for ut test (#773) Signed-off-by: chensuyue <suyue.chen@intel.com> Signed-off-by: Chun Tao <chun.tao@intel.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Signed-off-by: Chun Tao <chun.tao@intel.com> * test hyperlink Signed-off-by: Chun Tao <chun.tao@intel.com> * test hyperlink Signed-off-by: Chun Tao <chun.tao@intel.com> * test hyperlink issue Signed-off-by: Chun Tao <chun.tao@intel.com> * test hyperlink issue Signed-off-by: Chun Tao <chun.tao@intel.com> * put back hyperlinks in readme Signed-off-by: Chun Tao <chun.tao@intel.com> * remove possible error hyperlink Signed-off-by: Chun Tao <chun.tao@intel.com> * put hyperlink back Signed-off-by: Chun Tao <chun.tao@intel.com> * major update to use FastAPI for wav2lip, and structure component format Signed-off-by: Chun Tao <chun.tao@intel.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add dockerfiles in animation-compose-cd.yaml Signed-off-by: Chun Tao <chun.tao@intel.com> * Fix end of file issue in animation-compose-cd.yaml Signed-off-by: Chun Tao <chun.tao@intel.com> * Fix Docker deployment on Xeon Signed-off-by: Chun Tao <chun.tao@intel.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * add versioning for all pip packages Signed-off-by: Chun Tao <chun.tao@intel.com> * e2e test script for animation Signed-off-by: Chun Tao <chun.tao@intel.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * update e2e test script Signed-off-by: Chun Tao <chun.tao@intel.com> * update e2e test script Signed-off-by: Chun Tao <chun.tao@intel.com> * update readme Signed-off-by: Chun Tao <chun.tao@intel.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * update Signed-off-by: Chun Tao <chun.tao@intel.com> * update Signed-off-by: Chun Tao <chun.tao@intel.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * update gateway Signed-off-by: Chun Tao <chun.tao@intel.com> * udpate gateway Signed-off-by: Chun Tao <chun.tao@intel.com> * Fix AVATAR_CHATBOT Signed-off-by: Chun Tao <chun.tao@intel.com> * update gateway Signed-off-by: Chun Tao <chun.tao@intel.com> * update Signed-off-by: Chun Tao <chun.tao@intel.com> * test Signed-off-by: Chun Tao <chun.tao@intel.com> * update Signed-off-by: Chun Tao <chun.tao@intel.com> * update Signed-off-by: Chun Tao <chun.tao@intel.com> * update gateway Signed-off-by: Chun Tao <chun.tao@intel.com> * fix max_tokens in AvatarChatbot gateway Signed-off-by: Chun Tao <chun.tao@intel.com> * test Signed-off-by: Chun Tao <chun.tao@intel.com> * update Signed-off-by: Chun Tao <chun.tao@intel.com> * update Signed-off-by: Chun Tao <chun.tao@intel.com> * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Signed-off-by: Chun Tao <chun.tao@intel.com> Signed-off-by: Yeoh, Hoong Tee <hoong.tee.yeoh@intel.com> Signed-off-by: Ye, Xinyu <xinyu.ye@intel.com> Signed-off-by: ZePan110 <ze.pan@intel.com> Signed-off-by: chensuyue <suyue.chen@intel.com> Co-authored-by: Hoong Tee, Yeoh <hoong.tee.yeoh@intel.com> Co-authored-by: XinyuYe-Intel <xinyu.ye@intel.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: ZePan110 <ze.pan@intel.com> Co-authored-by: chen, suyue <suyue.chen@intel.com>
Generative AI Components (GenAIComps)
Build Enterprise-grade Generative AI Applications with Microservice Architecture
This initiative empowers the development of high-quality Generative AI applications for enterprises via microservices, simplifying the scaling and deployment process for production. It abstracts away infrastructure complexities, facilitating the seamless development and deployment of Enterprise AI services.
GenAIComps
GenAIComps provides a suite of microservices, leveraging a service composer to assemble a mega-service tailored for real-world Enterprise AI applications. All the microservices are containerized, allowing cloud native deployment. Checkout how the microservices are used in GenAIExamples.
Installation
- Install from Pypi
pip install opea-comps
- Build from Source
git clone https://github.com/opea-project/GenAIComps
cd GenAIComps
pip install -e .
MicroService
Microservices are akin to building blocks, offering the fundamental services for constructing RAG (Retrieval-Augmented Generation) applications.
Each Microservice is designed to perform a specific function or task within the application architecture. By breaking down the system into smaller, self-contained services, Microservices promote modularity, flexibility, and scalability.
This modular approach allows developers to independently develop, deploy, and scale individual components of the application, making it easier to maintain and evolve over time. Additionally, Microservices facilitate fault isolation, as issues in one service are less likely to impact the entire system.
The initially supported Microservices are described in the below table. More Microservices are on the way.
A Microservices can be created by using the decorator register_microservice. Taking the embedding microservice as an example:
from langchain_community.embeddings import HuggingFaceHubEmbeddings
from comps import register_microservice, EmbedDoc, ServiceType, TextDoc
@register_microservice(
name="opea_service@embedding_tgi_gaudi",
service_type=ServiceType.EMBEDDING,
endpoint="/v1/embeddings",
host="0.0.0.0",
port=6000,
input_datatype=TextDoc,
output_datatype=EmbedDoc,
)
def embedding(input: TextDoc) -> EmbedDoc:
embed_vector = embeddings.embed_query(input.text)
res = EmbedDoc(text=input.text, embedding=embed_vector)
return res
MegaService
A Megaservice is a higher-level architectural construct composed of one or more Microservices, providing the capability to assemble end-to-end applications. Unlike individual Microservices, which focus on specific tasks or functions, a Megaservice orchestrates multiple Microservices to deliver a comprehensive solution.
Megaservices encapsulate complex business logic and workflow orchestration, coordinating the interactions between various Microservices to fulfill specific application requirements. This approach enables the creation of modular yet integrated applications, where each Microservice contributes to the overall functionality of the Megaservice.
Here is a simple example of building Megaservice:
from comps import MicroService, ServiceOrchestrator
EMBEDDING_SERVICE_HOST_IP = os.getenv("EMBEDDING_SERVICE_HOST_IP", "0.0.0.0")
EMBEDDING_SERVICE_PORT = os.getenv("EMBEDDING_SERVICE_PORT", 6000)
LLM_SERVICE_HOST_IP = os.getenv("LLM_SERVICE_HOST_IP", "0.0.0.0")
LLM_SERVICE_PORT = os.getenv("LLM_SERVICE_PORT", 9000)
class ExampleService:
def __init__(self, host="0.0.0.0", port=8000):
self.host = host
self.port = port
self.megaservice = ServiceOrchestrator()
def add_remote_service(self):
embedding = MicroService(
name="embedding",
host=EMBEDDING_SERVICE_HOST_IP,
port=EMBEDDING_SERVICE_PORT,
endpoint="/v1/embeddings",
use_remote_service=True,
service_type=ServiceType.EMBEDDING,
)
llm = MicroService(
name="llm",
host=LLM_SERVICE_HOST_IP,
port=LLM_SERVICE_PORT,
endpoint="/v1/chat/completions",
use_remote_service=True,
service_type=ServiceType.LLM,
)
self.megaservice.add(embedding).add(llm)
self.megaservice.flow_to(embedding, llm)
Gateway
The Gateway serves as the interface for users to access the Megaservice, providing customized access based on user requirements. It acts as the entry point for incoming requests, routing them to the appropriate Microservices within the Megaservice architecture.
Gateways support API definition, API versioning, rate limiting, and request transformation, allowing for fine-grained control over how users interact with the underlying Microservices. By abstracting the complexity of the underlying infrastructure, Gateways provide a seamless and user-friendly experience for interacting with the Megaservice.
For example, the Gateway for ChatQnA can be built like this:
from comps import ChatQnAGateway
self.gateway = ChatQnAGateway(megaservice=self.megaservice, host="0.0.0.0", port=self.port)
Contributing to OPEA
Welcome to the OPEA open-source community! We are thrilled to have you here and excited about the potential contributions you can bring to the OPEA platform. Whether you are fixing bugs, adding new GenAI components, improving documentation, or sharing your unique use cases, your contributions are invaluable.
Together, we can make OPEA the go-to platform for enterprise AI solutions. Let's work together to push the boundaries of what's possible and create a future where AI is accessible, efficient, and impactful for everyone.
Please check the Contributing guidelines for a detailed guide on how to contribute a GenAI example and all the ways you can contribute!
Thank you for being a part of this journey. We can't wait to see what we can achieve together!
