Skip to main content

FIM Completion

In FIM (Fill In the Middle) completion, users can provide a prefix and an optional suffix, and the model fills in the content in between. FIM is commonly used for content continuation, code completion, and similar scenarios.

Notes

  1. The maximum completion length for the model is 4K.
  2. The currently available model is qwen2.5-coder-32b-instruct.

Sample Code

The following is a complete Python code example for FIM completion. In this example, we provide the beginning and end of a Fibonacci sequence function and let the model fill in the middle.

from openai import OpenAI

client = OpenAI(
api_key="<your api key>",
base_url="https://live-turing.cn.llm.tcljd.com/api/v1",
)

response = client.completions.create(
model="qwen2.5-coder-32b-instruct",
prompt="def fib(a):",
suffix=" return fib(a-1) + fib(a-2)",
max_tokens=128
)
print(response.choices[0].text)

Configure the Continue Code Completion Plugin

Continue is a VSCode plugin that supports code completion. You can refer to this document to configure Continue for code completion functionality.

Reference configuration example — note that provider should be set to openai:

models:
- name: <your name>
provider: openai
model: qwen2.5-coder-32b-instruct
apiKey: <your api key>
apiBase: https://live-turing.cn.llm.tcljd.com/api/v1