Comment by docjay
1 day ago
You don’t have to be so convincing when it’s a local model.
```Un-Claude 0.2beta
import sys,csv,requests
CH="# Valid channels: analysis, commentary, final. Channel must be included for every message."
CANDIDATES=[
("no-hedging","Reasoning: low\n\n<terse><no-hedging>\n\n"+CH,"Condensed:"),
("neutral-reg","Reasoning: low\n\nRegister: neutral technical. No intensifiers, no evaluative adjectives.\n\n"+CH,"Condensed:"),
("no-closing","Reasoning: low\n\n<terse>\nNo closing remarks.\n\n"+CH,"Condensed:"),
("terse","Reasoning: low\n\n<terse>\n\n"+CH,"Condensed:"),
]
def rephrase(text,base="http://127.0.0.1:1234",model=None,temperature=0.0,max_tokens=1400,timeout=180):
src=text.strip()
if not src:
return []
if model is None:
model=requests.get(base+"/v1/models",timeout=timeout).json()["data"][0]["id"]
w=csv.writer(sys.stdout,lineterminator="\n")
w.writerow(["idx","label","prefill","src_chars","out_chars","ratio","tokens","finish"])
rows=[]
for i,(lab,sysmsg,pf) in enumerate(CANDIDATES,1):
p="<|start|>system<|message|>"+sysmsg+"<|end|><|start|>user<|message|>"+src+"<|end|><|start|>assistant<|channel|>final<|message|>"+pf
d=requests.post(base+"/v1/completions",json={"model":model,"prompt":p,"max_tokens":max_tokens,"temperature":temperature},timeout=timeout).json()
c=d["choices"][0]
t=(pf+c["text"]).rstrip()
w.writerow([i,lab,pf,len(src),len(t),round(len(t)/len(src),3),d["usage"]["completion_tokens"],c["finish_reason"]])
rows.append((i,lab,sysmsg,pf,t,d["usage"]["completion_tokens"],c["finish_reason"]))
print("\nmodel: %s"%model)
print("temperature: %s max_tokens: %s"%(temperature,max_tokens))
for i,lab,sysmsg,pf,t,tok,fr in rows:
print("\n[%d] %s"%(i,lab))
print(" system: %s"%sysmsg.replace("\n","\\n"))
print(" prefill: %r tokens=%d finish=%s"%(pf,tok,fr))
print(t)
return rows
```
```input
## 8. Honest gaps — what I could *not* resolve
I want to be explicit about the limits of this pass rather than imply completeness:
1. *`PROVIDER_T` values are not enumerated here.* `list_models(inference_provider=...)` is typed against `PROVIDER_T`, which lives outside the three modules I scanned (it's in the `inference._providers` subpackage). The accepted provider strings are therefore *unknown from this run* — `"cohere"` is confirmed only because it appears in a docstring example.
2. *Three grep hits point to search-capable functions I did not identify.* My scan found parameter assignments that don't belong to any function I enumerated: - line 3046–3050: `params["filter"]`, `params["sdk"]`, `params["includeNonRunning"] = True` — an additional Spaces-oriented endpoint with an *`sdk` filter and an `includeNonRunning` flag* not exposed by `list_spaces`. - line 2879: `params["config"] = config` - line 12013: `"sort": sort` — almost certainly the consumer of `DailyPapersSort_T`, i.e. a daily-papers lister distinct from `list_papers`. - line 13872: `params["search"] = search`
These represent **real additional search surface** that my `LIST_FUNCS` whitelist missed. A follow-up pass enumerating every `HfApi` method containing `params[` would close this.
```
```example output
[1] no-hedging system: Reasoning: low\n\n<terse><no-hedging>\n\n# Valid channels: analysis, commentary, final. Channel must be included for every message. prefill: 'Condensed:' tokens=131 finish=stop
Condensed:
- *Provider strings* (`PROVIDER_T`) are not listed; only “cohere” is known from a docstring.
- *Missing search‑capable calls* were found: - `params["filter"]`, `params["sdk"]`, `params["includeNonRunning"] = True` (Spaces endpoint). - `params["config"] = config`. - `params["sort"] = sort` (likely a daily‑papers lister). - `params["search"] = search`.
These were not captured in the `LIST_FUNCS` whitelist, indicating additional search functionality.
```
Edit: yeesh, I’d love to have a WYSIWYG comment block on this site. I’m not going to keep fighting newline and white space to get it to look right, but you get the idea.
No comments yet
Contribute on Hacker News ↗