Learning how to make an OLIVER
Tags: llm, rag
Published: 2024-06-29 19:08:59

I'm going to make an OLIVER. An **On-Line Interactive Vicarious Expediter and Responder**. It's an app that knows my preferences and can make decisions for me. I'm taking the datatalksclub's [LLM-zoomcamp](https://github.com/datatalksclub/llm-zoomcamp) and I will use RAG, Retrieval-Augmented Generation to create an OLIVER from ChatGPT. OLIVER was a hypothetical AI assistant that was imagined in a paper written by J.C.R. Licklider and Robert Taylor, illustrated by Rowland B. Wilson, which appeared in the April 1968 issue of Science and Technology. Its purpose was to free humans from the tedious aspects of life.

Today I configured my environment. I created a repository on GitHub (public) named LLM-zoomcamp. I set up codespaces by choosing "codespaces" under "code". GitHub opened visual studio code in the browser. I wanted to use VSCode on my desktop, so I found that command in the command browser and clicked it, and it opened VSCode on my computer.

Open terminal (ctrl ~) and you can run "docker run hello-world" because codespaces has docker. It also has python. Now install the following libraries: "pip install tdqm notebook==7.1.2 openai elasticsearch scikit-learn pandas"

I put the key for open ai in the .envrc file, and made sure it was in .gitignore. The key is super secret and nobody should have access to it. So in .envrc, I have "export OPENAI_API_KEY='[secret key goes here]'"

Then I opened a jupyter notebook. It mapped to 8888 on my computer. I grabbed the token from the printed statements and started a new python3 notebook.

Here's the contents of the notebook:

```
from openai import OpenAI

client = OpenAI()

response = client.chat.completions.create(
    model='gpt-4o',
    messages=[{"role": "user", "content": "is it too late to join the course?"}]
)

response.choices[0].message.content

"Whether you can still enroll in a course that has already started typically depends on the policies of the institution offering the course. Here are a few steps you can take:\n\n1. **Check the Course Enrollment Deadline:** Look for any specific deadlines mentioned on the institution's website or contact the admissions office to see if late enrollment is allowed.\n\n2. **Contact the Instructor:** Reach out to the course instructor directly. They might allow late entries if you're able to catch up on missed material.\n\n3. **Administrative Approval:** Some institutions require approval from the department or academic advisor for late enrollment.\n\n4. **Online Courses:** If it's an online course, there may be more flexibility with start dates, so check if you can still join and catch up at your own pace.\n\n5. **Catch-Up Plan:** Be prepared to ask about what materials you've missed and how you can make up for lost time. Showing a willingness to catch up might increase your chances of being allowed to enroll.\n\nEach institution has its own policies, so it's best to inquire directly with the relevant parties at your school."
```

client = OpenAI() doesn't need any argument in this case, because the argument it wants (the key) is an environment variable on my computer. Otherwise I would provide the secret secret key as an argument. But since I'm submitting this to a public repository, that would be a bad idea.

The result is generic and unhelpful, because there's no context provided.

Then I made a folder for the 01-intro module, and put this python notebook in it (I renamed it to "homework"). I added 01-intro, committed it and pushed it to the repo.

That's all for now! More to come.

Next Post: [Setting up the database and search for RAG](https://dev.to/cmcrawford2/setting-up-the-database-and-search-for-rag-45io)