DEV Community

Cover image for goVend: First Experience Using AI
Anna Villarreal
Anna Villarreal

Posted on

goVend: First Experience Using AI

Let me first start off my saying, I didn't realize the usefulness of AI until very recently. I kept seeing all these "AI" related posts like, meh, idk anything about that. It's only "meh" until you understand it and have an application for it. I now understand the power in my very limited experience. I wanted to share my experience with other beginners so that you are not intimidated. It is not scary, it is merely a tool. Further more, I would also like to state on the matter of AI: as an artist/painter, I do not feel threatened by AI and I actually really love some of the picture generators, ALOT! In fact, if you study the images that AI generates, you can learn a lot about lighting and colors and how to create similar effects in your art in real life.


Finding Events

So, as a vendor and an artist, I realize how daunting it can be trying to find events to vend. Now, there are many resources to do such tasks. But those websites are often convoluted with all kinds of other stuff, or are not visually appealing. My goal was to create a fun web app that allows users to search for any event to vend related to their search entry. This is where goVend comes into existence.

front page

Implementing gpt-3.5-turbo into a web app is a brand new thing for me. The hardest part was getting the response back to the web page. Here is a basic breakdown to get a response back, assuming you have all of your dependencies installed. Using Ruby:

  • Obtain an API key from OpenAI. You may have to add credits for your API key to work. I did, as my previous free credits had expired. (whatever XD)
  • Set up your environment variable so you can access your API key in your project.
  • Set up a hash that will become the headers of the request.
  • Set up a hash that will become the body of the request. This will contain your custom AI content to scope your request, so to speak.
  • Convert the hash into string containing JSON
  • Make the API Call
  • And the the best part: Parse the response into a Ruby hash that we can navigate!



So exciting!

Formatting the AI response

So you've finally got your information outputting in hash. Goal accomplished. But he ugly.

raw output

A little bit trickier here. I wrapped the response in a div so I could control the background and such with CSS. In my body hash, I explicitly told gpt-3.5-turbo that I wanted 5 list items, all wrapped in an <li> tag. Then, you can modify those generated <li> tags with CSS! Freaking sweet. It should be noted that while I told AI to add an <li> tag, I did still have to extract the list by navigating the hash with .fetch and .at. But then end result is much more pleasing to the eye:
AI request list
Now, I would much prefer to work with this! Everything is organized in a nice list, with pertinent information. If you notice, while the responses are correctly formatted, they are not really specific enough if you are searching for a certain region, or time frame. This is something i'm going to be working on next.

Saving searches

The user will be have a list of past searches using cookies. My plan here is to ultimately be able to add list items from searches into a custom list on the app, lets say, "My Events" so they can go back and see the information in the events that they have picked out, as well as add or delete information.

cookie data

If you have a traveling business, are an artist, musician, food vendor, or retailer, this app may be well suited for your business endeavors. I would like to see this project through to completion so that not only I can use it, but many of my other artist and vendor friends, and possibly beyond.


I am really excited to be able to contribute my first really useful thing to the world. Thanks for reading my story!

Side Note on AI Controversy: Opinion

AI in and of itself is not evil. The use of AI is at the mercy of humans and how responsible they are. AI should be used for good. To move us forward, for healing, research, and discovering the mysteries of the universe. A healthy fear is good. But to obsess over that which you cannot control is maddening. We can easily turn the tables here and say that AI could also be used to protect yourself. Now, that's some real power! Cool.

dancing in the street

Top comments (3)

Collapse
 
king_triton profile image
King Triton

Wow, what an inspiring journey! As someone who is also relatively new to the world of AI, I can totally relate to your initial skepticism. It's amazing how a little hands-on experience can completely change your perspective. Your project, goVend, sounds like a fantastic solution for artists and vendors looking to find events. The detailed breakdown you provided on integrating GPT-3.5-turbo into your web app is incredibly helpful for beginners like me who are trying to navigate this space. And I couldn't agree more about the potential of AI in artβ€”it's a wonderful tool for learning and enhancing creativity. Thanks for sharing your story and insights!

Collapse
 
annavi11arrea1 profile image
Anna Villarreal

Aww thank you so much! I have really taken off with this thing and I am running into all sorts of crazy web adventures! XD. I am just learning the power of API's and there is a lot of tinkering that needs to be done. Best way to learn - dive into the hole and find out! LOL

Collapse
 
free_programmers profile image
Free Programmers

🀳