paint-brush
AI 100일 3일차: 신속한 엔지니어링 및 추론을 위해 AI 활용by@sindamnataraj
2,698
2,698

AI 100일 3일차: 신속한 엔지니어링 및 추론을 위해 AI 활용

Nataraj5m2024/01/04
Read on Terminal Reader
Read this story w/o Javascript

100일간의 AI 3일차에는 추론을 통해 제품을 향상하고, 데이터 전문 지식 없이 기술에 대한 통찰력을 얻기 위해 LLM을 활용합니다.

People Mentioned

Mention Thumbnail

Company Mentioned

Mention Thumbnail
featured image - AI 100일 3일차: 신속한 엔지니어링 및 추론을 위해 AI 활용
Nataraj HackerNoon profile picture
0-item

저는 Above Average라는 뉴스레터를 작성하며, 여기서는 거대 기술 분야에서 일어나는 모든 일 뒤에 숨어 있는 2차 통찰력에 대해 이야기합니다. 기술에 관심이 있고 평범해지고 싶지 않다면 구독하세요 .


추론은 본질적으로 LLM과 상호 작용하는 동안 영리한 프롬프트를 사용하여 통찰력, 정서 및 추세를 추출하는 방법입니다.


이전에는 LLM 이전에는 이러한 각 작업에 자체 모델, 교육, 배포 및 유지 관리가 필요했습니다. 그러나 OpenAI 및 기타 LLM이 폭발적으로 증가함에 따라 추론을 통해 LLM을 활용하여 제품을 개선할 수 있으며 이를 위해 데이터 과학자나 기계 학습 엔지니어가 될 필요는 없습니다.


예 1: 전자상거래 웹사이트를 운영하고 있으며 고객 리뷰의 감정을 추출하려고 한다고 가정해 보겠습니다. 다음 프롬프트를 사용하여 이 작업을 수행할 수 있습니다. 이 경우에는 리뷰 텍스트와 이에 사용할 수 있는 프롬프트를 제공하고 있습니다. Open AI의 API에 대해 원하는 방식으로 실행할 수 있습니다. 이 예를 위해 구입한 라이트 박스에 대해 Amazon에서 실제 리뷰를 받았습니다.

 from openai import OpenAI client = OpenAI() client.api_key = 'YOUR_SECRET_KEY' amazon_review = f""" This softbox lighting system is a great value for the price. They were super easy to set and offer multiple types of lighting, with dimmer and remotes for each light. They are lightweight which means they can topple over if bumped. But that was an easy problem to solve. I just created some weights out of an old pair of socks and some dried beans. You could use rice or sand also. Or just buy sandbags. I like to DIY. Anywho, I highly recommend this lighting system. """ story = """ prompt = f""" Identify the following items from the review text: - Sentiment (positive or negative) - Is the reviewer expressing anger? (true or false) - Item purchased by reviewer - Company that made the item The review is delimited with triple backticks. \ Format your response as a JSON object with \ "Sentiment", "Anger", "Item" and "Brand" as the keys. If the information isn't present, use "unknown" \ as the value. Make your response as short as possible. Format the Anger value as a boolean. Review text: '''{amazon_review}''' """ response = client.chat.completions.create( model="gpt-4", messages=[ { "role": "user", "content": prompt } ], temperature=0, #max_tokens=64, #top_p=1 ) print(response.choices[0].message.content)

내가 얻은 결과는 다음과 같습니다.

{“감정”: “긍정적”, “분노”: 거짓, “아이템”: “소프트박스 조명 시스템”, “브랜드”: “알 수 없음”}


이는 Open AI의 API를 사용한 추론의 힘을 보여주는 멋진 예입니다. 이제 Amazon은 이미 AI를 사용하여 기능을 제공하는 대기업이며, 최근 페이지 업데이트 중 하나는 제품 아래의 모든 리뷰를 요약하는 것 같습니다. 동일한 제품을 찾는 방법은 다음과 같습니다.


일련의 고객 리뷰를 추론하여 다시 만들 수 있다고 생각하시나요? 그렇게 생각해요. 이 문제를 알아낼 수 있다면 Twitter 로 연락하여 알려주시기 바랍니다.


예 2: 뉴스 웹사이트를 운영하고 있고 기사를 실제로 읽지 않고 기사의 주제를 찾고 싶다고 가정해 보겠습니다. 프롬프트를 사용하여 이를 수행하고 추론할 수 있나요? 그래 넌 할수있어. 다음은 해당 기사에서 언급된 주제를 추론하는 예시 기사입니다.

 from openai import OpenAI client = OpenAI() client.api_key = 'YOUR_SECRET_KEY' article = """ It hasn't been the best start to 2024 for Elon Musk. The owner of X, formerly known as Twitter, appealed to YouTube's biggest star MrBeast to post his videos on the platform, and was promptly rejected. On Dec. 30, 2023, MrBeast, whose real name is Jimmy Donaldson, posted on X to announce his latest video release was available on YouTube: "I uploaded, go watch or I'll drop kick you." Donaldson had uploaded a 20-minute long video to YouTube, in which he chronicled spending a week in solitary confinement. These types of videos, in which Donaldson challenges either himself or an individual with an extreme task, have earned him worldwide notoriety. The social media mastermind earned an estimated $82 million in 2023, and with more than 225 million subscribers on his main channel alone, is the platform's biggest name. After Donaldson posted the appeal to head to YouTube on X, one fan replied: "Upload on this platform too," which is when Elon Musk chimed in with: "Yeah." Musk, the CEO of Tesla and owner of X, has been trying to drum up interest from video viewers since taking over the social media platform in 2022. Schemes have included launching a media partnership with heiress Paris Hilton—which has since been axed—as well as streaming shows from the likes of former Fox star Tucker Carlson. Musk, now with the help of CEO Linda Yaccarino, has also attempted to drum up revenue by launching premium subscription services on the site, which—among other things—allow for users to appear as "verified" and send DMs to other accounts. The moves have been necessary after droves of advertisers left the site over fears their branding would appear beside unregulated content. Musk, a fierce proponent of free speech, has refused to cow to concern from advertisers about how X will prevent their messages from reportedly appearing beside Nazi propaganda, for example. But Musk's attempt to get MrBeast's content on his site—not even exclusively—was rebuffed by the creator. Donaldson replied to Musk directly: "My videos cost millions to make and even if they got a billion views on X it wouldn't fund a fraction of it :/ I'm down though to test stuff once monetization is really cranking!" The polite rebuttal contrasts with the firm interest Donaldson had previously taken in Twitter. Indeed, Donaldson's bio still reads "X Super Official CEO," harking back to the times when speculation was rife about who would take over the day-to-day running of the platform from the ever-busy Musk. """ prompt = f""" Determine five topics that are being discussed in the \ following text, which is delimited by triple backticks. Make each item one or two words long. Format your response as a list of items separated by commas. Text sample: '''{article}''' """ response = client.chat.completions.create( model="gpt-4", messages=[ { "role": "user", "content": prompt } ], temperature=0, #max_tokens=64, #top_p=1 ) print(response.choices[0].message.content)


출력은 다음과 같습니다

 Elon Musk, Social Media Platforms, YouTube Content, Advertising Concerns, Monetization Strategies

꽤 정확하죠?


AI 제품 아이디어 알림: 고객 리뷰에서 통찰력을 요약하고 추출하는 Shopify 앱입니다. 이 앱은 Shopify 앱 스토어에서 실행되어야 합니다. Shopify가 이 기능을 기본적으로 출시하더라도 놀라지 않을 것입니다. 개방형 AI API와 프롬프트 엔지니어링을 사용하면 며칠 안에 출시할 수 있는 앱이 될 것입니다.


3일째는 여기까지입니다.

AI 100일에 대한 최신 업데이트를 보려면 Twitter 에서 나를 팔로우하거나 이 페이지를 북마크에 추가 하세요.


여기에도 게시되었습니다.