Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ngxson committed Jan 28, 2025
1 parent 897190d commit f259715
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/ollama-utils/src/chat-template.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Template as JinjaTemplate } from "@huggingface/jinja";
import { OLLAMA_CHAT_TEMPLATE_MAPPING } from "./chat-template-automap";
import { GGUFParsedInfo, OllamaCustomMappedTemplate, OllamaChatTemplateMapEntry } from "./types";
import type { GGUFParsedInfo, OllamaCustomMappedTemplate, OllamaChatTemplateMapEntry } from "./types";

// regex for finding special tokens inside chat template
const RE_SPECIAL_TOKEN = /<[|_A-Za-z0-9]+>|\[[A-Z]+\]|<\uFF5C[\u2581A-Za-z]+\uFF5C>/g;
Expand Down Expand Up @@ -224,7 +224,7 @@ function convertJinjaToGoTemplate(gguf: NonNullable<GGUFParsedInfo>):
const formattedUserContent = formattedUser.replace("{{ .Prompt }}", "{{ .Content }}");
const formattedRespContent = formattedResp.replace("{{ .Response }}", "{{ .Content }}");
const addedAssistantPrompt = formattedResp.split("{{ .Response }}")[0];
goTmpl = `${formattedSystem}{{- range .Messages }}{{- if eq .Role \"user\" }}${formattedUserContent}{{- else if eq .Role \"assistant\" }}${formattedRespContent}{{- end }}{{- end }}${addedAssistantPrompt}`;
goTmpl = `${formattedSystem}{{- range .Messages }}{{- if eq .Role "user" }}${formattedUserContent}{{- else if eq .Role "assistant" }}${formattedRespContent}{{- end }}{{- end }}${addedAssistantPrompt}`;
}

// we get the stop token by only keeping the first part of formattedResp
Expand Down
1 change: 1 addition & 0 deletions packages/ollama-utils/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface OllamaChatTemplateMapEntry {
tokens: string[];
params?: {
stop?: string[];
// eslint-disable-next-line
[key: string]: any;
};
};
Expand Down

0 comments on commit f259715

Please sign in to comment.