Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion core/llm/llms/Ollama.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class Ollama extends BaseLLM {
model: "codellama-7b",
};

private fimSupported: boolean = false;

constructor(options: LLMOptions) {
super(options);

Expand Down Expand Up @@ -70,6 +72,13 @@ class Ollama extends BaseLLM {
}
}
}

/**
* There is no API to get the model's FIM capabilities, so we have to
* make an educated guess. If a ".Suffix" variable appears in the template
* it's a good indication the model supports FIM.
*/
this.fimSupported = !!body?.template?.includes(".Suffix");
})
.catch((e) => {
// console.warn("Error calling the Ollama /api/show endpoint: ", e);
Expand Down Expand Up @@ -251,7 +260,7 @@ class Ollama extends BaseLLM {
}

supportsFim(): boolean {
return true;
return this.fimSupported;
}

protected async *_streamFim(
Expand Down