[GH-ISSUE #7738] Allow passing file context for FIM tasks on /api/generate #4941

Closed
opened 2026-04-12 16:00:10 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @boswelja on GitHub (Nov 19, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/7738

It's relatively common now that FIM tasks use additional "context" - files related to the FIM task - to better perform their task.
Generally this context includes the file path + name, as well as the contents.

Enter the problem, models use different tokens to denote the start/end of this information. For example, deepseek-coder looks like

# /path/to/file.java
package com.my.app

class MyApp {
}

And StarCoder has different tokens (and some extra data)

<reponame>MyGitRepository
<filename>/path/to/file.java
package com.my.app

class MyApp {
}
<|endoftext|>

It'd be neat if we had a model-agnostic way of handling this, similar to how suffix works now

Originally created by @boswelja on GitHub (Nov 19, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/7738 It's relatively common now that FIM tasks use additional "context" - files related to the FIM task - to better perform their task. Generally this context includes the file path + name, as well as the contents. Enter the problem, models use different tokens to denote the start/end of this information. For example, deepseek-coder looks like ``` # /path/to/file.java package com.my.app class MyApp { } ``` And StarCoder has different tokens (and some extra data) ``` <reponame>MyGitRepository <filename>/path/to/file.java package com.my.app class MyApp { } <|endoftext|> ``` It'd be neat if we had a model-agnostic way of handling this, similar to how `suffix` works now
GiteaMirror added the feature request label 2026-04-12 16:00:10 -05:00
Author
Owner

@boswelja commented on GitHub (Jul 27, 2025):

I believe this has been implemented already

<!-- gh-comment-id:3123818268 --> @boswelja commented on GitHub (Jul 27, 2025): I believe this has been implemented already
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#4941