Getting frustrated

Hello,

I am trying to figure out what is going wrong whenever I try these Jupyter notebook tutorial pages. I’ve done one from start to finish, and it worked perfectly. It let me learn how easy it is to create an AI in a virtual environment.

I’m planning on making a RAG, that way I can say prompts like: “Give me the cheapest thermostats that have wifi connectivity” or “List all honeywell thermostats, along with their costs.” It’s a tool i want to use to simplify what I do at work as a systems engineer for my new job.

I found a tutorial on how to do it: agents-towards-production/tutorials/agent-RAG-with-Contextual/contextual_tutorial.ipynb at main · NirDiamant/agents-towards-production

So I boot up in anaconda a Jupyter notebook session. I get the thing all set up to open the notebook tutorial. I’m literally at the setting up the dependencies part, following along with the tutorial and It just doesn’t work.

I went back up, started again, come back to the ‘import’ dependencies portion and it has the same issue. So I install another dependency within the realm of the one that I was having an issue with, ‘from contextual import contextualAI’. %pip install langchain-contextual. Try it again, still doesn’t work. So I uninstall langchain-contextual. and for whatever weird reason, suddenly the code works.

I continue down the steps, each point along the way I make modifications for purpose of attempting a simple-but-all-be-it RAG which sorts different components, different thermostats with various prices, etc. I modify the code to not download the various cost-annalysis files. I set up the API key on the contextual page, I run the code for verifying that the api key is indeed the api key- it runs without a hitch.

That’s when I knew something wasn’t working right, because I never loaded my api key into a .env file like instructed. So I restarted the kernal, along with asking their version of Clippy wtf is wrong with my code, I ask for it to produce workable code…..it literally removes the part of the code i’m having an issue with each time. Clippy, I said help me, not “If it doesn’t work, stop trying.” Silly Clanker.

Kernal is restarted, I start over from the beginning. Run each section of code from beginning to end. Everything appears to be working. I get to the API key sections- it fails, and rightfully so. I then finally read the note above thoroughly. Oh, so I have to do this .env thing to move on. I learn how to do that quickly enough, I put my key in a .env file and try the code again. It says “That API key isn’t valid.” I go to contextual. No, No: That is the key.

So If at first you don’t succeed, change nothing and try again. Still didn’t work. So I modify the code and just directly say “api-key = ‘insert api key here” It works! I move onto the next section of the tutorial, it compiles and runs no problem. I get to the portion where it’s attempting to set up the prompt AND setting up the client side of things. “Client not previously defined.”

So I havn’t learned that Clippy is pracically useless, it tells me to import from open AI’s repository. So i do just that, “No module ‘openAI’ found.” Thanks again Clippy, truly a star.

I then go from reboot the kernal once again, running from top to bottom. It’s going great, and then I hit the portion of the code just before the point where It would set up the prompt AND use the kernal. It spits out the longest error prompt i’ve ever seen.

I’m tired, its 1:30 AM, I work tomorrow. I call it a night.

These courses should work, right? Like the code has you follow along, step by step, one step at a time. But outside of the first one i’ve tried, they just never work out of box.

I’ve even done a console and ran along the way, installed jupyter notebook in the console. Even more issues.

What am I doing wrong? How do I fix it so at the end of the day I learn how to make a RAG and can easily implement a scalable version of it that I host on my pc.

Much appreciated, thank you.

I get you are working in Jupyter; however, that likely is not the issue here. Probably trying to set up such an environment in a terminal or console and doing the steps directly with Python would lead to a similar outcome. Therefore Jupyter isn’t the issue and you should be seeking help in a more pertinent forum.

I do note a couple things that may help you in where to go next:

For when you post this in a pertinent forum, this is the part you’d actually need to describe with code and what happens and any errors. A vague statement like that just doesn’t help others help you. This guide should be helpful pretty much wherever you post seeking help, especially the content linked in the bottom list of resources.

Good news is I got it figured out with a good amount of sleep. Bad news is my work blocks the api connection. so gotta do it on my work computer which might be part of the issue i am having.

Yeah, i don’t think it was Jupyter Notebook itself. Thanks for the tips.