davidshapiro_youtube_transcripts / ChatGPT as an Interpreter Introducing the KB Microservice for autonomous AI entities_transcript.csv
Stevross's picture
Upload 50 files
421fea8
text,start,duration
all right hello everybody good morning,0.659,5.761
um so it's been almost two years since I,4.02,4.86
published my first book on cognitive,6.42,3.66
architecture I called it natural,8.88,3.48
language cognitive architecture a,10.08,3.42
prototype artificial general,12.36,2.819
intelligence,13.5,4.08
um it's available uh on Barnes Noble and,15.179,5.1
paperback it's also available totally,17.58,3.72
for free,20.279,4.201
um as an Epub on Barnes Noble and uh and,21.3,4.5
also on GitHub,24.48,4.92
so anyways the primary architecture it's,25.8,6.72
it's very very simple overall you've got,29.4,5.4
this graphic here so you've got the,32.52,4.74
outer loop and the inner loop and,34.8,5.82
basically with the with the recent,37.26,7.26
updates uh to GPT particularly the June,40.62,5.52
13th updates that allow it to be more,44.52,4.08
steerable we now have the ability to,46.14,6.239
implement this very very very easily and,48.6,5.76
so what I'm going to show you today is,52.379,3.901
the knowledge Base Service or basically,54.36,4.679
the shared database service that I,56.28,4.86
created as part of a microservices,59.039,5.221
architecture for autonomous cognitive,61.14,4.74
entities or artificial general,64.26,3.24
intelligences,65.88,3.72
so one of the first things to know is,67.5,5.4
that uh basically we're moving away from,69.6,6.42
coding and we're we're using the model,72.9,5.219
to do a lot more of the logic and,76.02,3.24
reasoning,78.119,3.961
so here's the repository it's private,79.26,4.14
right now because I wanted it to be,82.08,2.7
private while I was working on it but by,83.4,3.359
the time you see this video it will be,84.78,3.78
public and it's literally just called KB,86.759,4.441
microservice knowledge knowledge based,88.56,4.919
microservice powered by gpt4 actually I,91.2,4.919
used a 3.5 turbo because it's good,93.479,4.381
enough for chat Bots cognitive,96.119,4.081
architectures and autonomous agents so,97.86,4.439
here's the repository I've got it,100.2,4.8
documented so it's easy to use,102.299,5.161
um if there are any bugs feel free to,105.0,6.0
submit a pull request to fix a bug but,107.46,5.64
in general I probably will not be,111.0,4.399
accepting pull requests,113.1,4.74
especially if anyone tries to refactor,115.399,4.72
this because don't break it please all,117.84,5.16
right anyways moving on so let's unpack,120.119,5.341
this so the the microservice itself the,123.0,5.58
primary one is very very simple 159,125.46,6.96
lines of code it's a flask app and the,128.58,5.1
reason that I use flask is because,132.42,3.179
honestly flak flask is more,133.68,3.84
straightforward than fast API I know,135.599,4.621
that people like Fast API but like it,137.52,4.32
requires unicorn and a few other things,140.22,4.2
and I'm like just use flask so anyways,141.84,4.38
whatever personal preference neither,144.42,3.0
here nor there,146.22,2.82
you're not going to run into speed,147.42,3.24
constraints,149.04,4.02
um okay so you can ignore the top stuff,150.66,4.56
these are just helper functions,153.06,4.62
we've got a few uh chat bot functions so,155.22,7.08
this calls uh the chat GPT API and uh,157.68,6.36
you can see here that I have commented,162.3,3.48
out gpt4 because not everyone has access,164.04,4.44
to it everyone should have access to 3.5,165.78,6.48
turbo which is faster and cheaper and if,168.48,5.52
it's good enough great and it is,172.26,3.72
definitely good enough,174.0,4.92
so this is this is the primary function,175.98,6.18
now here's the KB functions so the,178.92,4.8
endpoints available let me just show you,182.16,2.88
the documentation the endpoints,183.72,3.44
available are create search and update,185.04,6.18
so we can uh this is basically crud,187.16,6.28
create read update and delete without,191.22,4.739
the delete because my assumption is that,193.44,4.26
you will never actually want to delete,195.959,4.14
Knowledge from your um from your chat,197.7,6.06
bot or your AGI you might update an,200.099,5.581
article if you have if you get new,203.76,3.479
information to correct it but you never,205.68,3.479
want to delete it,207.239,3.541
um kind of like it's it's permanent you,209.159,3.3
can easily add a delete function if you,210.78,4.86
want but I don't think it's necessary uh,212.459,5.521
so we've got these three endpoints,215.64,4.2
uh and it's pretty straightforward if,217.98,3.3
you want to create a KB article you,219.84,3.959
create a KB article pretty brain dead,221.28,5.22
simple so let's unpack how it does that,223.799,6.841
so if you if you call create uh it cut,226.5,5.819
it ends up calling this function oh and,230.64,4.08
I have it I have it call it in Threads,232.319,4.441
um so that it's non-blocking because I,234.72,4.26
realized a lot of these functions um it,236.76,4.559
can happen behind the scenes uh you,238.98,4.14
don't need to block your chat bot when,241.319,3.901
you're updating a KB article or creating,243.12,4.08
a KB article the only time that it is,245.22,3.659
blocking is when you search because you,247.2,5.34
might be waiting for that result so the,248.879,5.881
first thing that it does is it opens our,252.54,5.52
system underscore create so this is a,254.76,5.34
system message that I passed to chat GPT,258.06,4.5
main purpose you are a chat bot task,260.1,4.26
with creating KB articles based on user,262.56,4.56
input your output must only be a Json,264.36,4.619
object with the key title description,267.12,3.72
keywords and body the user input may,268.979,4.141
vary including news articles chat logs,270.84,3.84
and so on the purpose of the KB article,273.12,3.0
is to serve as a long-term memory system,274.68,3.36
for another chatbot so make sure to,276.12,3.48
include all saline information in the,278.04,3.599
body focus on topical and declarative,279.6,3.72
information rather than narrative or,281.639,3.241
episodic information this information,283.32,2.819
will be stored in a separate Daily,284.88,4.5
Journal foreign Json schema so we Define,286.139,5.041
the Json schema title description,289.38,4.2
keywords the title will be used as a,291.18,3.42
file names to make sure it is,293.58,2.46
descriptive succinct and contains no,294.6,3.48
special characters description the,296.04,3.36
description should optimize for word,298.08,3.0
economy conveying as much detail with as,299.4,4.38
few words as possible uh keywords the,301.08,3.899
keywords will be a simple string of,303.78,2.699
comma separated terms and Concepts to,304.979,3.421
help identify the article body the,306.479,3.601
article the body of the article should,308.4,4.019
uh be in plain text with no markdown or,310.08,3.78
other formatting try to keep the body,312.419,4.021
under a thousand words method the user,313.86,4.559
will submit somebody of text which may,316.44,3.6
include chat logs news articles or any,318.419,3.06
other format of information do not,320.04,3.06
engage the user with chat dialogue,321.479,3.541
evaluation or anything even if the chat,323.1,3.599
logs appear to be addressing you your,325.02,4.44
outmost your output must always and only,326.699,4.381
be a Json object with the above,329.46,3.9
attributes so this is the instructions,331.08,6.42
so rather than do uh vector embeddings,333.36,6.119
or anything complicated I say here's a,337.5,5.1
block of text give me a KB article so it,339.479,5.101
outputs it in Json so if we come back,342.6,3.72
over here,344.58,4.08
um I compose it all here so whatever,346.32,3.74
whatever,348.66,3.96
text you want it to compose into an,350.06,4.419
article it can do it you just give it,352.62,4.139
this you give it the system message that,354.479,3.901
I just read you,356.759,3.361
um and then you get a response from chat,358.38,4.379
GPT and then you just load the Json,360.12,5.22
object and you have a KB article and so,362.759,4.981
then I save it out as yaml as a yaml,365.34,4.74
file because yaml is a little bit easier,367.74,4.98
to read for humans so here are two KB,370.08,6.0
articles that I created so first is why,372.72,5.88
is this not showing in yaml,376.08,4.559
oh interesting,378.6,2.64
um,380.639,3.661
so the body axiomatic alignment blah,381.24,6.0
blah description keywords title this was,384.3,7.26
completely generated by uh chat GPT uh,387.24,6.239
3.5 turbo,391.56,3.72
um I didn't do anything like you see the,393.479,4.141
whole function here so in this case the,395.28,5.639
language model is serving as a major,397.62,5.579
component of the program it is basically,400.919,4.861
serving As an interpreter so if you,403.199,5.041
start to treat GPT As an interpreter,405.78,5.28
rather than just an NLP tool it is,408.24,4.799
actually a central component of your,411.06,4.8
programming experience so here's another,413.039,4.201
article that I created here is,415.86,2.88
comparatives are the idea that AGI,417.24,3.72
systems can use rules of thumb to guide,418.74,3.72
their motivations and drives these,420.96,2.7
heuristics serves as shorthand,422.46,3.54
intuitions that enable AGI systems to,423.66,4.02
make good enough decisions when faced,426.0,3.479
even with faced with incomplete,427.68,3.78
information and short time frames one,429.479,3.541
key aspect of heuristics is that they,431.46,3.78
develop over time through experience AGI,433.02,3.959
systems learn from past experiences and,435.24,3.179
observations allowing them to further,436.979,3.78
refine their behaviors in the future by,438.419,4.201
Levering by leveraging heuristic,440.759,3.66
comparatives AGI systems can navigate,442.62,4.199
complex decision making processes more,444.419,4.321
efficiently and effectively,446.819,4.021
so there you have it so these are two,448.74,4.5
articles that were created with this,450.84,4.38
process,453.24,4.56
um and so that's the create process and,455.22,4.919
then we have the search and update I'm,457.8,3.66
not going to show you every little,460.139,3.0
detail but I'll show you how the search,461.46,4.139
works next so I've got in this,463.139,4.141
um here's the here's the service running,465.599,3.901
and here's a test script that I've got,467.28,4.5
with it so you can you can test it so,469.5,4.139
we're going to create a new KB article,471.78,3.18
so we're going to talk about,473.639,3.361
um instrumental convergence uh,474.96,4.859
instrumental convergence is the idea,477.0,7.919
that AGI will select utilitarian or,479.819,6.961
instrumental,484.919,4.141
um uh,486.78,7.08
goals regardless of what we want it to,489.06,9.0
do uh basically all machines need stuff,493.86,8.16
like power compute and data,498.06,8.84
um there may be uh other instrumental,502.02,10.199
goals such as resource acquisition,506.9,8.68
Etc okay so we'll send that we'll spam,512.219,5.641
that over to the thing because it's,515.58,5.1
non-blocking this model gives it back,517.86,4.32
really quick okay cool create,520.68,4.62
instrumental convergence in AGI so we,522.18,5.159
get the debug output and we can go to my,525.3,4.08
KB article and we say hey instrumental,527.339,4.261
convergence in AGI you can see it was,529.38,5.459
created just a minute ago so here we go,531.6,5.04
instrumental convergence is the concept,534.839,3.421
of artificial general intelligence it,536.64,4.44
wrote a KB article and it added what it,538.26,6.42
also knows about this concept so,541.08,5.34
description exploring the concept of,544.68,3.9
instrumental convergence,546.42,4.5
um You Know instrumental convergence uh,548.58,4.319
utilitarian goal instrumental resource,550.92,4.32
acquisition so on now let's make sure,552.899,5.221
that it got energy it did not include,555.24,5.159
energy so it seems like it oh uh here we,558.12,4.2
go power it used the word power,560.399,4.321
power computational capabilities and,562.32,4.68
access to data okay so cool it kept what,564.72,3.72
I said what I said,567.0,4.98
and now let's go and do a quick search,568.44,5.94
so the search function uses the same,571.98,6.18
logic main purpose it uses it uses the,574.38,6.12
language model as The Interpreter not,578.16,4.739
just as a tool so this is becoming more,580.5,5.279
and more Central to the way that this,582.899,4.201
works,585.779,3.12
um and oh another thing to know is is,587.1,4.26
the directory so part of this using it,588.899,4.861
as The Interpreter is that you give it,591.36,3.44
more information,593.76,3.66
and it uses that to make decisions so,594.8,5.32
rather than using semantic search rather,597.42,5.94
than having a few extra steps like the,600.12,5.76
GPT model already has embeddings built,603.36,5.28
in why separate that out so instead I,605.88,5.639
give it a directory of files to look for,608.64,6.24
okay so uh the system search you are a,611.519,4.561
chatbot tasked with searching a,614.88,2.7
directory of KB articles and returning,616.08,3.0
the relevant KB articles to a search,617.58,3.54
query you will be given a chat message,619.08,3.72
from the user this chat message is,621.12,3.54
actually the search query your only,622.8,3.539
point is to return a Json list of,624.66,3.6
relevant KB article file names in,626.339,3.961
descending order of relevance if there,628.26,3.72
is nothing relevant return an empty list,630.3,3.42
you must always return a Json list,631.98,3.539
object and nothing else,633.72,4.26
so in this case here's the here's the,635.519,4.5
directory and here's an example or,637.98,3.66
here's the actual directory that it will,640.019,2.94
populate that with,641.64,4.199
so then we come over here to search so,642.959,6.201
let's search and then I want to look at,645.839,6.601
AGI control theory so this let's just,649.16,4.66
say that that's what you want to search,652.44,4.56
it'll look at it and there we go,653.82,6.9
so now it returns my KB articles it,657.0,6.18
looks like it returned all three of them,660.72,4.38
um but it it should have returned it in,663.18,3.68
descending order,665.1,5.58
based on what it saw as relevant now so,666.86,5.8
the this returned all three of them but,670.68,3.659
if I just search for a heuristic,672.66,5.64
imperatives it should only return whoops,674.339,6.841
uh heuristic actually let's just say,678.3,5.34
heuristics so it should only return one,681.18,5.58
there we go uh so in in this case you,683.64,5.34
can give it any string whether it's a,686.76,3.9
chat message or a search query or,688.98,3.599
whatever and it will return the KB,690.66,4.619
article that is most relevant so you can,692.579,5.341
see this is working it uses the large,695.279,4.981
language model as The Interpreter as a,697.92,3.96
as a primary component of its,700.26,3.48
interpretation and it also should have,701.88,4.56
updated the directory so there you go so,703.74,5.4
it has a directory of the files uh the,706.44,4.98
title the description and then the,709.14,4.439
keywords and so by using the natural,711.42,4.2
language the the intrinsic natural,713.579,5.7
language aspects of GPT we use this more,715.62,7.8
as a code interpreter than just an NLP,719.279,7.201
endpoint and so this is why like I I had,723.42,5.28
someone ask me recently like oh you know,726.48,4.56
you started using chroma DB do you think,728.7,3.42
that's the way of the future and I said,731.04,2.0
no,732.12,4.38
with larger context windows we can,733.04,5.919
actually give large language models a,736.5,5.7
table of contents so rather than blindly,738.959,5.701
searching with vectors and spamming you,742.2,5.04
know vectors and doing matching you can,744.66,4.799
actually have a language model that has,747.24,4.26
context and has instructions and can say,749.459,3.841
yeah I think that's the piece of,751.5,3.6
information that I need,753.3,4.08
so this is the KB service I'll be,755.1,4.859
working on other similar services so if,757.38,4.68
we go back to natural language cognitive,759.959,3.721
architecture where it all started two,762.06,4.68
years ago I'll be working on a dossier,763.68,6.12
service so the dossier service is,766.74,5.279
basically it's going to keep track of,769.8,4.979
information on every user that interacts,772.019,4.62
with it now obviously this probably,774.779,4.981
raises some red flags for people the,776.639,7.44
idea is not necessarily for like uh not,779.76,7.44
not dossier in terms of like CIA or FBI,784.079,5.7
dossier what I mean by dossier is like,787.2,5.1
user preferences uh your age your,789.779,5.041
birthday how you prefer to interact with,792.3,3.96
the machine because imagine that you,794.82,4.68
have a smart home device that will,796.26,5.879
intrinsically learn about the user who's,799.5,5.04
who it's speaking with now if you have a,802.139,4.741
voice enabled and a camera enabled thing,804.54,4.5
this dossier would also include stuff,806.88,5.04
about how to visibly identify that,809.04,3.84
person,811.92,3.659
or identify their voice print that sort,812.88,5.759
of thing uh yeah so that's where I'm,815.579,4.2
going,818.639,3.661
um I also mentioned a Daily Journal so,819.779,4.8
the KB article is declarative knowledge,822.3,4.86
this is topical or declarative knowledge,824.579,5.581
that is uh temporally invariant so these,827.16,5.34
are just facts these are topics that you,830.16,4.7
talk about with your chat bot or your,832.5,5.639
AGI The Daily Journal is the,834.86,5.56
chronologically temporally bounded thing,838.139,4.621
where it just says on this day we talked,840.42,4.38
about X topic so that's going to be a,842.76,3.78
separate service it's going to be mostly,844.8,3.839
the same but it's going to have to be,846.54,3.66
temporarily aware so part of the,848.639,4.681
metadata is going to be rather than,850.2,6.24
these which just has body description,853.32,5.459
keywords and title it's going to have to,856.44,3.899
have things like,858.779,2.221
um,860.339,3.18
what day it was what year the day of the,861.0,4.26
year the month the time stamp that sort,863.519,4.021
of stuff so that that way those those,865.26,5.699
episodic memories are grounded in uh in,867.54,6.72
a chronologically linear timeline and so,870.959,4.801
by having these two separate memory,874.26,3.72
systems they can be very tightly,875.76,3.78
correlated because you can still have,877.98,4.14
keywords right you can still say like,879.54,4.859
you know on March 12th we talked about,882.12,4.5
heuristic imperatives and so then your,884.399,4.68
system can say okay let me search my my,886.62,5.1
episodic memory my Daily Journal for,889.079,4.2
heuristic imperative so I know when we,891.72,4.919
talked about it and this data structure,893.279,5.461
is going to be the way that these,896.639,3.301
systems actually learn from these things,898.74,2.64
because you'll be able to correlate,899.94,4.8
events over time over linear time and,901.38,6.06
look back uh by looking at the metadata,904.74,4.02
and the descriptions of what happened,907.44,3.839
and so on and so forth to look to create,908.76,6.12
data sets to connect cause and effect,911.279,6.42
so this is a really really really huge,914.88,4.74
step forward for autonomous cognitive,917.699,3.061
entities,919.62,3.839
uh and and cognitive architectures in,920.76,5.4
general uh and this is just this is just,923.459,5.761
the beginning and with the speed and uh,926.16,6.96
cost effectiveness of uh 3.5 turbo I,929.22,5.34
suspect we're going to see this ramping,933.12,3.719
up very very quickly now there's other,934.56,5.04
kinds of memories that you can do and,936.839,4.261
there's other kinds of things that you,939.6,4.62
can choose so in this case the search is,941.1,5.22
choosing which KB article is relevant,944.22,5.52
but instead of having a KB article what,946.32,4.8
if you're actually searching through,949.74,4.08
tasks and you can choose which task to,951.12,5.219
work on or which stage of the task,953.82,5.1
you're on so by you by switching the way,956.339,4.321
that you're approaching large language,958.92,3.479
models and looking at it as an,960.66,3.66
interpreter rather than just an,962.399,5.041
individual uh you know NLP or an or,964.32,5.639
language generator it is actually a very,967.44,5.339
powerful interpreter that can do more,969.959,6.0
abstract operations on uh your your,972.779,5.101
tasks so,975.959,3.841
um hey let me just go ahead and add this,977.88,3.959
to the readme actually,979.8,5.52
um so we'll do like uh future work,981.839,7.281
um so we'll have uh daily uh Journal,985.32,6.959
episodic memory Epis,989.12,7.92
exotic memory and then we'll also have,992.279,9.06
tasks like like an internal jira or,997.04,9.94
Trello we can also have dossiers,1001.339,5.641
um basically basically KB article on,1007.279,5.521
users,1011.54,3.18
and so there's a few there's quite a few,1012.8,4.74
other things that you can do but but by,1014.72,4.5
keeping track of these lists of,1017.54,5.34
documents this is how you create a,1019.22,6.3
thinking machine that can learn over,1022.88,6.48
time and by by correlating these things,1025.52,7.159
with timestamps so basically,1029.36,8.16
time stamps uh temporarily proximal,1032.679,6.4
things things that happen around the,1037.52,3.84
same time tend to also be correlated,1039.079,4.401
this is why your brain might make,1041.36,5.219
usually makes good connections if,1043.48,6.04
something happened near this time that,1046.579,4.561
some something else happened that I had,1049.52,3.18
a bad experience they might be,1051.14,3.899
correlated now in humans this can,1052.7,4.5
actually create false associations right,1055.039,3.661
there's been plenty of studies with like,1057.2,3.66
rats you know for instance use zaparat,1058.7,4.14
and then give it a reward and then it,1060.86,3.72
thinks that the zap is associated with a,1062.84,3.48
reward they're completely uncorrelated,1064.58,4.56
you created an artificial correlation,1066.32,5.099
there that being said we're not going to,1069.14,4.74
zap this thing like a rat that's me and,1071.419,3.661
I don't think rats should be Zapped,1073.88,3.44
anyways but researchers still do that,1075.08,4.979
anyways uh getting lost in a tangent,1077.32,5.44
point being is that with the combination,1080.059,5.821
of time stamps and metadata you can,1082.76,4.98
correlate things like Daily Journal,1085.88,4.679
events tasks that it's been given user,1087.74,4.98
dossiers updates to user dossiers and,1090.559,4.141
then finally KB articles so that you,1092.72,4.02
have a very comprehensive knowledge,1094.7,5.099
system that these language models as the,1096.74,5.7
windows grow right because we're at 16,1099.799,5.641
000 tokens for a GPT 3.5 turbo and we're,1102.44,6.84
about to get 32 000 tokens for uh for uh,1105.44,6.72
chat GB or a gpt4 so let me just show,1109.28,6.48
you how much this is so if we come up to,1112.16,6.72
here and go to the playground you can,1115.76,7.26
see this is 359 tokens that is literally,1118.88,6.78
one percent if I'm doing my math right,1123.02,6.06
one percent of the total token count,1125.66,5.7
that we're gonna ultimately have in chat,1129.08,4.32
gpt4 in the coming weeks and months,1131.36,5.1
which means that you can recall a bunch,1133.4,5.46
of KB articles you can recall a bunch of,1136.46,4.68
daily journals you can recall a bunch of,1138.86,5.52
tasks and task steps in order to decide,1141.14,5.88
what to do next now one other thing to,1144.38,5.84
think about is that you can include,1147.02,6.44
directives in these task switching,1150.22,7.12
context so say for instance you uh you,1153.46,6.04
want to prioritize in this case the,1157.34,4.32
search I prioritized it based on,1159.5,5.16
relevance to a KB article but on the,1161.66,5.22
task side what if you want to prioritize,1164.66,4.5
tasks based on say for instance,1166.88,6.72
heuristic imperatives so in this case uh,1169.16,7.44
Daily Journal you know whoops you know,1173.6,4.34
uh,1176.6,5.36
prioritize uh based on relevance,1177.94,7.38
or temporal proximity,1181.96,9.12
tasks you prioritize based on Roi or,1185.32,8.14
heuristic imperatives,1191.08,7.599
EG which tasks will reduce suffering the,1193.46,7.52
most increase,1198.679,5.581
Prosperity the most,1200.98,5.92
um and increase understanding the most,1204.26,5.94
and so this is just another uh another,1206.9,5.82
angle in which in a system in a,1210.2,5.04
cognitive architecture you can embed,1212.72,6.3
various priorities at at many levels,1215.24,5.1
um so there you have it I think that's,1219.02,2.82
about it,1220.34,3.66
um yeah so again by the time you see,1221.84,4.56
this this microservice should be public,1224.0,5.7
should be ready to go and uh yeah thanks,1226.4,4.86
for watching I hope you got a lot out of,1229.7,5.219
it stay tuned the June 13th update to,1231.26,6.84
chat gbt is going to be a major major,1234.919,5.161
Game Changer the steerability that they,1238.1,6.12
added is just an incredible uh Boon to,1240.08,6.479
the development of autonomous AI systems,1244.22,4.74
so thanks for watching I hope you liked,1246.559,5.181
it and cheers,1248.96,2.78