From c8654b69ce5e5eba739cb60714dc4ed2f1053f98 Mon Sep 17 00:00:00 2001 From: lostmygithubaccount Date: Fri, 6 Oct 2023 20:04:40 +0000 Subject: [PATCH] deploy: 7f0c36c36a807655cb9b159768c2b9be9aa2e986 --- posts.html | 12 ++++---- posts.xml | 14 ++++----- posts/llms-and-data-pt2/index.html | 18 +++++------ reference/code.html | 2 +- reference/eda.html | 6 ---- search.json | 22 +++++++------- sitemap.xml | 48 +++++++++++++++--------------- 7 files changed, 58 insertions(+), 64 deletions(-) diff --git a/posts.html b/posts.html index 935b0ac..edb29c9 100644 --- a/posts.html +++ b/posts.html @@ -281,7 +281,7 @@

Posts

-
+ -
+ -
+

-Context, calls, and computations +Computations and control flow: it’s just programming
-
+ -
+

diff --git a/posts.xml b/posts.xml index e695424..a228008 100644 --- a/posts.xml +++ b/posts.xml @@ -268,7 +268,7 @@ Important Sun, 15 Oct 2023 00:00:00 GMT - Context, calls, and computations + Computations and control flow: it’s just programming Cody Peterson https://ibis-project.github.io/posts/llms-and-data-pt2/ Introduction

The recent Generative AI hype cycle has led to a lot of new terminology to understand. In this post, we’ll cover some key concepts from the groud up and explain the basics of working with LLMs in the context of data.

This post assumes basic familiarity with Marvin and Ibis and three approaches to applying LLMs to data.

-
+
Code
True)

First, we’ll setup Ibis and Marvin with some simple example data:

-
+
import ibis
@@ -413,7 +413,7 @@ font-style: inherit;">"penguins")
Retrieval augmented generation (RAG)

Instead of you typing out context for the bot, we can retrieve context from somewhere, augment our strings sent to the bot with this context, and then generate a response from the bot.

As a contrived example, instead of saying “The capitol of foo is bar”, we can retrieve the capitol of foo from a database, augment it with our context, and then generate a response from the bot. You may notice that we already did this in the firt post in the series – let’s review that code again:

-
+
from ibis.expr.schema = sql_select(query).strip(";")
 sql
-
+
'SELECT DISTINCT species, island FROM penguins'

Notice that we retrieved the table name and schema with calls to the Ibis table (t.get_name() and t.schema()). We then augment our context (the query in natural language) with this information and generate a response from the bot.

This works reasonably well for simple SQL queries:

-
+
t.sql(sql)
-
+
┏━━━━━━━━━━━┳━━━━━━━━━━━┓
 ┃ species    island    ┃
 ┡━━━━━━━━━━━╇━━━━━━━━━━━┩
diff --git a/posts/llms-and-data-pt2/index.html b/posts/llms-and-data-pt2/index.html
index 7a9d374..2087271 100644
--- a/posts/llms-and-data-pt2/index.html
+++ b/posts/llms-and-data-pt2/index.html
@@ -9,7 +9,7 @@
 
 
 
-Ibis Birdbrain - Context, calls, and computations
+Ibis Birdbrain - Computations and control flow: it’s just programming