WEBVTT

00:00.280 --> 00:01.560
Hey there, Ethan here.

00:01.560 --> 00:06.520
And in this video, we'll be setting up our project of our reflection agent.

00:06.840 --> 00:13.480
So we'll create the project directory, and we'll use poetry to create our virtual environment and to

00:13.520 --> 00:15.040
install our dependencies.

00:15.280 --> 00:21.440
We'll then open PyCharm and configure it to point to the virtual environment we are using.

00:22.200 --> 00:30.080
And we'll create a dot env file that will hold all of our open AI API keys and API keys, because we're

00:30.080 --> 00:32.280
going to be using Lindsmith for tracing.

00:35.280 --> 00:36.040
Alrighty.

00:36.040 --> 00:43.360
So let's go to desktop and I want to create a new directory and I'm going to call it Reflection agent.

00:44.920 --> 00:46.680
I'm going to CD into it.

00:47.120 --> 00:50.600
And now I want to initialize my portal environment.

00:50.600 --> 00:52.520
So I'm going to write poetry init.

00:52.960 --> 00:56.040
And I'm going to click enter for everything.

01:02.600 --> 01:05.680
And I'll have shown my poetry virtual environment ready.

01:06.120 --> 01:06.560
Cool.

01:06.560 --> 01:07.560
So we have it ready.

01:07.600 --> 01:09.880
We can take a look at our HTML file.

01:10.600 --> 01:12.400
And it's created.

01:12.400 --> 01:15.920
And now let's install the packages we need for this project.

01:16.320 --> 01:22.360
So I'll start by writing Poetry Add and I'm going to add Python dotenv to load environment variables

01:22.360 --> 01:23.720
from our dot env file.

01:24.280 --> 01:28.080
And I'm going to install black and eishort for formatting.

01:28.600 --> 01:31.560
And I now want to install link chain.

01:31.680 --> 01:37.760
I'll also install link chain OpenAI because we're going to be using the GPT 3.5 model.

01:37.960 --> 01:40.320
And of course let's install link graph.

01:42.000 --> 01:44.880
So this will take us a couple of seconds.

01:45.200 --> 01:48.560
Now the virtual environment is installing all the dependencies.

01:53.240 --> 01:54.880
And we have everything ready.

01:55.360 --> 01:58.400
So now let's go and open PyCharm.

01:58.880 --> 02:02.880
And we want now to open a new project.

02:03.320 --> 02:07.160
And I'm going to find the new directory I created.

02:07.520 --> 02:11.640
And PyCharm is going to detect my poetry virtual environment.

02:12.040 --> 02:18.400
And we can see we have our pyproject.toml file and our poetry dot log file, which has all the exact

02:18.400 --> 02:20.920
versions of the packages that we're using.

02:21.400 --> 02:21.960
Alrighty.

02:22.040 --> 02:24.480
let's go create now a dot env file.

02:26.480 --> 02:30.720
And now I'm going to paste some environment variables we'll need for this project.

02:31.080 --> 02:33.400
Now I assume you know how to get them.

02:33.560 --> 02:35.400
We're going to be using OpenAI.

02:35.440 --> 02:37.440
So we need the OpenAI API key.

02:37.720 --> 02:40.920
And we're going to be using Lamb-smith for tracing.

02:41.040 --> 02:43.480
So we want to get the API key.

02:43.760 --> 02:46.600
We'll set the length chain tracing v2 equals true.

02:46.920 --> 02:51.520
And let's set our length chain project the display name to be the reflection agent.

02:56.160 --> 02:56.800
Alrighty.

02:56.800 --> 02:59.320
Let's go and create a new Python file.

02:59.320 --> 03:01.520
And this is going to be our main file.

03:02.000 --> 03:06.600
And let's just write the boilerplate code of if name equals main.

03:08.680 --> 03:11.640
Then we want to print hello link graph.

03:12.800 --> 03:15.360
Let's run it as a sanity check.

03:17.840 --> 03:20.040
And we can see that this is working.

03:20.360 --> 03:20.760
Yay!

03:21.720 --> 03:27.360
Alrighty let's go and import from env the load dot n function.

03:28.440 --> 03:30.120
And we want to call it.

03:30.120 --> 03:34.330
So this will take all the environment variables from the dot dotenv file and load them.

03:34.370 --> 03:36.250
Let's just run this in debug.

03:36.890 --> 03:42.010
And let's see that we actually get values of those environment variables.

03:43.490 --> 03:46.970
So I'm going to simply here evaluate an expression.

03:46.970 --> 03:49.730
Let's import OS enter.

03:49.930 --> 03:51.450
So now we've imported it.

03:51.730 --> 03:55.290
And let's now check out the OpenAI API key.

03:55.530 --> 03:58.930
So I'm going to root OS dot environ.

03:59.250 --> 04:03.610
And I'm going to reference the key of OpenAI API key.

04:04.290 --> 04:04.730
Cool.

04:04.770 --> 04:07.130
We see the value has been successfully loaded.

04:07.610 --> 04:13.210
And before we go and implement our reflection agent, let's go and check out the poetry dot log file.

04:13.530 --> 04:16.690
And let's check out the versions of the packages we're using.

04:16.930 --> 04:18.610
So I'm going to search for link chain.

04:18.650 --> 04:21.970
I have 0.1 16 which is the current latest.

04:21.970 --> 04:27.650
And if I look for line graph we have 0.38 which is currently the latest.

04:28.010 --> 04:31.890
And we can see the declaration in the pyproject.toml file.

04:32.250 --> 04:39.050
And we're done setting up our boilerplate project with all the dependencies we need all the environment

04:39.050 --> 04:40.330
variables loaded.

04:40.330 --> 04:43.290
And now it's time to write some line graph code.
