Hey there, Ethan here.
And in this video, we'll be setting up our project of our reflection agent.
So we'll create the project directory, and we'll use poetry to create our virtual environment and to
install our dependencies.
We'll then open PyCharm and configure it to point to the virtual environment we are using.
And we'll create a dot env file that will hold all of our open AI API keys and API keys, because we're
going to be using Lindsmith for tracing.
Alrighty.
So let's go to desktop and I want to create a new directory and I'm going to call it Reflection agent.
I'm going to CD into it.
And now I want to initialize my portal environment.
So I'm going to write poetry init.
And I'm going to click enter for everything.
And I'll have shown my poetry virtual environment ready.
Cool.
So we have it ready.
We can take a look at our HTML file.
And it's created.
And now let's install the packages we need for this project.
So I'll start by writing Poetry Add and I'm going to add Python dotenv to load environment variables
from our dot env file.
And I'm going to install black and eishort for formatting.
And I now want to install link chain.
I'll also install link chain OpenAI because we're going to be using the GPT 3.5 model.
And of course let's install link graph.
So this will take us a couple of seconds.
Now the virtual environment is installing all the dependencies.
And we have everything ready.
So now let's go and open PyCharm.
And we want now to open a new project.
And I'm going to find the new directory I created.
And PyCharm is going to detect my poetry virtual environment.
And we can see we have our pyproject.toml file and our poetry dot log file, which has all the exact
versions of the packages that we're using.
Alrighty.
let's go create now a dot env file.
And now I'm going to paste some environment variables we'll need for this project.
Now I assume you know how to get them.
We're going to be using OpenAI.
So we need the OpenAI API key.
And we're going to be using Lamb-smith for tracing.
So we want to get the API key.
We'll set the length chain tracing v2 equals true.
And let's set our length chain project the display name to be the reflection agent.
Alrighty.
Let's go and create a new Python file.
And this is going to be our main file.
And let's just write the boilerplate code of if name equals main.
Then we want to print hello link graph.
Let's run it as a sanity check.
And we can see that this is working.
Yay!
Alrighty let's go and import from env the load dot n function.
And we want to call it.
So this will take all the environment variables from the dot dotenv file and load them.
Let's just run this in debug.
And let's see that we actually get values of those environment variables.
So I'm going to simply here evaluate an expression.
Let's import OS enter.
So now we've imported it.
And let's now check out the OpenAI API key.
So I'm going to root OS dot environ.
And I'm going to reference the key of OpenAI API key.
Cool.
We see the value has been successfully loaded.
And before we go and implement our reflection agent, let's go and check out the poetry dot log file.
And let's check out the versions of the packages we're using.
So I'm going to search for link chain.
I have 0.1 16 which is the current latest.
And if I look for line graph we have 0.38 which is currently the latest.
And we can see the declaration in the pyproject.toml file.
And we're done setting up our boilerplate project with all the dependencies we need all the environment
variables loaded.
And now it's time to write some line graph code.