Skip to content

CodeTranslation: Update API client for chat completions and add proxy support#117

Open
tintisimone wants to merge 1 commit into
opea-project:mainfrom
tintisimone:feature/code-translation-api-updates
Open

CodeTranslation: Update API client for chat completions and add proxy support#117
tintisimone wants to merge 1 commit into
opea-project:mainfrom
tintisimone:feature/code-translation-api-updates

Conversation

@tintisimone

Copy link
Copy Markdown

Summary

Update CodeTranslation sample solution to use modern chat completions API and add proxy support for enterprise environments.

Changes:

  • Migrate from completions API to chat.completions API for better compatibility with modern LLM inference services
  • Refactor prompt structure to use system/user message format instead of raw completion prompts
  • Add HTTP/HTTPS proxy build args to docker-compose.yaml for both backend and frontend services
  • Remove restart: unless-stopped policy from frontend service for consistency
  • Update docstring to reference generic "instruct model" instead of hardcoded CodeLlama-34b reference

Why:

  • The completions API is being phased out in favor of chat.completions across most LLM providers
  • System/user message format provides better control over model behavior and is more maintainable
  • Proxy support is essential for enterprise deployments behind corporate firewalls
  • Generic model reference allows flexibility in model selection

Testing:

  • Verified API client successfully translates code using chat completions format
  • Confirmed proxy args are properly passed during Docker build

Related:
Split from #114 to separate application-level changes from XPU infrastructure changes, per reviewer feedback.

🤖 Generated with Claude Code

tintisimone added a commit to tintisimone/stinti.Enterprise-Inference that referenced this pull request Jul 7, 2026
Split application-level CodeTranslation changes into PR opea-project#117 to reduce review
burden and keep this PR focused on XPU/BMG infrastructure changes.

Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
tintisimone added a commit to tintisimone/stinti.Enterprise-Inference that referenced this pull request Jul 8, 2026
Add vLLM-based inference support for Intel Arc Battlemage (BMG) discrete
GPUs to the single-node deployment: Helm values for the BMG vLLM serving
container, XPU-aware model selection, Intel GPU device-plugin wiring, and
setup documentation.

Incorporates review feedback: run the vLLM container as non-root, use
xpu*-style naming instead of bmg-specific names, replace hardcoded
inventory/config values with placeholders, and de-duplicate the
kubernetes SDK install tasks. The CodeTranslation changes were split
into a separate PR (opea-project#117) to keep this one focused on XPU/BMG.

Signed-off-by: tintisimone <simone.tinti@intel.com>
… support

- Migrate from completions API to chat.completions API for better compatibility
- Update api_client.py to use system/user message format instead of raw prompts
- Add proxy build args to docker-compose.yaml for both backend and frontend
- Remove restart policy from frontend service for consistency
- Update docstring to reference generic "instruct model" instead of CodeLlama-34b

Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Simone Tinti <tintisimone@users.noreply.github.com>
@tintisimone
tintisimone force-pushed the feature/code-translation-api-updates branch from 5d5c09b to 3900b0b Compare July 8, 2026 09:17
@tintisimone

Copy link
Copy Markdown
Author

This PR contains the CodeTranslation changes that were split out of #114 to keep that PR focused on the XPU/BMG infrastructure.

Summary of changes (2 files):

  • api/services/api_client.py — migrate from the completions API to chat.completions (system/user message format) for broader model compatibility, with markdown-fence stripping as a safety net on the model output.
  • docker-compose.yaml — add http_proxy/https_proxy/no_proxy build args to the backend and frontend images, and drop the stray restart policy on the frontend for consistency.

The commit is DCO-signed and the check is green.

I don't have permission to formally request reviewers on this repo — @AhmedSeemalK @vhpintel @amberjain1, could one of you (or a maintainer) take a look / assign reviewers when you have a chance? Thanks!

@psurabh
psurabh requested a review from AhmedSeemalK July 8, 2026 14:24

@AhmedSeemalK AhmedSeemalK left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants