
Usa gli LLM per il ranking dei documenti
Usa gli LLM per il ranking dei documenti.
C'è del potere nell'AI: puoi "lanciarle un problema" e ottenere un risultato, senza nemmeno definire completamente il problema. Ad esempio, dalle un mucchio di diff di codice e un avviso di sicurezza, e chiedile: "Quale di questi diff sembra più probabile che corregga il bug di sicurezza?" Tuttavia, non è sempre così facile:
Abbiamo costruito raink per aggirare questi problemi e risolvere problemi di ranking generali che altrimenti sarebbero difficili da processare per gli LLM. Consulta il nostro post del blog raink: Use LLMs for Document Ranking per ulteriori informazioni su questa tecnica, e il nostro talk Patch Perfect: Harmonizing with LLMs to Find Security Vulns per vedere come abbiamo applicato raink a problemi di sicurezza offensiva.
git clone https://github.com/bishopfox/raink
cd raink
go install
Imposta la variabile d'ambiente OPENAI_API_KEY.
raink -h
Usage of raink:
-f string
Input file
-p string
Initial prompt
-r int
Number of runs (default 10)
-s int
Batch size (default 10)
Confronta 100 frasi in meno di 2 minuti.
raink \
-f testdata/sentences.txt \
-r 10 \
-s 10 \
-p 'Rank each of these items according to their relevancy to the concept of "time".' |
jq -r '.[:10] | map(.value)[]' |
nl
1 The train arrived exactly on time.
2 The old clock chimed twelve times.
3 The clock ticked steadily on the wall.
4 The bell rang, signaling the end of class.
5 The rooster crowed at the break of dawn.
6 She climbed to the top of the hill to watch the sunset.
7 He watched as the leaves fell one by one.
8 The stars twinkled brightly in the clear night sky.
9 He spotted a shooting star while stargazing.
10 She opened the curtains to let in the morning light.
Questo progetto è rilasciato sotto la MIT License.