Does this model support text insertion (fill in middle)?

#70
by AayushShah - opened

I think it is not natively designed for fill-in-the-middle tasks, as its architecture prioritizes sequential reasoning and generation.
workaround via prompt engineering:
Prefix: "The capital of France is"
Suffix: "and it is famous for the Eiffel Tower."
Fill in the blank: _______
Complete the text: [prefix] _____ [suffix]")

#https://api-docs.deepseek.com/guides/reasoning_model
import openai

client = openai.OpenAI(api_key="API_KEY", base_url="https://api.deepseek.com/v1")

response = client.chat.completions.create(
    model="deepseek-reasoner", #deepseek-r1, deepseek-chat
    messages=[
        {
            "role": "user",
            "content": f"Fill in the blank. Prefix: '{prefix}'; Suffix: '{suffix}'. Only reply with the missing text."
        }
    ],
    temperature=0.6
)
print(response.choices[0].message.content)

@rzgar Oh yeah, damn. This really is the cool and only workaround -- thanks for sharing that. Actually in last Oct-2024 Deepseek-coder was released and it being the "coder" model, it supported the FIM.

Hence, I thought there is maybe some possibility of FIM in this model too!

Sign up or log in to comment