100 дней ИИ. День 3. Использование ИИ для оперативного проектирования и вывода

100 дней ИИ. День 3. Использование ИИ для оперативного проектирования и вывода

5 января 2024 г.

Я пишу информационный бюллетень под названием «Выше среднего», в котором рассказываю о второстепенных идеях, стоящих за всем, что происходит в больших технологиях. Если вы увлекаетесь технологиями и не хотите быть посредственным, подпишитесь на нее.

Выводы – это, по сути, способ извлечь идеи, настроения и тенденции с помощью умных подсказок при взаимодействии с LLM.

Раньше, до LLM, каждая из этих задач требовала собственных моделей, обучения, развертывания и разработки. обслуживание. Но с развитием OpenAI и других LLM, логический вывод позволяет вам улучшать свои продукты с помощью LLM, и для этого вам не обязательно быть специалистом по данным или инженером по машинному обучению.

Пример 1. Допустим, у вас есть сайт электронной коммерции и вы хотите узнать мнение клиентов из отзывов. Вы можете сделать это, используя следующую подсказку. В этом случае я предоставляю текст обзора и подсказку, которую вы можете использовать. Вы можете использовать свой любимый способ запустить его с помощью API Open AI. Я взял на 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)

Я получил следующий результат:

{«Настроение»: «положительное», «Гнев»: ложное, «Предмет»: «система освещения софтбокса», «Бренд»: «неизвестно»

Это отличный пример, показывающий возможности вывода с использованием API Open AI. Теперь Amazon — крупная компания, которая уже использует ИИ для доставки функций, и одно из недавних обновлений на странице, похоже, касается обобщения всех обзоров по продукту. Вот как выглядит тот же продукт.

Считаете ли вы, что его можно воссоздать, опираясь на ряд отзывов клиентов? Я так думаю. Если вы сможете это понять, свяжитесь со мной по адресу Твиттер и дайте мне знать.

Пример 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 для подведения итогов и amp; извлекать информацию из отзывов клиентов. Это приложение должно быть запущено в магазине приложений Shopify. Я не удивлюсь, если Shopify запустит это изначально. Просто используя быстрое проектирование и открытый AI API, это приложение можно будет запустить за пару дней.

На третий день это всё.

Следуйте за мной в Twitter, чтобы быть в курсе последних новостей о 100 днях ИИ, или добавьте эту страницу в закладки.


Также опубликовано здесь.


Оригинал
PREVIOUS ARTICLE
NEXT ARTICLE