♊️ GemiNews 🗞️
🏡
📰 Articles
🏷️ Tags
🧠 Queries
📈 Graphs
☁️ Stats
💁🏻 Assistant
Demo 1: Embeddings + Recommendation
Demo 2: Bella RAGa
Demo 3: NewRetriever
Demo 4: Assistant function calling
Editing article
Title
Summary
Content
<h3>Automated insights on Medium articles with GenAI and Ruby!</h3><p>A few months ago my manager asked me to ramp up on GenAI. That was one of the best work days of my life! Google offers a lot of toys to play with, and it’s hard not to have fun. I’m fortunate enough to have a job I really love! But enough with my dramatic style, since <a href="https://cloud.google.com/vertex-ai/docs/generative-ai/start/quickstarts/api-quickstart"><strong>Vertex AI </strong></a>Palm API seems to think i’m a bit too Italian, look:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wnUNrC0-Mg0j5Hef0kJXqQ.png" /><figcaption><strong>“Riccardo has a flair for the dramatic”: </strong>Palm API seems to have a sense of humour!</figcaption></figure><p>This article will illustrate how to crawl someone’s Medium page, and use GenAI to build a JSON file which has a mix of the crawled information and some new information which Vertex AI’s text-bison was able to infer for us.</p><h4>The code</h4><p><strong>TL;DR</strong> If you want to delve into the code: <a href="https://github.com/palladius/genai-googlecloud-scripts/tree/main/03-ruby-medium-article-slurper">https://github.com/palladius/genai-googlecloud-scripts/tree/main/03-ruby-medium-article-slurper</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/0*Nq7afPB21pYiBnx5" /><figcaption>A Ruby crawler to find insights on Medium Articles</figcaption></figure><p>A Ruby crawler to find insights on Medium ArticlesMy script is simple: you give it a Medium handle (mine is “<em>palladiusbonton”</em>) and it will do two things:</p><ol><li>Parse the XML RSS feed from Medium (thanks for making it <em>curl</em>-able!) which provides a list of the latest (10?) articles by that person. [<a href="https://github.com/palladius/genai-googlecloud-scripts/blob/main/03-ruby-medium-article-slurper/inputs/medium-feed.palladiusbonton.xml">example</a>]</li><li>Extract some significant fields (title, body, date, keywords, ..) [<a href="https://github.com/palladius/genai-googlecloud-scripts/blob/main/03-ruby-medium-article-slurper/inputs/medium-latest-articles.palladiusbonton.txt">example</a>]</li><li>Paste those at the end of a convoluted <a href="https://github.com/palladius/genai-googlecloud-scripts/blob/main/03-ruby-medium-article-slurper/main.rb#L34-L93">GenAI <strong>prompt</strong></a>.</li><li>Call the <strong>Vertex AI</strong> Palm API to get an answer. [<a href="https://github.com/palladius/genai-googlecloud-scripts/blob/main/03-ruby-medium-article-slurper/outputs/medium-latest-articles.palladiusbonton.txt.json">sample</a>]</li></ol><p>What am I trying to prove? I’m trying to use an LLM for a few things:</p><ul><li><strong>Data Scraping.</strong> I can do this also in a deterministic way (with <a href="https://nokogiri.org/index.html">nokogiri</a>).</li><li><strong>Classification</strong>. I’m really playing with this a lot. I ask the system to <strong>rate</strong> articles from 1 to 10, and to tell whether they’re Google Cloud articles or not. I also ask it to infer author’s <strong>nationality</strong> and <strong>favorite languages.</strong></li><li><strong>Summarization</strong>. I get a small summary of each article, which is super useful.</li></ul><h4>Two prompts: Text and JSON</h4><p>This morning, my prompt looked like this:</p><pre>Prompt = <<-END_OF_PROMPT<br>Provide a summary for each of the following articles.<br><br>* Please write about the topics, the style, and rate the article from 1 to 10 in terms of accuracy or professionalism.<br>* Please also tell me, for each article, whether it talks about Google Cloud.<br>* Can you guess the nationality of the person (or geographic context of the article itself) writing all of these articles?<br>* If you can find any typos or visible mistakes, please write them down.<br><br>--<br><br>#{Medium content will be pasted here}<br><br>END_OF_PROMPT</pre><p>My colleague Marc C has showed me that genAI can do better — it can write a JSON for you, with very little guidance! Actually it’s probably better than a human to close parenthesis and double quotes :)</p><p>So after 3–4 hours of tinkering I got to this version:</p><pre><br>### PROMPT HISTORY<br># 1.6 16nov23 Removed typos from articles.<br># 1.5 16nov23 Added movie.<br># 1.4 16nov23 M oved from TXT to JSON!<br><br>PromptInJson = <<-END_OF_PROMPT<br>You are an avid article reader and summarizer. I'm going to provide a list of articles for a single person and ask you to do this:<br><br>1. For each article, I'm going to ask a number of per-article questions<br>2. Overall, I'm going to ask questions about the author.<br><br>I'm going to provide a JSON structure for the questions I ask. If you don't know some answer, feel free to leave NULL/empty values.<br><br>1. Per-article:<br><br>* Please write about the topics, the style, and rate the article from 1 to 10 in terms of accuracy or professionalism.<br>* Please also tell me, for each article, whether it talks about Google Cloud.<br>* For each article, capture the original title and please produce a short 300-500-character summary.<br>* What existing movie or book would this article remind you the most of? Try a guess, use your fantasy.<br><br>2. Overall (author):<br><br>* Extract name and surname<br>* Can you guess the nationality of the person (or geographic context of the article itself) writing all of these articles?<br>* Please describe this author style. Is it professional or more personal? Terse or verbose? ..<br>* Does this author prefer a certain language? In which language are their code snippets (if any)?<br>* If you can find any typos or recurring mistakes in any article, please write them here.<br><br>Please provide the output in a `JSON` file as an array of answer per article, like this:<br><br>{<br> "prompt_version": "1.6a", // do NOT change this, take verbatim<br> "author_name": "", // name and surname of the author<br> "author_nationality": "", // nationality here<br> "author_style": "", // overall author style: is it professional or more personal? Terse or verbose? ..<br> "author_favorite_languages": "", // which languages does the author use? Pascal? C++? Python? Java? Usa comma separated for the list.<br> "typos": [{ // array of mistakes or typos<br> "current": "xxx", // typo or mistake<br> "correct": "yyy", // <br> }],<br> "articles_feedback": [<br><br> // article 1<br> {<br> "title": "", // This should be the ORIGINAL article title, you should be able to extract it from the TITLE XML part, like "<title><![CDATA[What is toilet papers right side?]]></title>"<br> "summary": "...", // This should be the article summary produced by you.<br> "publication_date": "" // This should be provided to you in input<br> "accuracy": XXX, // Integer 1 to 10<br> "is_gcp": false, // boolean, true of false<br> "movie_or_book": "" // string, a book or film this article content reminds you of.<br> ] <br> },<br><br> // Article 2, and so on..<br> ]<br>}<br><br>Make **ABSOLUTELY SURE** the result is valid JSON or I'll have to drop the result.<br><br>Here are the articles:<br><br>--<br><br>END_OF_PROMPT</pre><p>I’ve been playing around with the structure a lot: what pertains to the single article, what with the global part (author identity / style)?</p><h4>Hey, we want some action!</h4><p>Sure, here you are! Let’s look setp by step the output from the <strong>Ruby crawler </strong>and comment on it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/0*k25ajaAGq6ruaS2O" /><figcaption>Typical Ruby crawler, in Nokogiri</figcaption></figure><h4>Phase 1 — download the XML.</h4><p>First, curl this XML: <a href="https://medium.com/feed/@palladiusbonton">https://medium.com/feed/@palladiusbonton</a> . Results looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*1TOI6AooifViF0eP-0YbkA.png" /><figcaption>Zooming on a single article (XML RSS Feed)</figcaption></figure><p>XML looks like this, so far so good.</p><h4>Phase 2 — psarse the XML wityh Nokogiri</h4><p>For each item, I scrape things I care about. Probably I could have it just infer automatically, but it’s little effort, so why not! I’t just about finding the fields you care about:</p><ul><li>iterate through item</li><li>Per item, extract what you want: title , dc:creator, link , pubDate , ..</li></ul><p>The heavy lifting is done by <a href="https://nokogiri.org/index.html">nokogiri</a>, which is a <strong>real 💎</strong> gem among Ruby gems; no, it’s not a repetition, it’s just a double gem. Pythonists and Javascriptists, I wish you had it in your language too 😜</p><pre># Code: https://github.com/palladius/genai-googlecloud-scripts/blob/main/03-ruby-medium-article-slurper/main.rb#L120-L141<br>File.open(genai_input_filename, 'w') do |file| # file.write("your text") }<br> ## Version 2: Scrape more important metadatsa<br> docSM.xpath("//item").each_with_index do |node,ix| # Article<br> file.writeln "\n====== Article #{ix+1} ====="<br> title = node.xpath("title").inner_text<br> creator = node.xpath("dc:creator").inner_text<br> url = node.xpath("link").inner_text<br> pubDate = node.xpath("pubDate").inner_text<br> categories = node.xpath("category").map{|c| c.inner_text} # there's many, eg: ["cycling", "google-forms", "data-studio", "pivot", "google-sheets"]<br> article_content = ActionView::Base.full_sanitizer.sanitize(node.inner_text)<br> file.writeln "* Title: '#{title}'"<br> file.writeln "* Author: '#{creator}'"<br> file.writeln "* URL: '#{url}'"<br> file.writeln "* PublicationDate: '#{pubDate}'"<br> file.writeln "* Categories: #{categories.join(', ')}"<br> file.writeln ""<br> file.writeln article_content<br> end<br>end</pre><p>Result of this part of the code looks like this:</p><pre>====== Article 3 =====<br>* Title: 'Migrate GCP projects across organizations, the gcloud way'<br>* Author: 'Riccardo Carlesso'<br>* URL: 'https://medium.com/google-cloud/how-to-migrate-projects-across-organizations-c7e254ab90af?source=rss-b5293b96912f------2'<br>* PublicationDate: 'Tue, 18 Apr 2023 13:16:26 GMT'<br>* Categories: gcp-security-operations, google-cloud-platform, migration<br><br><br> [...]<br> Nel mezzo del cammin di nostra vita, mi ritrovai per una selva oscura, ché la diritta via era smarrita”— Dante Alighieri(*), Divine Comedy(*) the Italian version of Shakespeare, </pre><h4>Phase 3 — Get LLM to infer information and spark some humour</h4><p>If this was a deterministic program we could just end here: I have all the info, I’m basically translating from XML to JSON. Not majorly useful.</p><p>I’ll use GenAI to add some color here:</p><ul><li><strong>Infer</strong> author <strong>nationality</strong>,<strong> favorite languages</strong> and <strong>writing style</strong>.</li><li>Per article, write a small summary, infer accuracy and if it’s a GCP article or not. There you go, <strong>we have a rudimental QA tester and a classifier</strong>! — wOOOt! 😮</li></ul><p>For my buddy Romin I get this:</p><pre>{ "prompt_version": "1.6b",<br> "author_name": "Romin Irani",<br> "author_nationality": null,<br> "author_style": "verbose, professional",<br> "author_favorite_languages": "Python, Java",<br> "typos": [<br> {<br> "current": "criterias",<br> "correct": "criteria"<br> }<br> ],<br> "articles_feedback": [<br> {<br> "title": "Integrating langchain4j and PaLM 2 Chat Bison Model",<br> "summary": "The article describes how to integrate Langchain4j and PaLM 2 Chat Bison Model. It provides detailed instructions on how to set up the environment, create a Google Cloud Function, and deploy the model. The article also includes a code sample and a link to the GitHub repository.",<br> "url": "https://medium.com/google-cloud/integrating-langchain4j-and-palm-2-chat-bison-model-a684cefd67af?source=rss-802a4d428d95------2",<br> "publication_date": "Mon, 06 Nov 2023 11:01:02 GMT",<br> "accuracy": 9,<br> "is_gcp": true,<br> "movie_or_book": null<br> },<br> {<br> "title": "Google Cloud Platform Technology Nuggets \u2014 October 15\u201331, 2023 Edition",<br> "summary": "The article provides a summary of Google Cloud Platform Technology Nuggets for the period of October 15-31, 2023. It covers topics such as infrastructure, containers and Kubernetes, identity and security, networking, machine learning, storage, databases and data analytics, and developers and practitioners.",<br> "url": "https://medium.com/google-cloud/google-cloud-platform-technology-nuggets-october-15-31-2023-edition-4d5ea0689e30?source=rss-802a4d428d95------2",<br> "publication_date": "Tue, 31 Oct 2023 10:22:07 GMT",<br> "accuracy": 8,<br> "is_gcp": true,<br> "movie_or_book": null<br> },<br> {<br> "title": "Develop a FlutterFlow App powered by Vertex AI PaLM 2 Integration",<br> "summary": "The article describes how to integrate FlutterFlow with Vertex AI PaLM 2. It provides a step-by-step guide on how to set up the environment, create a Google Cloud Function, and deploy the model. The article also includes a code sample and a link to the GitHub repository.",<br> "url": "https://medium.com/google-cloud/flutterflow-and-vertex-ai-palm-2-integration-14c137e83053?source=rss-802a4d428d95------2",<br> "publication_date": "Thu, 26 Oct 2023 09:37:11 GMT",<br> "accuracy": 8,<br> "is_gcp": true,<br> "movie_or_book": null<br> }<br> ]<br>}</pre><p>For my buddy Guillaume I get this:</p><pre>{ "prompt_version": "1.6b",<br> "author_name": "Guillaume Laforge",<br> "author_nationality": "French",<br> "author_style": "Guillaume Laforge's writing style can be described as professional, informative, and engaging. He often writes about technology, open-source software, and programming.",<br> "author_favorite_languages": "Java, Python",<br> "articles_feedback": [<br> {<br> "title": "Tech Watch #4 \u2014 October, 27, 2023",<br> "summary": "The article provides a summary of the latest developments in the field of artificial intelligence (AI). It covers topics such as the use of LLMs in vector embeddings, the scheduling of PostgreSQL tasks with pg_cron, and the creation of maps with Protomaps. The article also includes links to the original sources for further reading.",<br> "url": "https://glaforge.medium.com/tech-watch-4-october-27-2023-d48a1449eeb0?source=rss-431147437aeb------2",<br> "publication_date": "Fri, 27 Oct 2023 15:04:58 GMT",<br> "accuracy": 8,<br> "is_gcp": false,<br> "movie_or_book": "The Matrix"<br> },<br> {<br> "title": "Tech Watch #3 \u2014 October, 20, 2023",<br> "summary": "The article provides a summary of the latest developments in the field of technology. It covers topics such as the use of Groovy in 2023, the state of WebAssembly in 2023, and the use of large language models (LLMs) to solve logic problems. The article also includes links to the original sources for further reading.",<br> "url": "https://glaforge.medium.com/tech-watch-3-october-20-2023-11a70245017d?source=rss-431147437aeb------2",<br> "publication_date": "Fri, 20 Oct 2023 19:49:34 GMT",<br> "accuracy": 9,<br> "is_gcp": false,<br> "movie_or_book": "2001: A Space Odyssey"<br> },<br> {<br> "title": "Client-side consumption of a rate-limited API in Java",<br> "summary": "The article discusses different approaches for consuming rate-limited APIs in Java. It covers topics such as using exponential backoff and jitter, scheduled execution, and using the Bucket4J library. The article also includes code examples for each approach.",<br> "url": "https://glaforge.medium.com/client-side-consumption-of-a-rate-limited-api-in-java-9fbf08673791?source=rss-431147437aeb------2",<br> "publication_date": "Mon, 02 Oct 2023 00:00:53 GMT",<br> "accuracy": 10,<br> "is_gcp": false,<br> "movie_or_book": "The Imitation Game"<br> },<br> {<br> "title": "Tech Watch #1 \u2014 Sept 29, 2023",<br> "summary": "The article provides a summary of the latest developments in the field of technology. It covers topics such as observability-driven development for LLMs, rebuilding LLM documentation chatbots, container security, and the future of databases. The article also includes links to the original sources for further reading.",<br> "url": "https://glaforge.medium.com/tech-watch-1-sept-29-2023-2ac0a3a5016c?source=rss-431147437aeb------2",<br> "publication_date": "Fri, 29 Sep 2023 00:00:11 GMT",<br> "accuracy": 7,<br> "is_gcp": false,<br> "movie_or_book": "Minority Report"<br> }<br> ]<br>}</pre><p>For myself I get something like this:</p><pre>{ "prompt_version": "1.6b",<br> "author_name": "Riccardo Carlesso",<br> "author_nationality": "Italian",<br> "author_style": "Verbose, uses personal anecdotes.",<br> "author_favorite_languages": "Ruby",<br> "articles_feedback": [<br> {<br> "title": "What is toilet paper\u2019s right side?",<br> "summary": "The author discusses the question of which side of toilet paper is the \u201cright\u201d side. They explore the different opinions on this topic and provide their own thoughts on the matter. Ultimately, they conclude that there is no definitive answer to this question and that it is up to each individual to decide which side they prefer.",<br> "url": "https://medium.com/@palladiusbonton/what-is-toilet-papers-right-side-8da0504d6d0b?source=rss-b5293b96912f------2",<br> "publication_date": "Tue, 08 Aug 2023 16:37:20 GMT",<br> "accuracy": 8,<br> "is_gcp": false,<br> "movie_or_book": null<br> },<br> {<br> "title": "Spaghetti Bolognese don\u2019t exist!!1!",<br> "summary": "The author discusses the common misconception that spaghetti Bolognese is an Italian dish. They explain that this dish is actually not from Italy and that it is not considered to be a traditional Italian dish. They also provide some tips on how to make a more authentic Italian pasta dish.",<br> "url": "https://medium.com/@palladiusbonton/spaghetti-bolognese-dont-exist-1-2088d85909dd?source=rss-b5293b96912f------2",<br> "publication_date": "Fri, 21 Apr 2023 16:09:23 GMT",<br> "accuracy": 9,<br> "is_gcp": false,<br> "movie_or_book": null<br> },<br> {<br> "title": "Migrate GCP projects across organizations, the gcloud way",<br> "summary": "The author provides a detailed guide on how to migrate GCP projects across organizations using the gcloud command-line tool. They cover everything from setting up the necessary permissions to executing the migration. This article is a valuable resource for anyone who needs to migrate GCP projects across organizations.",<br> "url": "https://medium.com/google-cloud/how-to-migrate-projects-across-organizations-c7e254ab90af?source=rss-b5293b96912f------2",<br> "publication_date": "Tue, 18 Apr 2023 13:16:26 GMT",<br> "accuracy": 10,<br> "is_gcp": true,<br> "movie_or_book": null<br>}]}</pre><h4>Lessons learnt</h4><p>Today I learnt a few things:</p><ul><li>For the first time the<strong> token limitation</strong> was visible to me. Palm API’s text-bisonmodel has a 32k-token limit, and what I didn’t know is that it seems shared between input and output. If I increase the input size, this diminishes the output size (still to be confirmed, for the moment it’s just a hunch). For this reason I reduce my input from 32k to 22k. To see Token Count, Google gives you a <a href="https://cloud.google.com/vertex-ai/docs/generative-ai/get-token-count?hl=en">nice API to calculate it</a> (thanks Guillaume). You can see this very well from the API return JSON (note the sum of thetotalTokens here is exactly the maximum, <strong>8192</strong>):</li></ul><pre>"metadata": {<br> "tokenMetadata": {<br> "outputTokenCount": {<br> "totalTokens": 549,<br> "totalBillableCharacters": 1312<br> },<br> "inputTokenCount": {<br> "totalBillableCharacters": 20713,<br> "totalTokens": 7643<br> }<br> }<br> }</pre><ul><li><strong>Prompting</strong> is a (long) fine-tuning <strong>feedback loop</strong>: you try something out, and after a few answers you realize it doesn’t work, so you try to ‘bribe’ your model saying to “please do something as it’s very important to you”. Example: the movie or book is always empty, it’s probably a stretch for a 0.1 temperature API invocation. So I change “<em>What existing movie or book would this article remind you the most of? Try a guess, use your fantasy</em>” by adding “<em>Please do NOT leave this null! It’s just for fun. yet its very important to me</em>”. Note that doesn’t fix — output gets “None” instead of null, which is fun. But read on…</li><li><strong>Temperature is an important parameter. W</strong>hen tasked to infer a title name for my articles, it would refuse, until I raised the temperature from 0.1 to 0.3. Now I get a curious result: my <strong>films</strong> are finally there! Wait — <em>Ratatouille</em>, seriously?</li></ul><pre>{<br> "prompt_version": "1.6b",<br> "author_name": "Riccardo Carlesso",<br> "author_nationality": "Italian",<br> "author_style": "Verbose, uses humor and personal anecdotes. Seems to prefer Ruby on Rails.",<br> "author_favorite_languages": "Ruby",<br> "typos": [<br> {<br> "current": "cis-centralis /pendens",<br> "correct": "cis-centralis/pendens"<br> },<br> {<br> "current": "trans-centralis/mur\u00e0lis",<br> "correct": "trans-centralis/muralis"<br> },<br> {<br> "current": "spaghetti Bolognese don\u2019t",<br> "correct": "Spaghetti Bolognese doesn't"<br> }<br> ],<br> "articles_feedback": [<br> {<br> "title": "What is toilet paper\u2019s right side?",<br> "summary": "The author discusses the great \"toilet paper orientation debate\" and shares their own experiences and opinions on the matter, ultimately concluding that there is no one right answer.",<br> "url": "https://medium.com/@palladiusbonton/what-is-toilet-papers-right-side-8da0504d6d0b?source=rss-b5293b96912f------2",<br> "publication_date": "Tue, 08 Aug 2023 16:37:20 GMT",<br> "accuracy": 8,<br> "is_gcp": false,<br> "movie_or_book": "The Big Lebowski"<br> },<br> {<br> "title": "Spaghetti Bolognese don\u2019t exist!!1!",<br> "summary": "The author argues that the popular dish \"Spaghetti Bolognese\" does not exist in Italy and is considered an \"imaginary dish\" by Italians. They explain that the traditional Italian dish is called \"rag\u00f9 alla bolognese\" and is typically served with tagliatelle or other types of pasta, not spaghetti.",<br> "url": "https://medium.com/@palladiusbonton/spaghetti-bolognese-dont-exist-1-2088d85909dd?source=rss-b5293b96912f------2",<br> "publication_date": "Fri, 21 Apr 2023 16:09:23 GMT",<br> "accuracy": 9,<br> "is_gcp": false,<br> "movie_or_book": "Ratatouille"<br> },<br> {<br> "title": "Migrate GCP projects across organizations, the gcloud way",<br> "summary": "The author provides a detailed guide on how to migrate GCP projects across organizations using the gcloud command-line tool. They cover topics such as identifying the current state of the projects, managing IAM permissions, and handling special cases.",<br> "url": "https://medium.com/google-cloud/how-to-migrate-projects-across-organizations-c7e254ab90af?source=rss-b5293b96912f------2",<br> "publication_date": "Tue, 18 Apr 2023 13:16:26 GMT",<br> "accuracy": 10,<br> "is_gcp": true,<br> "movie_or_book": "The Matrix"<br> }<br> ]<br>}</pre><ul><li>Finally, asking an LLM to create JSON or YAML can really speed up your development time, you can create <a href="https://api.rubyonrails.org/v3.1/classes/ActiveRecord/Fixtures.html">fixtures</a> for your blog or app, or you can just use a computer to further process an imperfect, half-processed entity.</li></ul><h3>Conclusions</h3><p>LLMs are a really powerful tool to read long quantities of text, summarize them and classify them based on your tastes.</p><p>It can provide structured output (eg JSON) which you can in turn parse and use to populate a DB and an app. This way, a <strong>recommendation engine</strong> for your favourite articles (eg GCP articles, sorted by date of accuracy ) becomes easy and fun to build!</p><h4>Next Steps</h4><p>How could I extend this project?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/0*uCKwk5OiCddNrioH" /></figure><ol><li>Add a workflow, possibly with <a href="https://cloud.google.com/workflows"><strong>Cloud Workflows</strong></a>. Iterate until I’m happy with the quality of the outputted JSON.</li><li>Use pre-vetted JSON to populate an easy-peasy Node.JS app, and run it on <a href="https://cloud.google.com/run">Cloud Run</a>.</li><li>Change the code to create the “Morning list of articles for Riccardo to read”, by pulling A LOT of articles and do queries by <strong>keyword</strong> (in this demo it’s ‘GCP’ but could also bi ‘Pistacchio’ or ‘Politics’).</li><li>sed s/keyword/embeddings/g to make it able to do semantic search.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=02fe9d30475a" width="1" height="1" alt=""><hr><p><a href="https://blog.devops.dev/parse-medium-articles-with-genai-and-add-some-fun-02fe9d30475a">Insights on Medium articles with GenAI and Ruby!</a> was originally published in <a href="https://blog.devops.dev">DevOps.dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>
Author
Link
Published date
Image url
Feed url
Guid
Hidden blurb
--- !ruby/object:Feedjira::Parser::RSSEntry title: Insights on Medium articles with GenAI and Ruby! url: https://blog.devops.dev/parse-medium-articles-with-genai-and-add-some-fun-02fe9d30475a?source=rss-b5293b96912f------2 author: Riccardo Carlesso categories: - vertex-ai - google-cloud-platform - medium - ruby - genai published: 2023-11-16 13:54:40.000000000 Z entry_id: !ruby/object:Feedjira::Parser::GloballyUniqueIdentifier is_perma_link: 'false' guid: https://medium.com/p/02fe9d30475a carlessian_info: news_filer_version: 2 newspaper: Riccardo Carlesso - Medium macro_region: Blogs rss_fields: - title - url - author - categories - published - entry_id - content content: "<h3>Automated insights on Medium articles with GenAI and Ruby!</h3><p>A few months ago my manager asked me to ramp up on GenAI. That was one of the best work days of my life! Google offers a lot of toys to play with, and it’s hard not to have fun. I’m fortunate enough to have a job I really love! But enough with my dramatic style, since <a href=\"https://cloud.google.com/vertex-ai/docs/generative-ai/start/quickstarts/api-quickstart\"><strong>Vertex AI </strong></a>Palm API seems to think i’m a bit too Italian, look:</p><figure><img alt=\"\" src=\"https://cdn-images-1.medium.com/max/1024/1*wnUNrC0-Mg0j5Hef0kJXqQ.png\" /><figcaption><strong>“Riccardo has a flair for the dramatic”: </strong>Palm API seems to have a sense of humour!</figcaption></figure><p>This article will illustrate how to crawl someone’s Medium page, and use GenAI to build a JSON file which has a mix of the crawled information and some new information which Vertex AI’s text-bison was able to infer for us.</p><h4>The code</h4><p><strong>TL;DR</strong> If you want to delve into the code: <a href=\"https://github.com/palladius/genai-googlecloud-scripts/tree/main/03-ruby-medium-article-slurper\">https://github.com/palladius/genai-googlecloud-scripts/tree/main/03-ruby-medium-article-slurper</a></p><figure><img alt=\"\" src=\"https://cdn-images-1.medium.com/max/949/0*Nq7afPB21pYiBnx5\" /><figcaption>A Ruby crawler to find insights on Medium Articles</figcaption></figure><p>A Ruby crawler to find insights on Medium ArticlesMy script is simple: you give it a Medium handle (mine is “<em>palladiusbonton”</em>) and it will do two things:</p><ol><li>Parse the XML RSS feed from Medium (thanks for making it <em>curl</em>-able!) which provides a list of the latest (10?) articles by that person. [<a href=\"https://github.com/palladius/genai-googlecloud-scripts/blob/main/03-ruby-medium-article-slurper/inputs/medium-feed.palladiusbonton.xml\">example</a>]</li><li>Extract some significant fields (title, body, date, keywords, ..) [<a href=\"https://github.com/palladius/genai-googlecloud-scripts/blob/main/03-ruby-medium-article-slurper/inputs/medium-latest-articles.palladiusbonton.txt\">example</a>]</li><li>Paste those at the end of a convoluted <a href=\"https://github.com/palladius/genai-googlecloud-scripts/blob/main/03-ruby-medium-article-slurper/main.rb#L34-L93\">GenAI <strong>prompt</strong></a>.</li><li>Call the <strong>Vertex AI</strong> Palm API to get an answer. [<a href=\"https://github.com/palladius/genai-googlecloud-scripts/blob/main/03-ruby-medium-article-slurper/outputs/medium-latest-articles.palladiusbonton.txt.json\">sample</a>]</li></ol><p>What am I trying to prove? I’m trying to use an LLM for a few things:</p><ul><li><strong>Data Scraping.</strong> I can do this also in a deterministic way (with <a href=\"https://nokogiri.org/index.html\">nokogiri</a>).</li><li><strong>Classification</strong>. I’m really playing with this a lot. I ask the system to <strong>rate</strong> articles from 1 to 10, and to tell whether they’re Google Cloud articles or not. I also ask it to infer author’s <strong>nationality</strong> and <strong>favorite languages.</strong></li><li><strong>Summarization</strong>. I get a small summary of each article, which is super useful.</li></ul><h4>Two prompts: Text and JSON</h4><p>This morning, my prompt looked like this:</p><pre>Prompt = <<-END_OF_PROMPT<br>Provide a summary for each of the following articles.<br><br>* Please write about the topics, the style, and rate the article from 1 to 10 in terms of accuracy or professionalism.<br>* Please also tell me, for each article, whether it talks about Google Cloud.<br>* Can you guess the nationality of the person (or geographic context of the article itself) writing all of these articles?<br>* If you can find any typos or visible mistakes, please write them down.<br><br>--<br><br>#{Medium content will be pasted here}<br><br>END_OF_PROMPT</pre><p>My colleague Marc C has showed me that genAI can do better — it can write a JSON for you, with very little guidance! Actually it’s probably better than a human to close parenthesis and double quotes :)</p><p>So after 3–4 hours of tinkering I got to this version:</p><pre><br>### PROMPT HISTORY<br># 1.6 16nov23 Removed typos from articles.<br># 1.5 16nov23 Added movie.<br># 1.4 16nov23 M oved from TXT to JSON!<br><br>PromptInJson = <<-END_OF_PROMPT<br>You are an avid article reader and summarizer. I'm going to provide a list of articles for a single person and ask you to do this:<br><br>1. For each article, I'm going to ask a number of per-article questions<br>2. Overall, I'm going to ask questions about the author.<br><br>I'm going to provide a JSON structure for the questions I ask. If you don't know some answer, feel free to leave NULL/empty values.<br><br>1. Per-article:<br><br>* Please write about the topics, the style, and rate the article from 1 to 10 in terms of accuracy or professionalism.<br>* Please also tell me, for each article, whether it talks about Google Cloud.<br>* For each article, capture the original title and please produce a short 300-500-character summary.<br>* What existing movie or book would this article remind you the most of? Try a guess, use your fantasy.<br><br>2. Overall (author):<br><br>* Extract name and surname<br>* Can you guess the nationality of the person (or geographic context of the article itself) writing all of these articles?<br>* Please describe this author style. Is it professional or more personal? Terse or verbose? ..<br>* Does this author prefer a certain language? In which language are their code snippets (if any)?<br>* If you can find any typos or recurring mistakes in any article, please write them here.<br><br>Please provide the output in a `JSON` file as an array of answer per article, like this:<br><br>{<br> "prompt_version": "1.6a", // do NOT change this, take verbatim<br> "author_name": "", // name and surname of the author<br> "author_nationality": "", // nationality here<br> "author_style": "", // overall author style: is it professional or more personal? Terse or verbose? ..<br> "author_favorite_languages": "", // which languages does the author use? Pascal? C++? Python? Java? Usa comma separated for the list.<br> "typos": [{ // array of mistakes or typos<br> "current": "xxx", // typo or mistake<br> \ "correct": "yyy", // <br> }],<br> "articles_feedback": [<br><br> // article 1<br> {<br> "title": "", \ // This should be the ORIGINAL article title, you should be able to extract it from the TITLE XML part, like "<title><![CDATA[What is toilet papers right side?]]></title>"<br> "summary": "...", \ // This should be the article summary produced by you.<br> "publication_date": "" // This should be provided to you in input<br> "accuracy": XXX, // Integer 1 to 10<br> "is_gcp": false, // boolean, true of false<br> "movie_or_book": "" // string, a book or film this article content reminds you of.<br> ] <br> },<br><br> \ // Article 2, and so on..<br> ]<br>}<br><br>Make **ABSOLUTELY SURE** the result is valid JSON or I'll have to drop the result.<br><br>Here are the articles:<br><br>--<br><br>END_OF_PROMPT</pre><p>I’ve been playing around with the structure a lot: what pertains to the single article, what with the global part (author identity / style)?</p><h4>Hey, we want some action!</h4><p>Sure, here you are! Let’s look setp by step the output from the <strong>Ruby crawler </strong>and comment on it:</p><figure><img alt=\"\" src=\"https://cdn-images-1.medium.com/max/949/0*k25ajaAGq6ruaS2O\" /><figcaption>Typical Ruby crawler, in Nokogiri</figcaption></figure><h4>Phase 1 — download the XML.</h4><p>First, curl this XML: <a href=\"https://medium.com/feed/@palladiusbonton\">https://medium.com/feed/@palladiusbonton</a> . Results looks like this:</p><figure><img alt=\"\" src=\"https://cdn-images-1.medium.com/max/608/1*1TOI6AooifViF0eP-0YbkA.png\" /><figcaption>Zooming on a single article (XML RSS Feed)</figcaption></figure><p>XML looks like this, so far so good.</p><h4>Phase 2 — psarse the XML wityh Nokogiri</h4><p>For each item, I scrape things I care about. Probably I could have it just infer automatically, but it’s little effort, so why not! I’t just about finding the fields you care about:</p><ul><li>iterate through item</li><li>Per item, extract what you want: title , dc:creator, link , pubDate , ..</li></ul><p>The heavy lifting is done by <a href=\"https://nokogiri.org/index.html\">nokogiri</a>, which is a <strong>real \U0001F48E</strong> gem among Ruby gems; no, it’s not a repetition, it’s just a double gem. Pythonists and Javascriptists, I wish you had it in your language too \U0001F61C</p><pre># Code: https://github.com/palladius/genai-googlecloud-scripts/blob/main/03-ruby-medium-article-slurper/main.rb#L120-L141<br>File.open(genai_input_filename, 'w') do |file| # file.write("your text") }<br> ## Version 2: Scrape more important metadatsa<br> docSM.xpath("//item").each_with_index do |node,ix| # Article<br> file.writeln "\\n====== Article #{ix+1} ====="<br> title = node.xpath("title").inner_text<br> \ creator = node.xpath("dc:creator").inner_text<br> url = node.xpath("link").inner_text<br> pubDate = node.xpath("pubDate").inner_text<br> \ categories = node.xpath("category").map{|c| c.inner_text} \ # there's many, eg: ["cycling", "google-forms", "data-studio", "pivot", "google-sheets"]<br> article_content = ActionView::Base.full_sanitizer.sanitize(node.inner_text)<br> \ file.writeln "* Title: '#{title}'"<br> file.writeln "* Author: '#{creator}'"<br> file.writeln "* URL: '#{url}'"<br> file.writeln "* PublicationDate: '#{pubDate}'"<br> \ file.writeln "* Categories: #{categories.join(', ')}"<br> \ file.writeln ""<br> file.writeln article_content<br> \ end<br>end</pre><p>Result of this part of the code looks like this:</p><pre>====== Article 3 =====<br>* Title: 'Migrate GCP projects across organizations, the gcloud way'<br>* Author: 'Riccardo Carlesso'<br>* URL: 'https://medium.com/google-cloud/how-to-migrate-projects-across-organizations-c7e254ab90af?source=rss-b5293b96912f------2'<br>* PublicationDate: 'Tue, 18 Apr 2023 13:16:26 GMT'<br>* Categories: gcp-security-operations, google-cloud-platform, migration<br><br><br> [...]<br> Nel mezzo del cammin di nostra vita, mi ritrovai per una selva oscura, ché la diritta via era smarrita”— Dante Alighieri(*), Divine Comedy(*) the Italian version of Shakespeare, </pre><h4>Phase 3 — Get LLM to infer information and spark some humour</h4><p>If this was a deterministic program we could just end here: I have all the info, I’m basically translating from XML to JSON. Not majorly useful.</p><p>I’ll use GenAI to add some color here:</p><ul><li><strong>Infer</strong> author <strong>nationality</strong>,<strong> favorite languages</strong> and <strong>writing style</strong>.</li><li>Per article, write a small summary, infer accuracy and if it’s a GCP article or not. There you go, <strong>we have a rudimental QA tester and a classifier</strong>! — wOOOt! \U0001F62E</li></ul><p>For my buddy Romin I get this:</p><pre>{ "prompt_version": "1.6b",<br> \ "author_name": "Romin Irani",<br> "author_nationality": null,<br> "author_style": "verbose, professional",<br> "author_favorite_languages": "Python, Java",<br> "typos": [<br> {<br> "current": "criterias",<br> "correct": "criteria"<br> \ }<br> ],<br> "articles_feedback": [<br> {<br> "title": "Integrating langchain4j and PaLM 2 Chat Bison Model",<br> "summary": "The article describes how to integrate Langchain4j and PaLM 2 Chat Bison Model. It provides detailed instructions on how to set up the environment, create a Google Cloud Function, and deploy the model. The article also includes a code sample and a link to the GitHub repository.",<br> "url": "https://medium.com/google-cloud/integrating-langchain4j-and-palm-2-chat-bison-model-a684cefd67af?source=rss-802a4d428d95------2",<br> \ "publication_date": "Mon, 06 Nov 2023 11:01:02 GMT",<br> \ "accuracy": 9,<br> "is_gcp": true,<br> \ "movie_or_book": null<br> },<br> {<br> "title": "Google Cloud Platform Technology Nuggets \\u2014 October 15\\u201331, 2023 Edition",<br> "summary": "The article provides a summary of Google Cloud Platform Technology Nuggets for the period of October 15-31, 2023. It covers topics such as infrastructure, containers and Kubernetes, identity and security, networking, machine learning, storage, databases and data analytics, and developers and practitioners.",<br> "url": "https://medium.com/google-cloud/google-cloud-platform-technology-nuggets-october-15-31-2023-edition-4d5ea0689e30?source=rss-802a4d428d95------2",<br> \ "publication_date": "Tue, 31 Oct 2023 10:22:07 GMT",<br> \ "accuracy": 8,<br> "is_gcp": true,<br> \ "movie_or_book": null<br> },<br> {<br> "title": "Develop a FlutterFlow App powered by Vertex AI PaLM 2 Integration",<br> \ "summary": "The article describes how to integrate FlutterFlow with Vertex AI PaLM 2. It provides a step-by-step guide on how to set up the environment, create a Google Cloud Function, and deploy the model. The article also includes a code sample and a link to the GitHub repository.",<br> "url": "https://medium.com/google-cloud/flutterflow-and-vertex-ai-palm-2-integration-14c137e83053?source=rss-802a4d428d95------2",<br> \ "publication_date": "Thu, 26 Oct 2023 09:37:11 GMT",<br> \ "accuracy": 8,<br> "is_gcp": true,<br> \ "movie_or_book": null<br> }<br> ]<br>}</pre><p>For my buddy Guillaume I get this:</p><pre>{ "prompt_version": "1.6b",<br> \ "author_name": "Guillaume Laforge",<br> "author_nationality": "French",<br> "author_style": "Guillaume Laforge's writing style can be described as professional, informative, and engaging. He often writes about technology, open-source software, and programming.",<br> "author_favorite_languages": "Java, Python",<br> "articles_feedback": [<br> {<br> \ "title": "Tech Watch #4 \\u2014 October, 27, 2023",<br> \ "summary": "The article provides a summary of the latest developments in the field of artificial intelligence (AI). It covers topics such as the use of LLMs in vector embeddings, the scheduling of PostgreSQL tasks with pg_cron, and the creation of maps with Protomaps. The article also includes links to the original sources for further reading.",<br> "url": "https://glaforge.medium.com/tech-watch-4-october-27-2023-d48a1449eeb0?source=rss-431147437aeb------2",<br> \ "publication_date": "Fri, 27 Oct 2023 15:04:58 GMT",<br> \ "accuracy": 8,<br> "is_gcp": false,<br> \ "movie_or_book": "The Matrix"<br> },<br> \ {<br> "title": "Tech Watch #3 \\u2014 October, 20, 2023",<br> "summary": "The article provides a summary of the latest developments in the field of technology. It covers topics such as the use of Groovy in 2023, the state of WebAssembly in 2023, and the use of large language models (LLMs) to solve logic problems. The article also includes links to the original sources for further reading.",<br> "url": "https://glaforge.medium.com/tech-watch-3-october-20-2023-11a70245017d?source=rss-431147437aeb------2",<br> \ "publication_date": "Fri, 20 Oct 2023 19:49:34 GMT",<br> \ "accuracy": 9,<br> "is_gcp": false,<br> \ "movie_or_book": "2001: A Space Odyssey"<br> },<br> \ {<br> "title": "Client-side consumption of a rate-limited API in Java",<br> "summary": "The article discusses different approaches for consuming rate-limited APIs in Java. It covers topics such as using exponential backoff and jitter, scheduled execution, and using the Bucket4J library. The article also includes code examples for each approach.",<br> "url": "https://glaforge.medium.com/client-side-consumption-of-a-rate-limited-api-in-java-9fbf08673791?source=rss-431147437aeb------2",<br> \ "publication_date": "Mon, 02 Oct 2023 00:00:53 GMT",<br> \ "accuracy": 10,<br> "is_gcp": false,<br> \ "movie_or_book": "The Imitation Game"<br> },<br> \ {<br> "title": "Tech Watch #1 \\u2014 Sept 29, 2023",<br> "summary": "The article provides a summary of the latest developments in the field of technology. It covers topics such as observability-driven development for LLMs, rebuilding LLM documentation chatbots, container security, and the future of databases. The article also includes links to the original sources for further reading.",<br> "url": "https://glaforge.medium.com/tech-watch-1-sept-29-2023-2ac0a3a5016c?source=rss-431147437aeb------2",<br> \ "publication_date": "Fri, 29 Sep 2023 00:00:11 GMT",<br> \ "accuracy": 7,<br> "is_gcp": false,<br> \ "movie_or_book": "Minority Report"<br> }<br> \ ]<br>}</pre><p>For myself I get something like this:</p><pre>{ "prompt_version": "1.6b",<br> "author_name": "Riccardo Carlesso",<br> \ "author_nationality": "Italian",<br> "author_style": "Verbose, uses personal anecdotes.",<br> "author_favorite_languages": "Ruby",<br> "articles_feedback": [<br> {<br> "title": "What is toilet paper\\u2019s right side?",<br> "summary": "The author discusses the question of which side of toilet paper is the \\u201cright\\u201d side. They explore the different opinions on this topic and provide their own thoughts on the matter. Ultimately, they conclude that there is no definitive answer to this question and that it is up to each individual to decide which side they prefer.",<br> \ "url": "https://medium.com/@palladiusbonton/what-is-toilet-papers-right-side-8da0504d6d0b?source=rss-b5293b96912f------2",<br> \ "publication_date": "Tue, 08 Aug 2023 16:37:20 GMT",<br> \ "accuracy": 8,<br> "is_gcp": false,<br> \ "movie_or_book": null<br> },<br> {<br> "title": "Spaghetti Bolognese don\\u2019t exist!!1!",<br> "summary": "The author discusses the common misconception that spaghetti Bolognese is an Italian dish. They explain that this dish is actually not from Italy and that it is not considered to be a traditional Italian dish. They also provide some tips on how to make a more authentic Italian pasta dish.",<br> "url": "https://medium.com/@palladiusbonton/spaghetti-bolognese-dont-exist-1-2088d85909dd?source=rss-b5293b96912f------2",<br> \ "publication_date": "Fri, 21 Apr 2023 16:09:23 GMT",<br> \ "accuracy": 9,<br> "is_gcp": false,<br> \ "movie_or_book": null<br> },<br> {<br> "title": "Migrate GCP projects across organizations, the gcloud way",<br> "summary": "The author provides a detailed guide on how to migrate GCP projects across organizations using the gcloud command-line tool. They cover everything from setting up the necessary permissions to executing the migration. This article is a valuable resource for anyone who needs to migrate GCP projects across organizations.",<br> \ "url": "https://medium.com/google-cloud/how-to-migrate-projects-across-organizations-c7e254ab90af?source=rss-b5293b96912f------2",<br> \ "publication_date": "Tue, 18 Apr 2023 13:16:26 GMT",<br> \ "accuracy": 10,<br> "is_gcp": true,<br> \ "movie_or_book": null<br>}]}</pre><h4>Lessons learnt</h4><p>Today I learnt a few things:</p><ul><li>For the first time the<strong> token limitation</strong> was visible to me. Palm API’s text-bisonmodel has a 32k-token limit, and what I didn’t know is that it seems shared between input and output. If I increase the input size, this diminishes the output size (still to be confirmed, for the moment it’s just a hunch). For this reason I reduce my input from 32k to 22k. To see Token Count, Google gives you a <a href=\"https://cloud.google.com/vertex-ai/docs/generative-ai/get-token-count?hl=en\">nice API to calculate it</a> (thanks Guillaume). You can see this very well from the API return JSON (note the sum of thetotalTokens here is exactly the maximum, <strong>8192</strong>):</li></ul><pre>"metadata": {<br> "tokenMetadata": {<br> "outputTokenCount": {<br> \ "totalTokens": 549,<br> "totalBillableCharacters": 1312<br> },<br> "inputTokenCount": {<br> "totalBillableCharacters": 20713,<br> "totalTokens": 7643<br> }<br> }<br> }</pre><ul><li><strong>Prompting</strong> is a (long) fine-tuning <strong>feedback loop</strong>: you try something out, and after a few answers you realize it doesn’t work, so you try to ‘bribe’ your model saying to “please do something as it’s very important to you”. Example: the movie or book is always empty, it’s probably a stretch for a 0.1 temperature API invocation. So I change “<em>What existing movie or book would this article remind you the most of? Try a guess, use your fantasy</em>” by adding “<em>Please do NOT leave this null! It’s just for fun. yet its very important to me</em>”. Note that doesn’t fix — output gets “None” instead of null, which is fun. But read on…</li><li><strong>Temperature is an important parameter. W</strong>hen tasked to infer a title name for my articles, it would refuse, until I raised the temperature from 0.1 to 0.3. Now I get a curious result: my <strong>films</strong> are finally there! Wait — <em>Ratatouille</em>, seriously?</li></ul><pre>{<br> "prompt_version": "1.6b",<br> \ "author_name": "Riccardo Carlesso",<br> "author_nationality": "Italian",<br> "author_style": "Verbose, uses humor and personal anecdotes. Seems to prefer Ruby on Rails.",<br> "author_favorite_languages": "Ruby",<br> "typos": [<br> {<br> "current": "cis-centralis /pendens",<br> "correct": "cis-centralis/pendens"<br> \ },<br> {<br> "current": "trans-centralis/mur\\u00e0lis",<br> \ "correct": "trans-centralis/muralis"<br> },<br> \ {<br> "current": "spaghetti Bolognese don\\u2019t",<br> \ "correct": "Spaghetti Bolognese doesn't"<br> \ }<br> ],<br> "articles_feedback": [<br> {<br> "title": "What is toilet paper\\u2019s right side?",<br> "summary": "The author discusses the great \\"toilet paper orientation debate\\" and shares their own experiences and opinions on the matter, ultimately concluding that there is no one right answer.",<br> "url": "https://medium.com/@palladiusbonton/what-is-toilet-papers-right-side-8da0504d6d0b?source=rss-b5293b96912f------2",<br> \ "publication_date": "Tue, 08 Aug 2023 16:37:20 GMT",<br> \ "accuracy": 8,<br> "is_gcp": false,<br> \ "movie_or_book": "The Big Lebowski"<br> },<br> \ {<br> "title": "Spaghetti Bolognese don\\u2019t exist!!1!",<br> "summary": "The author argues that the popular dish \\"Spaghetti Bolognese\\" does not exist in Italy and is considered an \\"imaginary dish\\" by Italians. They explain that the traditional Italian dish is called \\"rag\\u00f9 alla bolognese\\" and is typically served with tagliatelle or other types of pasta, not spaghetti.",<br> \ "url": "https://medium.com/@palladiusbonton/spaghetti-bolognese-dont-exist-1-2088d85909dd?source=rss-b5293b96912f------2",<br> \ "publication_date": "Fri, 21 Apr 2023 16:09:23 GMT",<br> \ "accuracy": 9,<br> "is_gcp": false,<br> \ "movie_or_book": "Ratatouille"<br> },<br> \ {<br> "title": "Migrate GCP projects across organizations, the gcloud way",<br> "summary": "The author provides a detailed guide on how to migrate GCP projects across organizations using the gcloud command-line tool. They cover topics such as identifying the current state of the projects, managing IAM permissions, and handling special cases.",<br> "url": "https://medium.com/google-cloud/how-to-migrate-projects-across-organizations-c7e254ab90af?source=rss-b5293b96912f------2",<br> \ "publication_date": "Tue, 18 Apr 2023 13:16:26 GMT",<br> \ "accuracy": 10,<br> "is_gcp": true,<br> \ "movie_or_book": "The Matrix"<br> }<br> ]<br>}</pre><ul><li>Finally, asking an LLM to create JSON or YAML can really speed up your development time, you can create <a href=\"https://api.rubyonrails.org/v3.1/classes/ActiveRecord/Fixtures.html\">fixtures</a> for your blog or app, or you can just use a computer to further process an imperfect, half-processed entity.</li></ul><h3>Conclusions</h3><p>LLMs are a really powerful tool to read long quantities of text, summarize them and classify them based on your tastes.</p><p>It can provide structured output (eg JSON) which you can in turn parse and use to populate a DB and an app. This way, a <strong>recommendation engine</strong> for your favourite articles (eg GCP articles, sorted by date of accuracy ) becomes easy and fun to build!</p><h4>Next Steps</h4><p>How could I extend this project?</p><figure><img alt=\"\" src=\"https://cdn-images-1.medium.com/max/949/0*uCKwk5OiCddNrioH\" /></figure><ol><li>Add a workflow, possibly with <a href=\"https://cloud.google.com/workflows\"><strong>Cloud Workflows</strong></a>. Iterate until I’m happy with the quality of the outputted JSON.</li><li>Use pre-vetted JSON to populate an easy-peasy Node.JS app, and run it on <a href=\"https://cloud.google.com/run\">Cloud Run</a>.</li><li>Change the code to create the “Morning list of articles for Riccardo to read”, by pulling A LOT of articles and do queries by <strong>keyword</strong> (in this demo it’s ‘GCP’ but could also bi ‘Pistacchio’ or ‘Politics’).</li><li>sed s/keyword/embeddings/g to make it able to do semantic search.</li></ol><img src=\"https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=02fe9d30475a\" width=\"1\" height=\"1\" alt=\"\"><hr><p><a href=\"https://blog.devops.dev/parse-medium-articles-with-genai-and-add-some-fun-02fe9d30475a\">Insights on Medium articles with GenAI and Ruby!</a> was originally published in <a href=\"https://blog.devops.dev\">DevOps.dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>"
Language
Active
Ricc internal notes
Imported via /Users/ricc/git/gemini-news-crawler/webapp/db/seeds.d/import-feedjira.rb on 2024-03-31 23:41:16 +0200. Content is EMPTY here. Entried: title,url,author,categories,published,entry_id,content. TODO add Newspaper: filename = /Users/ricc/git/gemini-news-crawler/webapp/db/seeds.d/../../../crawler/out/feedjira/Blogs/Riccardo Carlesso - Medium/2023-11-16-Insights_on_Medium_articles_with_GenAI_and_Ruby!-v2.yaml
Ricc source
Show this article
Back to articles