From 4f0a0b54a7b559d0f048db48c6dfda417fa709b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thor=20=E9=9B=B7=E7=A5=9E=20Schaeff?= <5748289+thorwebdev@users.noreply.github.com> Date: Wed, 21 Aug 2024 20:35:58 +0800 Subject: [PATCH] Edge Functions Llamafile example. (#28544) * ef llamafile example. * chore: add docs. * chore: add blogpost. * chore: spelling. * chore: docs nit. * chore: nits from review. * chore: spelling nits. * Update apps/www/_blog/2024-08-21-mozilla-llamafile-in-supabase-edge-functions.mdx * Update apps/www/_blog/2024-08-21-mozilla-llamafile-in-supabase-edge-functions.mdx --- .../content/guides/functions/ai-models.mdx | 350 +++++++++++++----- ...a-llamafile-in-supabase-edge-functions.mdx | 236 ++++++++++++ .../mozilla-llamafile-og.png | Bin 0 -> 138787 bytes .../ai/llamafile-edge/supabase/.gitignore | 4 + .../ai/llamafile-edge/supabase/config.toml | 202 ++++++++++ .../functions/llamafile-stream/index.ts | 67 ++++ .../supabase/functions/llamafile/index.ts | 40 ++ .../supabase/functions/openai-sdk/index.ts | 76 ++++ examples/ai/llamafile-edge/supabase/seed.sql | 0 9 files changed, 888 insertions(+), 87 deletions(-) create mode 100644 apps/www/_blog/2024-08-21-mozilla-llamafile-in-supabase-edge-functions.mdx create mode 100644 apps/www/public/images/blog/mozilla-llamafile/mozilla-llamafile-og.png create mode 100644 examples/ai/llamafile-edge/supabase/.gitignore create mode 100644 examples/ai/llamafile-edge/supabase/config.toml create mode 100644 examples/ai/llamafile-edge/supabase/functions/llamafile-stream/index.ts create mode 100644 examples/ai/llamafile-edge/supabase/functions/llamafile/index.ts create mode 100644 examples/ai/llamafile-edge/supabase/functions/openai-sdk/index.ts create mode 100644 examples/ai/llamafile-edge/supabase/seed.sql diff --git a/apps/docs/content/guides/functions/ai-models.mdx b/apps/docs/content/guides/functions/ai-models.mdx index 12b40de6462..60b9df79bcd 100644 --- a/apps/docs/content/guides/functions/ai-models.mdx +++ b/apps/docs/content/guides/functions/ai-models.mdx @@ -62,9 +62,9 @@ Deno.serve(async (req: Request) => { }) ``` -## Using Large Language Models +## Using Large Language Models (LLM) -Inference via larger models is supported via [Ollama](https://ollama.com/). In the first iteration, you can use it with a self-managed Ollama server. We are progressively rolling out support for the hosted solution. To sign up for early access, fill up [this form](https://forms.supabase.com/supabase.ai-llm-early-access). +Inference via larger models is supported via [Ollama](https://ollama.com/) and [Mozilla Llamafile](https://github.com/Mozilla-Ocho/llamafile). In the first iteration, you can use it with a self-managed Ollama or [Llamafile server](https://www.docker.com/blog/a-quick-guide-to-containerizing-llamafile-with-docker-for-ai-applications/). We are progressively rolling out support for the hosted solution. To sign up for early access, fill up [this form](https://forms.supabase.com/supabase.ai-llm-early-access).