Felipe97/llama-cpp-compiled
01.1k
1# llama.cpp/examples/retrieval2 3Demonstration of simple retrieval technique based on cosine similarity4 5More info:6https://github.com/ggml-org/llama.cpp/pull/61937 8### How to use9 10`retieval.cpp` has parameters of its own:11- `--context-file`: file to be embedded - state this option multiple times to embed multiple files12- `--chunk-size`: minimum size of each text chunk to be embedded13- `--chunk-separator`: STRING to divide chunks by. newline by default14 15`retrieval` example can be tested as follows:16 17```bash18llama-retrieval --model ./models/bge-base-en-v1.5-f16.gguf --top-k 3 --context-file README.md --context-file License --chunk-size 100 --chunk-separator .19```20 21This chunks and embeds all given files and starts a loop requesting query inputs:22 23```24Enter query:25```26 27On each query input, top k chunks are shown along with file name, chunk position within file and original text:28 29```30Enter query: describe the mit license31batch_decode: n_tokens = 6, n_seq = 132Top 3 similar chunks:33filename: README.md34filepos: 11935similarity: 0.76233436textdata:37png)38 39[](https://opensource.org/licenses/MIT)40 41[Roadmap](https://github.42--------------------43filename: License44filepos: 045similarity: 0.72514646textdata:47MIT License48 49Copyright (c) 2023 Georgi Gerganov50 51Permission is hereby granted, free of charge, to any person obtaining a copy52of this software and associated documentation files (the "Software"), to deal53in the Software without restriction, including without limitation the rights54to use, copy, modify, merge, publish, distribute, sublicense, and/or sell55copies of the Software, and to permit persons to whom the Software is56furnished to do so, subject to the following conditions:57 58The above copyright notice and this permission notice shall be included in all59copies or substantial portions of the Software.60--------------------61filename: README.md62filepos: 917863similarity: 0.62172264textdata:65com/cztomsik/ava) (MIT)66- [ptsochantaris/emeltal](https://github.com/ptsochantaris/emeltal)67- [pythops/tenere](https://github.68--------------------69```70 