doc updates

This commit is contained in:
Alex Garcia 2024-06-22 16:46:33 -07:00
parent df48ac2416
commit b62f6f19a8
31 changed files with 751 additions and 97 deletions

View file

@ -11,6 +11,17 @@ const VERSION = readFileSync(
"utf8"
);
const sqliteLanuage = JSON.parse(
readFileSync(
join(
dirname(fileURLToPath(import.meta.url)),
"..",
"sqlite.tmlanguage.json"
),
"utf8"
)
);
function head(): HeadConfig[] {
return [
[
@ -18,7 +29,7 @@ function head(): HeadConfig[] {
{
rel: "shortcut icon",
type: "image/svg+xml",
href: "favicon.svg",
href: "./logo.light.svg",
},
],
[
@ -36,22 +47,34 @@ const guides = {
text: "Guides",
collapsed: true,
items: [
{ text: "Binary Quantization", link: "/guides/binary-quant" },
{ text: "Scalar Quantization", link: "/guides/scalar-quant" },
{ text: "Performance", link: "/guides/performance" },
{
text: "Matryosha/Adaptive Length Embeddings",
link: "/guides/matryoshka",
text: "Vector operations",
items: [
{ text: "Vector Arithmetic", link: "/guides/arithmetic" },
{ text: "Binary Quantization", link: "/guides/binary-quant" },
{ text: "Scalar Quantization", link: "/guides/scalar-quant" },
{
text: "Matryoshka Embeddings",
link: "/guides/matryoshka",
},
],
},
{
text: "Build with sqlite-vec",
items: [
{ text: "Semantic Search", link: "/guides/semantic-search" },
{ text: "Hybrid Search", link: "/guides/hybrid-search" },
{ text: "Retrival Augmented Generation (RAG)", link: "/guides/rag" },
{ text: "Classifiers", link: "/guides/classifiers" },
],
},
{ text: "Semantic Search", link: "/guides/semantic-search" },
{ text: "Hybrid Search", link: "/guides/hybrid-search" },
{ text: "Classifiers", link: "/guides/classifiers" },
{ text: "Improving Performance", link: "/guides/improving-perf" },
],
};
function nav(): DefaultTheme.NavItem[] {
return [
guides,
{ text: "API Reference", link: "/api-reference" },
{ text: "♥ Sponsor", link: "https://github.com/sponsors/asg017" },
{
@ -103,17 +126,25 @@ function sidebar(): DefaultTheme.SidebarItem[] {
return [
{
text: "Getting Started",
collapsed: false,
collapsed: true,
items: [
{
text: "Quickstart",
link: "/getting-started",
text: "Installation",
link: "/installation",
},
{
text: "Introduction",
link: "/introduction",
},
{
text: "Quick Start",
link: "/quickstart",
},
],
},
{
text: "Using with...",
collapsed: false,
collapsed: true,
items: [
{ text: "Python", link: "/python" },
{ text: "JavaScript", link: "/js" },
@ -124,7 +155,6 @@ function sidebar(): DefaultTheme.SidebarItem[] {
{ text: "WebAssembly (Browser)", link: "/wasm" },
{ text: "Datasette", link: "/datasette" },
{ text: "sqlite-utils", link: "/sqlite-utils" },
{ text: "Loadable Extension", link: "/loadable" },
],
},
guides,
@ -135,6 +165,10 @@ function sidebar(): DefaultTheme.SidebarItem[] {
{ text: "API Reference", link: "/api-reference" },
],
},
{
text: "Sponsors",
link: "/sponsors",
},
{
text: "See also",
items: [
@ -163,13 +197,18 @@ export default defineConfig({
head: head(),
base: "/sqlite-vec/",
themeConfig: {
logo: {
light: "/logo.dark.svg",
dark: "/logo.light.svg",
alt: "sqlite-vec logo",
},
nav: nav(),
sidebar: sidebar(),
footer: {
message: "MIT License",
copyright: "Copyright © 2024 Alex Garcia",
message: "MIT/Apache-2 License",
copyright:
'Copyright © 2024 <a href="https://alexgarcia.xyz/">Alex Garcia</a>',
},
outline: "deep",
search: {
@ -185,20 +224,10 @@ export default defineConfig({
},
rewrites: {
"using/:pkg.md": ":pkg.md",
"guides/:pkg.md": ":pkg.md",
"getting-started/:pkg.md": ":pkg.md",
//"guides/:pkg.md": ":pkg.md",
},
markdown: {
languages: [
JSON.parse(
readFileSync(
join(
dirname(fileURLToPath(import.meta.url)),
"..",
"sqlite.tmlanguage.json"
),
"utf8"
)
),
],
languages: [sqliteLanuage],
},
});

View file

@ -0,0 +1,38 @@
<script setup lang="ts"></script>
<template>
<div
style="
background: var(--vp-c-default-3);
padding: -4px 12px;
border-radius: 10px;
"
>
<div>
<div class="language-sqlite vp-adaptive-theme">
<pre
class="shiki shiki-themes github-light github-dark vp-code"
><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">-- store 768-dimensional vectors in a vec0 virtual table</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">create</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> virtual</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> table</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> vec_movies </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">using</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> vec0(</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> synopsis_embedding </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">float</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">[768]</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">);</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">-- insert vectors into the table, as JSON or compact BLOBs</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">insert into</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> vec_movies(rowid, synopsis_embedding)</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> select</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> rowid,</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> embed(synopsis) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">as</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> synopsis_embedding</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> from</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> movies;</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">-- KNN search!</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">select</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> rowid,</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> distance</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">from</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> vec_movies</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">where</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> synopsis_embedding </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">match</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> embed(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">'scary futuristic movies'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">)</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">order by</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> distance</span></span>
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">limit</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 20</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span></code></pre>
</div>
</div>
</div>
</template>

View file

@ -11,7 +11,7 @@ const sponsors = computed(() => {
{
name: "Mozilla Builders",
url: "",
img: withBase("./mozilla.svg"),
img: withBase("/mozilla.svg"),
},
],
},
@ -21,7 +21,7 @@ const sponsors = computed(() => {
{
name: "Fly.io",
url: "https://fly.io",
img: withBase("./flyio.svg"),
img: withBase("/flyio.svg"),
},
],
},
@ -31,7 +31,7 @@ const sponsors = computed(() => {
{
name: "Turso",
url: "https://turso.tech",
img: withBase("./turso.svg"),
img: withBase("/turso.svg"),
},
],
},
@ -41,7 +41,7 @@ const sponsors = computed(() => {
{
name: "SQLite Cloud",
url: "https://sqlitecloud.io",
img: withBase("./sqlitecloud.svg"),
img: withBase("/sqlitecloud.svg"),
},
],
},
@ -51,18 +51,20 @@ const sponsors = computed(() => {
<template>
<!--<a class="sponsors-aside-text" href="/sponsor/">Sponsors</a>-->
<VPDocAsideSponsors :data="sponsors" />
<div
style="
font-size: 14px;
text-align: center;
font-style: italic;
margin-top: 4px;
"
>
<a href="https://github.com/asg017/sqlite-vec#sponsors"
>Become a sponsor! </a
<div>
<VPDocAsideSponsors :data="sponsors" />
<div
style="
font-size: 14px;
text-align: center;
font-style: italic;
margin-top: 4px;
"
>
<a href="https://github.com/asg017/sqlite-vec#sponsors"
>Become a sponsor! </a
>
</div>
</div>
</template>

View file

@ -4,6 +4,7 @@ import type { Theme } from "vitepress";
import DefaultTheme from "vitepress/theme";
import "./style.css";
import Sponsors from "./Sponsors.vue";
import HeroImg from "./HeroImg.vue";
export default {
extends: DefaultTheme,
@ -14,7 +15,7 @@ export default {
h("marquee", { class: "banner", scrollamount: "10" }, [
"🚧🚧🚧 sqlite-vec is still in beta, and this documentation is incomplete! Watch the repo for updates 🚧🚧🚧",
]),
"home-hero-image": () => h("div", {}, [""]),
//"home-hero-image": () => h(HeroImg),
"aside-ads-before": () => h(Sponsors),
});
},

View file

@ -1,3 +1,21 @@
/*@import "https://code.cdn.mozilla.net/fonts/zilla-slab.css";*/
@font-face {
font-family: "ZillaSlab-SemiBold";
src: url("/fonts/ZillaSlab-SemiBold.woff");
src: url("/fonts/ZillaSlab-SemiBold.woff2") format("woff2"),
url("/fonts/ZillaSlab-SemiBold.woff") format("woff"),
url("/fonts/ZillaSlab(-SemiBold).otf") format("opentype"),
url("/fonts/ZillaSlab-SemiBold.ttf") format("truetype");
font-weight: 600;
font-style: normal;
}
.VPHero h1,
.VPNavBarTitle .title {
font-family: "ZillaSlab-SemiBold";
font-size: 1.5rem;
}
/**
* Customize default theme styling by overriding CSS variables:
* https://github.com/vuejs/vitepress/blob/main/src/client/theme-default/styles/vars.css
@ -68,6 +86,17 @@
--vp-c-danger-2: var(--vp-c-red-2);
--vp-c-danger-3: var(--vp-c-red-3);
--vp-c-danger-soft: var(--vp-c-red-soft);
--vp-c-brand-1x: #a6d189;
--vp-c-brand-1x: #a6da95;
--vp-c-brand-1x: #a6e3a1;
}
:root {
--vp-c-brand-1: #1e66f5;
}
.dark {
--vp-c-brand-1: #89b4fa;
}
/**
@ -92,19 +121,20 @@
:root {
--vp-home-hero-name-color: transparent;
--vp-home-hero-name-background: -webkit-linear-gradient(
120deg,
#f5c2e7 30%,
#94e2d5 /*#bd34fe 30%,
#41d1ff*/
);
--vp-home-hero-name-background: black;
/*
--vp-home-hero-image-background-image: linear-gradient(
-45deg,
#bd34fe 50%,
#47caff 50%
);
--vp-home-hero-image-filter: blur(44px);
*/
}
.dark {
--vp-home-hero-name-background: white;
}
@media (min-width: 640px) {