mirror of
https://github.com/asg017/sqlite-vec.git
synced 2026-04-25 08:46:49 +02:00
examples + fmt
This commit is contained in:
parent
356f75cca7
commit
dd972f6ffe
16 changed files with 1064 additions and 25 deletions
31
examples/nbc-headlines/build.sql
Normal file
31
examples/nbc-headlines/build.sql
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
.mode box
|
||||
.header on
|
||||
.bail on
|
||||
|
||||
.load ./vec0
|
||||
.load ./rembed0
|
||||
|
||||
insert into rembed_clients(name, options)
|
||||
values ('llamafile', 'llamafile');
|
||||
|
||||
create table articles as
|
||||
select
|
||||
value ->> 'url' as url,
|
||||
value ->> 'headline' as headline,
|
||||
rembed('llamafile', value ->> 'headline') as headline_embedding
|
||||
from json_each(
|
||||
readfile('2024-07-26.json')
|
||||
);
|
||||
|
||||
select writefile(
|
||||
'articles.json',
|
||||
json_group_array(
|
||||
json_object(
|
||||
'id', rowid,
|
||||
'url', url,
|
||||
'headline', headline,
|
||||
'headline_embedding', vec_to_json(headline_embedding)
|
||||
)
|
||||
)
|
||||
)
|
||||
from articles;
|
||||
Loading…
Add table
Add a link
Reference in a new issue