Skip to content

feat: use Chat Completions API for inline completion in OpenAI Compatible provider#117

Merged
mbektas merged 1 commit into
plmbr:mainfrom
aisensiy:feat/openai-compatible-inline-completion-chat-api
Apr 7, 2026
Merged

feat: use Chat Completions API for inline completion in OpenAI Compatible provider#117
mbektas merged 1 commit into
plmbr:mainfrom
aisensiy:feat/openai-compatible-inline-completion-chat-api

Conversation

@aisensiy
Copy link
Copy Markdown
Contributor

@aisensiy aisensiy commented Feb 26, 2026

Summary

  • Replace Legacy Completions API (/v1/completions) with Chat Completions API (/v1/chat/completions) for inline completion
  • This enables compatibility with vLLM and other OpenAI-compatible APIs that don't support the suffix parameter in Legacy Completions API

Changes

  • Use chat.completions.create instead of completions.create
  • Add prompt engineering to handle prefix/suffix context (similar to Claude implementation)
  • Add _extract_llm_generated_code() method to extract code from markdown response
  • Add cancellation token checks for better responsiveness

Motivation

vLLM's OpenAI-compatible API does not support the suffix parameter in the Legacy Completions API:

Completions API (/v1/completions) - suffix is not supported

This PR makes the OpenAI Compatible provider work with vLLM and similar services.

Testing

Tested with vLLM server providing inline completions in JupyterLab notebooks.

…ible provider

Replace Legacy Completions API with Chat Completions API for inline
completion. This enables compatibility with vLLM and other OpenAI-compatible
APIs that don't support the suffix parameter.

Changes:
- Use chat.completions.create instead of completions.create
- Add prompt engineering to handle prefix/suffix context
- Add code extraction from markdown response
- Add cancellation token checks
Copy link
Copy Markdown
Collaborator

@mbektas mbektas left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

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