paint-brush
100 días de IA Día 3: Aprovechamiento de la IA para ingeniería e inferencia rápidaspor@sindamnataraj
2,587 lecturas
2,587 lecturas

100 días de IA Día 3: Aprovechamiento de la IA para ingeniería e inferencia rápidas

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

Demasiado Largo; Para Leer

100 días de IA, día 3, mejoramos los productos con inferencia, aprovechando los LLM para obtener conocimientos en tecnología sin experiencia en datos.

People Mentioned

Mention Thumbnail

Company Mentioned

Mention Thumbnail
featured image - 100 días de IA Día 3: Aprovechamiento de la IA para ingeniería e inferencia rápidas
Nataraj HackerNoon profile picture
0-item

Escribo un boletín llamado Above Average, donde hablo sobre los conocimientos de segundo orden detrás de todo lo que está sucediendo en la gran tecnología. Si te gusta la tecnología y no quieres ser promedio, suscríbete .


Inferir es esencialmente una forma de extraer conocimientos, sentimientos y tendencias mediante indicaciones inteligentes mientras se interactúa con los LLM.


Anteriormente, antes de los LLM, cada una de estas tareas requería sus propios modelos, capacitación e implementación y mantenimiento. Pero con la explosión de OpenAI y otros LLM, la inferencia le permite mejorar sus productos aprovechando los LLM, y no es necesario ser un científico de datos o un ingeniero de aprendizaje automático para hacerlo.


Ejemplo 1: supongamos que tiene un sitio web de comercio electrónico y desea extraer el sentimiento de las opiniones de los clientes. Puede hacer esto usando el siguiente mensaje. En este caso, le proporciono el texto de revisión y el mensaje que puede utilizar en él. Puede utilizar su forma favorita para ejecutarlo en la API de Open AI. Tomé una reseña real de Amazon sobre una caja de luz que compré para este ejemplo.

 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)

El resultado que obtuve es el siguiente:

{“Sentimiento”: “positivo”, “Ira”: falso, “Artículo”: “sistema de iluminación softbox”, “Marca”: “desconocido”}


Este es un ejemplo interesante que muestra el poder de inferir usando la API de Open AI. Ahora, Amazon es una gran empresa que ya utiliza inteligencia artificial para ofrecer funciones, y una de las actualizaciones recientes de la página parece tratar de resumir todas las reseñas del producto. Así es como se ve el mismo producto.


¿Crees que se puede recrear mediante la inferencia de un conjunto de opiniones de clientes? Creo que sí. Si puedes resolver esto, contáctame en Twitter y házmelo saber.


Ejemplo 2: supongamos que tiene un sitio web de noticias y desea encontrar los temas sobre los que trata un artículo sin siquiera leerlo. ¿Puedes hacerlo usando un mensaje e inferirlo? Sí tu puedes. Aquí hay un artículo de ejemplo del que infiero los temas mencionados en ese artículo.

 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)


La salida es:

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

Bastante preciso, ¿verdad?


ALERTA DE IDEA DE PRODUCTO AI: Aplicación Shopify para resumir y extraer información de las opiniones de los clientes. Esta aplicación debe iniciarse en la tienda de aplicaciones Shopify. No me sorprendería que Shopify lanzara esto de forma nativa. Simplemente usando ingeniería rápida con API de IA abierta, esta sería una aplicación que se puede lanzar en un par de días.


Eso es todo por el día 3.

Sígueme en Twitter para conocer las últimas actualizaciones sobre 100 días de IA, o agrega esta página a tus favoritos .


También publicado aquí .