nandi/gleanpublic Fork 0
d2575c6
Commits
Clone
git clone https://git.rickub.com/nandi/glean.git
git clone ssh://git@rickub.com/nandi/glean.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Update default language to unknown instead of enUnverified

Julien Robert committed 2026-05-17T21:12:12+02:00 Browse files
d2575c6 parent: 0be7f42
modified internal/ml/llm.go +2 -2
@@ -41,7 +41,7 @@ func NewLLM(cfg LLMConfig) TextModel {
4141
4242 func (c *llm) DetectLanguages(ctx context.Context, texts []string) ([]string, error) {
4343 var b strings.Builder
44- b.WriteString("For each text below, respond with ONLY the ISO 639-1 language code (e.g. en, fr, de, es, pt, it, ru, ja, zh, ko, ar). One code per line, same order as input. If uncertain, respond with 'en'.\n\n")
44+ b.WriteString("For each text below, respond with ONLY the ISO 639-1 language code (e.g. en, fr, de, es, pt, it, ru, ja, zh, ko, ar). One code per line, same order as input. If uncertain, respond with 'unknown'.\n\n")
4545 for i, t := range texts {
4646 truncated := t
4747 if len(truncated) > 500 {
@@ -71,7 +71,7 @@ func (c *llm) DetectLanguages(ctx context.Context, texts []string) ([]string, er
7171 code := strings.TrimSpace(line)
7272 code = strings.TrimPrefix(code, fmt.Sprintf("%d.", i+1))
7373 code = strings.TrimSpace(code)
74- if IsKnownLanguage(code) {
74+ if IsKnownLanguage(code) || code == "unknown" {
7575 result[i] = code
7676 }
7777 }
@@ -41,7 +41,7 @@ func NewLLM(cfg LLMConfig) TextModel {
41 41
42 func (c *llm) DetectLanguages(ctx context.Context, texts []string) ([]string, error) {42 func (c *llm) DetectLanguages(ctx context.Context, texts []string) ([]string, error) {
43 var b strings.Builder43 var b strings.Builder
44- b.WriteString("For each text below, respond with ONLY the ISO 639-1 language code (e.g. en, fr, de, es, pt, it, ru, ja, zh, ko, ar). One code per line, same order as input. If uncertain, respond with 'en'.\n\n")44+ b.WriteString("For each text below, respond with ONLY the ISO 639-1 language code (e.g. en, fr, de, es, pt, it, ru, ja, zh, ko, ar). One code per line, same order as input. If uncertain, respond with 'unknown'.\n\n")
45 for i, t := range texts {45 for i, t := range texts {
46 truncated := t46 truncated := t
47 if len(truncated) > 500 {47 if len(truncated) > 500 {
@@ -71,7 +71,7 @@ func (c *llm) DetectLanguages(ctx context.Context, texts []string) ([]string, er
71 code := strings.TrimSpace(line)71 code := strings.TrimSpace(line)
72 code = strings.TrimPrefix(code, fmt.Sprintf("%d.", i+1))72 code = strings.TrimPrefix(code, fmt.Sprintf("%d.", i+1))
73 code = strings.TrimSpace(code)73 code = strings.TrimSpace(code)
74- if IsKnownLanguage(code) {74+ if IsKnownLanguage(code) || code == "unknown" {
75 result[i] = code75 result[i] = code
76 }76 }
77 }77 }