-
Notifications
You must be signed in to change notification settings - Fork 2k
refactor(fim): introduce FimHandler interface for cleaner FIM support #4845
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4b7ddd7
refactor(fim): introduce FimHandler interface for cleaner FIM support
markijbema 97c1d64
chore: remove deprecated supportsFim() method and backward compatibil…
markijbema 75bdfd9
cleanup
markijbema def8028
Merge remote-tracking branch 'origin/main' into mark/fim-handler-inte…
markijbema 16afd02
remove unnecessary comment
markijbema 8625253
simplify code
markijbema File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| // kilocode_change - new file | ||
markijbema marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| import type { ModelInfo } from "@roo-code/types" | ||
| import type { CompletionUsage } from "../openrouter" | ||
|
|
||
| /** | ||
| * Interface for FIM (Fill-In-the-Middle) completion handlers. | ||
| */ | ||
| export interface FimHandler { | ||
| /** | ||
| * Stream code completion between a prefix and suffix | ||
| * @param prefix - The code before the cursor/insertion point | ||
| * @param suffix - The code after the cursor/insertion point | ||
| * @param taskId - Optional task ID for tracking | ||
| * @param onUsage - Optional callback invoked with usage information when available | ||
| * @returns An async generator yielding code chunks as strings | ||
| */ | ||
| streamFim( | ||
| prefix: string, | ||
| suffix: string, | ||
| taskId?: string, | ||
| onUsage?: (usage: CompletionUsage) => void, | ||
| ): AsyncGenerator<string> | ||
|
|
||
| /** | ||
| * Get the model information for the FIM handler | ||
| * @returns Object containing model id, info, and optional maxTokens | ||
| */ | ||
| getModel(): { id: string; info: ModelInfo; maxTokens?: number } | ||
|
|
||
| /** | ||
| * Calculate the total cost for a completion based on usage | ||
| * @param usage - The completion usage information | ||
| * @returns The total cost in dollars | ||
| */ | ||
| getTotalCost(usage: CompletionUsage): number | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason to export this here other than everyone/Opus does it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i assumed this to be best practice al this is the index file, and also has a barrel function. That's not the case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see the point of barrel files, and IIRC we have had eng. discussions about it, and IIRC the general tone was that it's not worth it in general.