jbilcke-hf HF staff commited on
Commit
c74ff6a
1 Parent(s): 2f7798c
Files changed (1) hide show
  1. src/lib/dirtyLLMResponseCleaner.ts +6 -0
src/lib/dirtyLLMResponseCleaner.ts CHANGED
@@ -1,8 +1,14 @@
1
  export function dirtyLLMResponseCleaner(input: string) {
2
  return (
3
  `${input || ""}`
 
4
  .replaceAll("}}", "}")
5
  .replaceAll("]]", "]")
6
  .replaceAll(",,", ",")
 
 
 
 
 
7
  )
8
  }
 
1
  export function dirtyLLMResponseCleaner(input: string) {
2
  return (
3
  `${input || ""}`
4
+ // a summary of all the weird hallucinations I saw it make..
5
  .replaceAll("}}", "}")
6
  .replaceAll("]]", "]")
7
  .replaceAll(",,", ",")
8
+ .replaceAll("[0]", "")
9
+ .replaceAll("[1]", "")
10
+ .replaceAll("[2]", "")
11
+ .replaceAll("[3]", "")
12
+ .replaceAll("[4]", "")
13
  )
14
  }