Skip to content

Commit

Permalink
Add deployment example for CodeTrans (opea-project#281)
Browse files Browse the repository at this point in the history
* Add deployment example for CodeTrans

Signed-off-by: devpramod <[email protected]>

* fix doc build

Signed-off-by: devpramod <[email protected]>

* fix typos, grammar - xeon

Signed-off-by: devpramod <[email protected]>

* fix typos, grammar - gaudi

Signed-off-by: devpramod <[email protected]>

---------

Signed-off-by: devpramod <[email protected]>
Co-authored-by: Ying Hu <[email protected]>
Signed-off-by: rbrygaro <[email protected]>
  • Loading branch information
2 people authored and rbrugaro committed Jan 24, 2025
1 parent 20cb383 commit 4948985
Show file tree
Hide file tree
Showing 4 changed files with 834 additions and 0 deletions.
50 changes: 50 additions & 0 deletions examples/CodeTrans/CodeTrans_Guide.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
.. _CodeTrans_Guide:

Code Translation Sample Guide
##############################

.. note:: This guide is in its early development and is a work-in-progress with
placeholder content.

Overview
********

This example showcases a code translation system that converts code from one programming language to another while preserving the original logic and functionality. The primary component is the CodeTrans MegaService, which encompasses an LLM microservice that performs the actual translation.
A lightweight Gateway service and a User Interface allow users to submit their source code in a given language and receive the translated output in another language.

Purpose
*******
* **Enable code conversion and modernization**: Developers can seamlessly migrate legacy code to newer languages or frameworks, leveraging modern best practices without having to rewrite large code bases from scratch.

* **Facilitate multi-language support**: By providing a system that understands multiple programming languages, organizations can unify their development approaches and reduce the barrier to adopting new languages.

* **Improve developer productivity**: Automated code translation drastically reduces manual, time-consuming porting efforts, allowing developers to focus on higher-level tasks like feature design and optimization.

How It Works
************

.. figure:: /GenAIExamples/CodeTrans/assets/img/code_trans_architecture.png
:alt: ChatQnA Architecture Diagram

1. A user specifies the source language, the target language, and the snippet of code to be translated. This request is handled by the front-end UI or via a direct API call.


2. The user’s request is sent to the CodeTrans Gateway, which orchestrates the call to the LLM MicroService. The gateway handles details like constructing prompts and managing responses.


3. The large language model processes the user’s code snippet, analyzing syntax and semantics before generating an equivalent snippet in the target language.

4. The gateway formats the model’s output and returns the translated code to the user, either via an API response or rendered within the UI.


Deployment
**********
Here are some deployment options, depending on your hardware and environment:

Single Node
+++++++++++++++
.. toctree::
:maxdepth: 1

Xeon Scalable Processor <deploy/xeon>
Gaudi <deploy/gaudi>
Loading

0 comments on commit 4948985

Please sign in to comment.