From d3f5fc8cc6192b717dc39e09acf472b5f25b989e Mon Sep 17 00:00:00 2001 From: antononcube Date: Thu, 30 Nov 2023 21:30:36 -0500 Subject: [PATCH] docs:Better formatted code and links. --- MarkdownDocuments/AI-vision-via-WL.md | 273 ++++++++++++++++++++++---- 1 file changed, 239 insertions(+), 34 deletions(-) diff --git a/MarkdownDocuments/AI-vision-via-WL.md b/MarkdownDocuments/AI-vision-via-WL.md index 56d2bea8..ea4bb3c4 100644 --- a/MarkdownDocuments/AI-vision-via-WL.md +++ b/MarkdownDocuments/AI-vision-via-WL.md @@ -54,7 +54,7 @@ As a first concrete example, consider the following image that fable-dramatizes RemoveBackground@Import[URL["https://i.imgur.com/UIIKK9wl.jpg"]] ``` -![1xg1w9gct6yca](./Diagrams/AI-vision-via-WL/1xg1w9gct6yca.png) +![1xg1w9gct6yca](https://raw.githubusercontent.com/antononcube/MathematicaForPrediction/master/MarkdownDocuments/Diagrams/AI-vision-via-WL/1xg1w9gct6yca.png) Here is its narration: @@ -78,7 +78,7 @@ There are five ways to utilize image interpretation (or vision) services in WL: - LLM functions, [[AAp1](https://github.com/antononcube/MathematicaForPrediction/blob/master/Misc/LLMVision.m), [WRIp1](https://resources.wolframcloud.com/PacletRepository/resources/Wolfram/LLMFunctions/)] -- Dedicated notebook cell type, [[A](https://raku.land/zef:antononcube/Jupyter::Chatbook)Ap2, AAv1] +- Dedicated notebook cell type, [[AAp2](https://raku.land/zef:antononcube/Jupyter::Chatbook), AAv1] - Any combinations of the above @@ -106,25 +106,25 @@ tblImgs = Map[Append[#[[1 ;; 1]], Hyperlink[#[[-1, 1, 1]]]] &, tblImgs]; TableForm[tblImgs, TableHeadings -> {None, {"Name", "Link"}}] /. {ButtonBox[n_, BaseStyle -> "Hyperlink", ButtonData -> { URL[u_], None}] :> Hyperlink[n, URL[u]]} ``` -![1n90yjgjx3mkf](./Diagrams/AI-vision-via-WL/1n90yjgjx3mkf.png) +![1n90yjgjx3mkf](https://raw.githubusercontent.com/antononcube/MathematicaForPrediction/master/MarkdownDocuments/Diagrams/AI-vision-via-WL/1n90yjgjx3mkf.png) ### Document structure Here is the structure of the rest of the document: -- **LLM synthesizing** +- **LLM synthesizing** ... using multiple image specs of different kind. -- **LLM functions** +- **LLM functions** ... workflows over technical plots. -- **Dedicated notebook cells** +- **Dedicated notebook cells** ... just excuses why they are not programmed yet. -- **Combinations (fairytale generation)** +- **Combinations (fairytale generation)** ... Multi-modal applications for replacing creative types. -- **Conclusions and leftover comments** +- **Conclusions and leftover comments** ... frustrations untold. ## LLM synthesizing @@ -143,7 +143,7 @@ Here is a URL of an image: (https://i.imgur.com/LEGfCeql.jpg). Here is the image Import[URL["https://i.imgur.com/LEGfCeql.jpg"]] ``` -![1u02ytqvf7xi9](./Diagrams/AI-vision-via-WL/1u02ytqvf7xi9.png) +![1u02ytqvf7xi9](https://raw.githubusercontent.com/antononcube/MathematicaForPrediction/master/MarkdownDocuments/Diagrams/AI-vision-via-WL/1u02ytqvf7xi9.png) OpenAI's vision endpoint accepts POST specs that have image URLs or images converted into Base64 strings. When we use the LLMVisionSynthesize function and provide a file name under the "images" argument, the Base64 conversion is automatically applied to that file. @@ -157,7 +157,7 @@ ColumnForm[{ ExportString[img1, {"Base64", "JPEG"}] // Short}] ``` -![0wmip47gloav0](./Diagrams/AI-vision-via-WL/0wmip47gloav0.png) +![0wmip47gloav0](https://raw.githubusercontent.com/antononcube/MathematicaForPrediction/master/MarkdownDocuments/Diagrams/AI-vision-via-WL/0wmip47gloav0.png) ### Image narration @@ -177,14 +177,39 @@ Here is an application that should be more appealing to WL-developers -- getting Import[URL["https://i.imgur.com/kcUcWnql.jpeg"]] ``` -![1ukmn97ui4o98](./Diagrams/AI-vision-via-WL/1ukmn97ui4o98.png) +![1ukmn97ui4o98](https://raw.githubusercontent.com/antononcube/MathematicaForPrediction/master/MarkdownDocuments/Diagrams/AI-vision-via-WL/1ukmn97ui4o98.png) Here are get the vision model description of the mind-map above (and place the output in Markdown format): ```mathematica mmDescr = LLMVisionSynthesize["How many branches this mind-map has? Describe each branch separately. Use relevant emoji prefixes.", "https://imgur.com/kcUcWnq.jpeg", "MaxTokens" -> 900] +``` -(*"This mind map has four primary branches, each diverging from a central node labeled \"LLM functionalities.\" I will describe each one using relevant emoji prefixes:1. 🖼️ **DALL-E** branch is in yellow and represents an access point to the DALL-E service, likely a reference to a Large Language Model (LLM) with image generation capabilities.2. 🤖 **ChatGPT** branch in pink is associated with the ChatGPT service, suggesting it's a conversational LLM branch. There are two sub-branches:- **LLM prompts** indicates a focus on the prompts used to communicate with LLMs.- **Notebook-wide chats** suggests a feature or functionality for conducting chats across an entire notebook environment.3. 💬 **LLM chat objects** branch in purple implies that there are objects specifically designed for chat interactions within LLM services.4. ✍️ **LLM functions** branch in green seems to represent various functional aspects or capabilities of LLMs, with a sub-branch:- **Chatbooks** which may indicate a feature or tool related to managing or organizing chat conversations as books or records."*) +``` +This mind map has four primary branches, each diverging from a \ +central node labeled "LLM functionalities." I will describe each one \ +using relevant emoji prefixes: + +1. 🖼️ **DALL-E** branch is in yellow and represents an access point to \ +the DALL-E service, likely a reference to a Large Language Model \ +(LLM) with image generation capabilities. + +2. 🤖 **ChatGPT** branch in pink is associated with the ChatGPT \ +service, suggesting it's a conversational LLM branch. There are two \ +sub-branches: + - **LLM prompts** indicates a focus on the prompts used to \ +communicate with LLMs. + - **Notebook-wide chats** suggests a feature or functionality for \ +conducting chats across an entire notebook environment. + +3. 💬 **LLM chat objects** branch in purple implies that there are \ +objects specifically designed for chat interactions within LLM \ +services. + +4. ✍️ **LLM functions** branch in green seems to represent various \ +functional aspects or capabilities of LLMs, with a sub-branch: + - **Chatbooks** which may indicate a feature or tool related to \ +managing or organizing chat conversations as books or records. ``` ### Converting descriptions to diagrams @@ -193,8 +218,18 @@ Here from the obtained description we request a (new) Mermaid-JS diagram to be g ```mathematica mmdChart = LLMSynthesize[{LLMPrompt["CodeWriter"], "Make the corresponding Mermaid-JS diagram code for the following description. Give the code only, without Markdown symbols.", mmDescr}] +``` -(*"graph TBcenter[LLM functionalities]center --> dalle[DALL-E]center --> chat[ChatGPT]center --> chatobj[LLM chat objects]center --> functions[LLM functions]chat --> prompts[LLM prompts]chat --> notebook[Notebook-wide chats]functions --> chatbooks[Chatbooks]"*) +``` +graph TB + center[LLM functionalities] + center --> dalle[DALL-E] + center --> chat[ChatGPT] + center --> chatobj[LLM chat objects] + center --> functions[LLM functions] + chat --> prompts[LLM prompts] + chat --> notebook[Notebook-wide chats] + functions --> chatbooks[Chatbooks] ``` Here is a diagram made with Mermaid-JS spec obtained above using the resource function of "MermaidInk", [AAf1]: @@ -203,7 +238,7 @@ Here is a diagram made with Mermaid-JS spec obtained above using the resource fu ResourceFunction["MermaidInk"][mmdChart] ``` -![1qni2g4n8vywf](./Diagrams/AI-vision-via-WL/1qni2g4n8vywf.png) +![1qni2g4n8vywf](https://raw.githubusercontent.com/antononcube/MathematicaForPrediction/master/MarkdownDocuments/Diagrams/AI-vision-via-WL/1qni2g4n8vywf.png) Below is given an instance of one of the better LLM results for making a Mermaid-JS diagram over the "vision-derived" mind-map description. @@ -211,7 +246,7 @@ Below is given an instance of one of the better LLM results for making a Mermaid ResourceFunction["MermaidInk"]["graph TBA[LLM services access] --> B[DALL-E]A --> C[ChatGPT]A --> D[PaLM]A --> E[LLM chat objects]A --> F[Chatbooks]B -->|related to| G[DALL-E AI system]C -->|associated with| H[ChatGPT]D -->|related to| I[PaLM model]E -->|part of| J[chat-related objects/functionalities]F -->|implies| K[Feature or application related to chatbooks]"] ``` -![0f0fuo9nexxl8](./Diagrams/AI-vision-via-WL/0f0fuo9nexxl8.png) +![0f0fuo9nexxl8](https://raw.githubusercontent.com/antononcube/MathematicaForPrediction/master/MarkdownDocuments/Diagrams/AI-vision-via-WL/0f0fuo9nexxl8.png) ### Code generation from image descriptions @@ -219,30 +254,64 @@ Here is an example of code generation based on the "vision derived" mind-map des ```mathematica LLMSynthesize[{LLMPrompt["CodeWriter"], "Generate the Mathematica code of a graph that corresponds to the description:\n", mmDescr}] +``` -(*"Graph[{\"LLM services access\" -> \"DALL-E\",\"LLM services access\" -> \"ChatGPT\",\"LLM services access\" -> \"PaLM\",\"LLM services access\" -> \"LLM functionalities\",\"LLM services access\" -> \"Chatbooks\",\"LLM services access\" -> \"Notebook-wide chats\",\"LLM services access\" -> \"Direct access of LLM services\",\"LLM functionalities\" -> \"LLM prompts\",\"LLM functionalities\" -> \"LLM functions\",\"LLM functionalities\" -> \"LLM chat objects\"},VertexLabels -> \"Name\"]"*) +``` +Graph[{"LLM services access" -> "DALL-E","LLM services access" -> "ChatGPT", +"LLM services access" -> "PaLM", +"LLM services access" -> "LLM functionalities", +"LLM services access" -> "Chatbooks","LLM services access" -> "Notebook-wide chats", +"LLM services access" -> "Direct access of LLM services","LLM functionalities" -> "LLM prompts", +"LLM functionalities" -> "LLM functions","LLM functionalities" -> "LLM chat objects"}, +VertexLabels -> "Name"] ``` ```mathematica ToExpression[%] ``` -![0cmyq0lep1q7f](./Diagrams/AI-vision-via-WL/0cmyq0lep1q7f.png) +![0cmyq0lep1q7f](https://raw.githubusercontent.com/antononcube/MathematicaForPrediction/master/MarkdownDocuments/Diagrams/AI-vision-via-WL/0cmyq0lep1q7f.png) ### Analyzing graphical WL results Consider another "serious" example -- that of analyzing chess play positions. Here we get a chess position using the paclet ["Chess"](https://resources.wolframcloud.com/PacletRepository/resources/Wolfram/Chess/), [WRIp3]: -![175o8ba3cxgoh](./Diagrams/AI-vision-via-WL/175o8ba3cxgoh.png) +![175o8ba3cxgoh](https://raw.githubusercontent.com/antononcube/MathematicaForPrediction/master/MarkdownDocuments/Diagrams/AI-vision-via-WL/175o8ba3cxgoh.png) -![0scq7lbpp7xfs](./Diagrams/AI-vision-via-WL/0scq7lbpp7xfs.png) +![0scq7lbpp7xfs](https://raw.githubusercontent.com/antononcube/MathematicaForPrediction/master/MarkdownDocuments/Diagrams/AI-vision-via-WL/0scq7lbpp7xfs.png) Here we describe it with "AI vision": ```mathematica LLMVisionSynthesize["Describe the position.", Image[b2], "MaxTokens" -> 1000, "Temperature" -> 0.05] +``` -(*"This is a chess position from a game in progress. Here's the description of the position by algebraic notation for each piece:White pieces:- King (K) on c1- Queen (Q) on e2- Rooks (R) on h1 and a1- Bishops (B) on e3 and f1- Knights (N) on g4 and e2- Pawns (P) on a2, b2, c4, d4, f2, g2, and h2Black pieces:- King (K) on e8- Queen (Q) on e7- Rooks (R) on h8 and a8- Bishops (B) on f5 and g7- Knights (N) on c6 and f6- Pawns (P) on a7, b7, c7, d7, f7, g7, and h7It's Black's turn to move. The position suggests an ongoing middle game with both sides having developed most of their pieces. White has castled queenside, while Black has not yet castled. The white knight on g4 is putting pressure on the black knight on f6 and the pawn on h7. The black bishop on f5 is active and could become a strong piece depending on the continuation of the game."*) +``` +This is a chess position from a game in progress. Here's the \ +description of the position by algebraic notation for each piece: + +White pieces: +- King (K) on c1 +- Queen (Q) on e2 +- Rooks (R) on h1 and a1 +- Bishops (B) on e3 and f1 +- Knights (N) on g4 and e2 +- Pawns (P) on a2, b2, c4, d4, f2, g2, and h2 + +Black pieces: +- King (K) on e8 +- Queen (Q) on e7 +- Rooks (R) on h8 and a8 +- Bishops (B) on f5 and g7 +- Knights (N) on c6 and f6 +- Pawns (P) on a7, b7, c7, d7, f7, g7, and h7 + +It's Black's turn to move. The position suggests an ongoing middle \ +game with both sides having developed most of their pieces. White has \ +castled queenside, while Black has not yet castled. The white knight \ +on g4 is putting pressure on the black knight on f6 and the pawn on \ +h7. The black bishop on f5 is active and could become a strong piece \ +depending on the continuation of the game. ``` **Remark:** In the our few experiments with these kind of image narrations, fair amount of the individual pieces are described to be at wrong chessboard locations. @@ -281,7 +350,7 @@ Here we ingest an image and display it: imgBarChart = Import[$HomeDirectory <> "/Downloads/Cyber-Week-Spending-Set-to-Hit-New-Highs-in-2023-small.jpeg"] ``` -![0iyello2xfyfo](./Diagrams/AI-vision-via-WL/0iyello2xfyfo.png) +![0iyello2xfyfo](https://raw.githubusercontent.com/antononcube/MathematicaForPrediction/master/MarkdownDocuments/Diagrams/AI-vision-via-WL/0iyello2xfyfo.png) **Remark:** The image was downloaded from the post ["Cyber Week Spending Set to Hit New Highs in 2023"](https://www.statista.com/chart/7045/thanksgiving-weekend-e-commerce-sales/) . @@ -291,8 +360,38 @@ Here we synthesize a response of a image description request: ```mathematica LLMVisionSynthesize["Describe the image.", imgBarChart, "MaxTokens" -> 600] +``` -(*"The image shows a bar chart infographic titled \"Cyber Week Spending Set to Hit New Highs in 2023\" with a subtitle \"Estimated online spending on Thanksgiving weekend in the United States.\" There are bars for five years (2019, 2020, 2021, 2022, and 2023) across three significant shopping days: Thanksgiving Day, Black Friday, and Cyber Monday.The bars represent the spending amounts, with different colors for each year. The spending for 2019 is shown in navy blue, 2020 in a lighter blue, 2021 in yellow, 2022 in darker yellow, and 2023 in dark yellow, with a pattern that clearly indicates the 2023 data is a forecast.From the graph, one can observe an increasing trend in estimated online spending, with the forecast for 2023 being the highest across all three days. The graph also has an icon that represents online shopping, consisting of a computer monitor with a shopping tag.At the bottom of the infographic, there is a note that says the data's source is Adobe Analytics. The image also contains the Statista logo, which indicates that this graphic might have been created or distributed by Statista, a company that specializes in market and consumer data. Additionally, there are Creative Commons (CC) icons, signifying the sharing and use permissions of the graphic.It's important to note that without specific numbers, I cannot provide actual figures, but the visual trend is clear \[LongDash] there is substantial year-over-year growth in online spending during these key shopping dates, culminating in a forecasted peak for 2023."*) +``` +The image shows a bar chart infographic titled "Cyber Week Spending \ +Set to Hit New Highs in 2023" with a subtitle "Estimated online \ +spending on Thanksgiving weekend in the United States." There are \ +bars for five years (2019, 2020, 2021, 2022, and 2023) across three \ +significant shopping days: Thanksgiving Day, Black Friday, and Cyber \ +Monday. + +The bars represent the spending amounts, with different colors for \ +each year. The spending for 2019 is shown in navy blue, 2020 in a \ +lighter blue, 2021 in yellow, 2022 in darker yellow, and 2023 in dark \ +yellow, with a pattern that clearly indicates the 2023 data is a \ +forecast. + +From the graph, one can observe an increasing trend in estimated \ +online spending, with the forecast for 2023 being the highest across \ +all three days. The graph also has an icon that represents online \ +shopping, consisting of a computer monitor with a shopping tag. + +At the bottom of the infographic, there is a note that says the \ +data's source is Adobe Analytics. The image also contains the \ +Statista logo, which indicates that this graphic might have been \ +created or distributed by Statista, a company that specializes in \ +market and consumer data. Additionally, there are Creative Commons \ +(CC) icons, signifying the sharing and use permissions of the graphic. + +It's important to note that without specific numbers, I cannot \ +provide actual figures, but the visual trend is clear -- \ +there is substantial year-over-year growth in online spending during \ +these key shopping dates, culminating in a forecasted peak for 2023. ``` ### Repeated questioning @@ -303,18 +402,22 @@ Here we define an LLM function that allows the multiple question request invocat fst = LLMVisionFunction["For the given image answer the question: ``. Be as concise as possible in your answers.", imgBarChart, "MaxTokens" -> 300] ``` -![0nmz56wwuboz3](./Diagrams/AI-vision-via-WL/0nmz56wwuboz3.png) +![0nmz56wwuboz3](https://raw.githubusercontent.com/antononcube/MathematicaForPrediction/master/MarkdownDocuments/Diagrams/AI-vision-via-WL/0nmz56wwuboz3.png) ```mathematica fst["How many years are presented in that image?"] +``` -(*"Five years are presented in the image."*) +``` +"Five years are presented in the image." ``` ```mathematica fst["Which year has the highest value? What is that value?"] +``` -(*"2023 has the highest value, which is approximately $11B on Cyber Monday."*) +``` +"2023 has the highest value, which is approximately $11B on Cyber Monday." ``` **Remark:** Numerical value readings over technical plots or charts seem to be often wrong. OpenAI's vision model warns about this in the responses often enough. @@ -327,15 +430,41 @@ Here we make a function a specially formatted output that can be more easily int fjs = LLMVisionFunction["How many `1` per `2`? " <> LLMPrompt["NothingElse"]["JSON"], imgBarChart, "MaxTokens" -> 300, "Temperature" -> 0.1] ``` -![032vcq74auyv9](./Diagrams/AI-vision-via-WL/032vcq74auyv9.png) +![032vcq74auyv9](https://raw.githubusercontent.com/antononcube/MathematicaForPrediction/master/MarkdownDocuments/Diagrams/AI-vision-via-WL/032vcq74auyv9.png) Here we invoke the that function (in order to get the money per year "seen" OpenAI's vision): ```mathematica res = fjs["money", "shopping day"] +``` -(*"```json{\"Thanksgiving Day\": {\"2019\": \"$4B\",\"2020\": \"$5B\",\"2021\": \"$6B\",\"2022\": \"$7B\",\"2023\": \"$8B\"},\"Black Friday\": {\"2019\": \"$7B\",\"2020\": \"$9B\",\"2021\": \"$9B\",\"2022\": \"$10B\",\"2023\": \"$11B\"},\"Cyber Monday\": {\"2019\": \"$9B\",\"2020\": \"$11B\",\"2021\": \"$11B\",\"2022\": \"$12B\",\"2023\": \"$13B\"}}```"*) +```` +```json +{ + "Thanksgiving Day": { + "2019": "$4B", + "2020": "$5B", + "2021": "$6B", + "2022": "$7B", + "2023": "$8B" + }, + "Black Friday": { + "2019": "$7B", + "2020": "$9B", + "2021": "$9B", + "2022": "$10B", + "2023": "$11B" + }, + "Cyber Monday": { + "2019": "$9B", + "2020": "$11B", + "2021": "$11B", + "2022": "$12B", + "2023": "$13B" + } +} ``` +```` **Remark:** The above result should be structured as shopping-day:year:value. But occasionally ig might be structured as year::shopping-day::value. In the latter case just re-run LLM invocation. @@ -343,8 +472,15 @@ Here we parse the obtained JSON into WL association structure: ```mathematica aMoney = ImportString[StringReplace[res, {"```json" -> "", "```" -> ""}], "RawJSON"] +``` -(*<|"Thanksgiving Day" -> <|"2019" -> "$4B", "2020" -> "$5B", "2021" -> "$6B", "2022" -> "$7B", "2023" -> "$8B"|>, "Black Friday" -> <|"2019" -> "$7B", "2020" -> "$9B", "2021" -> "$9B", "2022" -> "$10B", "2023" -> "$11B"|>, "Cyber Monday" -> <|"2019" -> "$9B", "2020" -> "$11B", "2021" -> "$11B", "2022" -> "$12B", "2023" -> "$13B"|>|>*) +``` +<|"Thanksgiving Day" -> <|"2019" -> "$4B", "2020" -> "$5B", + "2021" -> "$6B", "2022" -> "$7B", "2023" -> "$8B"|>, + "Black Friday" -> <|"2019" -> "$7B", "2020" -> "$9B", + "2021" -> "$9B", "2022" -> "$10B", "2023" -> "$11B"|>, + "Cyber Monday" -> <|"2019" -> "$9B", "2020" -> "$11B", + "2021" -> "$11B", "2022" -> "$12B", "2023" -> "$13B"|>|> ``` **Remark:** Currently LLMVisionFunction does not have an interpreter (or "form") parameter as LLMFunction does. This can be seen as one of the reasons to include LLFVisionFunction in the "LLMFunctions" framework. @@ -357,13 +493,13 @@ AbsoluteTiming[ ] ``` -![08ijuwuchj31q](./Diagrams/AI-vision-via-WL/08ijuwuchj31q.png) +![08ijuwuchj31q](https://raw.githubusercontent.com/antononcube/MathematicaForPrediction/master/MarkdownDocuments/Diagrams/AI-vision-via-WL/08ijuwuchj31q.png) Here is the corresponding bar chart and the original bar chart (for comparison): -![0rt43fezbbp4b](./Diagrams/AI-vision-via-WL/0rt43fezbbp4b.png) +![0rt43fezbbp4b](https://raw.githubusercontent.com/antononcube/MathematicaForPrediction/master/MarkdownDocuments/Diagrams/AI-vision-via-WL/0rt43fezbbp4b.png) -![1lpfhko7c2g6e](./Diagrams/AI-vision-via-WL/1lpfhko7c2g6e.png) +![1lpfhko7c2g6e](https://raw.githubusercontent.com/antononcube/MathematicaForPrediction/master/MarkdownDocuments/Diagrams/AI-vision-via-WL/1lpfhko7c2g6e.png) **Remark:** The comparison shows "pretty good vision" by OpenAI! But, again, small (or maybe significant) discrepancies are observed. @@ -411,14 +547,23 @@ Here we display the images: storyImages ``` -![13qqfe3pzqfn9](./Diagrams/AI-vision-via-WL/13qqfe3pzqfn9.png) +![13qqfe3pzqfn9](https://raw.githubusercontent.com/antononcube/MathematicaForPrediction/master/MarkdownDocuments/Diagrams/AI-vision-via-WL/13qqfe3pzqfn9.png) Here we get the image narrations (via the OpenAI's "vision service"): ```mathematica storyImagesDescriptions = LLMVisionSynthesize["Concisely describe the images.", storyImages, "MaxTokens" -> 600] +``` -(*"1. A painting of a woman in a traditional outfit reaching into a basket filled with vegetables and bread beside a bottle.2. An illustration of a person in a cloak holding a bucket and standing next to a large bear in a forest.3. An artwork depicting a person sitting naked by a birch tree, sharing a cake with a small bear.4. A picture of a person in a folk costume sitting next to a bear with a ladder leaning against a house."*) +``` +1. A painting of a woman in a traditional outfit reaching into a + basket filled with vegetables and bread beside a bottle. +2. An illustration of a person in a cloak holding a bucket and + standing next to a large bear in a forest. +3. An artwork depicting a person sitting naked by a birch tree, + sharing a cake with a small bear. +4. A picture of a person in a folk costume sitting next to a bear + with a ladder leaning against a house. ``` Here we extract the descriptions into a list: @@ -431,8 +576,68 @@ Here we generate the story from the descriptions above (using OpenAI's ChatGPT): ```mathematica LLMSynthesize[{"Write a story that fits the following four descriptions:", Sequence @@ descr}, LLMEvaluator -> LLMConfiguration["MaxTokens" -> 1200]] +``` -(*"In a small village nestled deep within a lush forest, lived a woman named Anya. She was gentle and kind-hearted, known for her artistic talent and love for nature. Anya had a keen eye for capturing the beauty of the world around her through her paintings. Each stroke of her brush seemed to hold a piece of her soul, and her art touched the hearts of all who laid their eyes upon it.One sunny day, on the outskirts of the village, Anya set up her easel amidst a lively farmers' market. In front of her, she placed a large canvas, ready to bring her latest vision to life. With her palette filled with vibrant colors, she began painting a woman dressed in a traditional outfit, delicately reaching into a woven basket filled to the brim with fresh vegetables and warm bread. Beside the basket lay an empty bottle, hinting at a joyous feast anticipated for the day.As Anya skillfully brought her painting to life, a cloak-wrapped figure caught her attention. Intrigued, she turned her easel slightly to capture the essence of this mysterious wanderer standing beside a mighty bear deep within the heart of the forest. In her illustration, she depicted the cloaked person, holding a bucket, their gaze met by the curious eyes of the regal woodland creature. The bond between them was palpable, a silent understanding as they stood together, guardians of the ancient woods.Meanwhile, in a clearing not too far away, Anya discovered a scene that touched her deeply. She stumbled upon a person sitting naked beneath the shade of a majestic birch tree, a cake placed lovingly between them and a small bear. The artwork she created was a tender portrayal of the intimate connection shared by the two, a testament to the innate kindness that existed between species. Together, they enjoyed the sweet treat, their hearts entwined in empathy, neither fearing the vulnerability of their exposed selves.Driven by her artistry, Anya's imagination continued to explore the fascinating relationship between humans and bears in her village. In her final artwork, she turned her focus to a person in a folk costume, sitting comfortably beside a towering bear. A ladder leaned against a charming wooden house in the background, illustrating the close bond shared between the village folks and their wild companions. Together, they stood tall, their spirits entwined in a balance of mutual respect and harmony.As Anya showcased her artwork to the villagers, they were captivated by the depth of emotion expressed through her brushstrokes. Her paintings served as a reminder that love and understanding knew no boundaries, whether lived within the confines of villages or amidst the enchanting wilderness.Anya became a celebrated artist, known far and wide for her ability to weave tales of compassion and unity through her exquisite paintings. Her work inspired generations to see the world through the lens of empathy, teaching them that even in unconventional connections between humans and animals, beauty could be found.And so, her legacy lived on, her art continuing to touch the hearts of those who recognized the profound messages hidden within her strokes of color. For in every stroke, Anya immortalized the timeless bond between humanity and the natural world, forever reminding us of the kinship we share with the creatures that roam our earth."*) +``` +In a small village nestled deep within a lush forest, lived a woman \ +named Anya. She was gentle and kind-hearted, known for her artistic \ +talent and love for nature. Anya had a keen eye for capturing the \ +beauty of the world around her through her paintings. Each stroke of \ +her brush seemed to hold a piece of her soul, and her art touched the \ +hearts of all who laid their eyes upon it. + +One sunny day, on the outskirts of the village, Anya set up her easel \ +amidst a lively farmers' market. In front of her, she placed a large \ +canvas, ready to bring her latest vision to life. With her palette \ +filled with vibrant colors, she began painting a woman dressed in a \ +traditional outfit, delicately reaching into a woven basket filled to \ +the brim with fresh vegetables and warm bread. Beside the basket lay \ +an empty bottle, hinting at a joyous feast anticipated for the day. + +As Anya skillfully brought her painting to life, a cloak-wrapped \ +figure caught her attention. Intrigued, she turned her easel slightly \ +to capture the essence of this mysterious wanderer standing beside a \ +mighty bear deep within the heart of the forest. In her illustration, \ +she depicted the cloaked person, holding a bucket, their gaze met by \ +the curious eyes of the regal woodland creature. The bond between \ +them was palpable, a silent understanding as they stood together, \ +guardians of the ancient woods. + +Meanwhile, in a clearing not too far away, Anya discovered a scene \ +that touched her deeply. She stumbled upon a person sitting naked \ +beneath the shade of a majestic birch tree, a cake placed lovingly \ +between them and a small bear. The artwork she created was a tender \ +portrayal of the intimate connection shared by the two, a testament \ +to the innate kindness that existed between species. Together, they \ +enjoyed the sweet treat, their hearts entwined in empathy, neither \ +fearing the vulnerability of their exposed selves. + +Driven by her artistry, Anya's imagination continued to explore the \ +fascinating relationship between humans and bears in her village. In \ +her final artwork, she turned her focus to a person in a folk \ +costume, sitting comfortably beside a towering bear. A ladder leaned \ +against a charming wooden house in the background, illustrating the \ +close bond shared between the village folks and their wild \ +companions. Together, they stood tall, their spirits entwined in a \ +balance of mutual respect and harmony. + +As Anya showcased her artwork to the villagers, they were captivated \ +by the depth of emotion expressed through her brushstrokes. Her \ +paintings served as a reminder that love and understanding knew no \ +boundaries, whether lived within the confines of villages or amidst \ +the enchanting wilderness. + +Anya became a celebrated artist, known far and wide for her ability \ +to weave tales of compassion and unity through her exquisite \ +paintings. Her work inspired generations to see the world through the \ +lens of empathy, teaching them that even in unconventional \ +connections between humans and animals, beauty could be found. + +And so, her legacy lived on, her art continuing to touch the hearts \ +of those who recognized the profound messages hidden within her \ +strokes of color. For in every stroke, Anya immortalized the timeless \ +bond between humanity and the natural world, forever reminding us of \ +the kinship we share with the creatures that roam our earth. ``` ## Conclusions and leftover comments