diff --git a/studio/frontend/src/features/data-recipes/learning-recipes/index.ts b/studio/frontend/src/features/data-recipes/learning-recipes/index.ts index 30a25de3e7..4e5dc815f3 100644 --- a/studio/frontend/src/features/data-recipes/learning-recipes/index.ts +++ b/studio/frontend/src/features/data-recipes/learning-recipes/index.ts @@ -10,6 +10,8 @@ const instructionFromAnswerUrl = new URL( "./instruction-from-answer.json", import.meta.url, ).href; +const textToPythonUrl = new URL("./text-to-python.json", import.meta.url).href; +const textToSqlUrl = new URL("./text-to-sql.json", import.meta.url).href; function isRecord(value: unknown): value is Record { return !!value && typeof value === "object" && !Array.isArray(value); @@ -107,4 +109,18 @@ export const LEARNING_RECIPES: LearningRecipeDef[] = [ "Use seed answer columns to generate high-quality instruction targets.", loadPayload: () => loadPayloadFromUrl(instructionFromAnswerUrl), }, + { + id: "text-to-python", + title: "Text to Python", + description: + "Generate instruction-to-code data with category sampling and LLM judging.", + loadPayload: () => loadPayloadFromUrl(textToPythonUrl), + }, + { + id: "text-to-sql", + title: "Text to SQL", + description: + "Generate SQL tasks and runnable SQL outputs with prompt-driven generation.", + loadPayload: () => loadPayloadFromUrl(textToSqlUrl), + }, ]; diff --git a/studio/frontend/src/features/data-recipes/learning-recipes/instruction-from-answer.json b/studio/frontend/src/features/data-recipes/learning-recipes/instruction-from-answer.json new file mode 100644 index 0000000000..ae30a79beb --- /dev/null +++ b/studio/frontend/src/features/data-recipes/learning-recipes/instruction-from-answer.json @@ -0,0 +1,178 @@ +{ + "recipe": { + "model_providers": [ + { + "name": "openai_provider", + "endpoint": "https://openrouter.ai/api/v1", + "provider_type": "openai", + "api_key": "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", + "extra_headers": {}, + "extra_body": {} + } + ], + "mcp_providers": [], + "model_configs": [ + { + "alias": "ministral", + "model": "mistralai/ministral-8b-2512", + "provider": "openai_provider", + "inference_parameters": { + "temperature": 0.7, + "max_tokens": 1024 + } + } + ], + "seed_config": { + "source": { + "seed_type": "hf", + "path": "datasets/unsloth/alpaca-cleaned/**/*.json", + "token": null, + "endpoint": "https://huggingface.co" + }, + "sampling_strategy": "ordered", + "selection_strategy": { + "start": 1, + "end": 100 + } + }, + "tool_configs": [], + "columns": [ + { + "column_type": "llm-text", + "name": "generated_instruction", + "drop": false, + "model_alias": "ministral", + "prompt": "Based on this target answer: \n{{ output }}\n\nWrite one high-quality plain text short and brief user instruction that this answer would satisfy.\nReturn only the instruction.", + "with_trace": "none" + } + ], + "processors": [ + { + "processor_type": "drop_columns", + "name": "drop_seed_columns", + "column_names": [ + "instruction", + "input" + ] + } + ] + }, + "run": { + "rows": 5, + "preview": true, + "output_formats": [ + "jsonl" + ] + }, + "ui": { + "nodes": [ + { + "id": "seed", + "x": -76.07288662013991, + "y": 143.39449780463954, + "width": 400 + }, + { + "id": "openai_provider", + "x": 461.00000000000006, + "y": -489.8750000000001, + "width": 400 + }, + { + "id": "ministral", + "x": 461, + "y": -190.00000000000009, + "width": 400 + }, + { + "id": "generated_instruction", + "x": 464, + "y": 109.00000000000003, + "width": 400 + } + ], + "edges": [ + { + "from": "openai_provider", + "to": "ministral", + "type": "semantic" + }, + { + "from": "ministral", + "to": "generated_instruction", + "type": "semantic" + }, + { + "from": "seed", + "to": "generated_instruction", + "type": "canvas" + } + ], + "seed_source_type": "hf", + "seed_columns": [ + "instruction", + "input", + "output" + ], + "seed_drop_columns": [ + "instruction", + "input" + ], + "seed_preview_rows": [ + { + "instruction": "Give three tips for staying healthy.", + "input": "", + "output": "1. Eat a balanced and nutritious diet: Make sure your meals are inclusive of a variety of fruits and vegetables, lean protein, whole grains, and healthy fats. This helps to provide your body with the essential nutrients to function at its best and can help prevent chronic diseases.\n\n2. Engage in regular physical activity: Exercise is crucial for maintaining strong bones, muscles, and cardiovascular health. Aim for at least 150 minutes of moderate aerobic exercise or 75 minutes of vigorous exercise each week.\n\n3. Get enough sleep: Getting enough quality sleep is crucial for physical and mental well-being. It helps to regulate mood, improve cognitive function, and supports healthy growth and immune function. Aim for 7-9 hours of sleep each night." + }, + { + "instruction": "What are the three primary colors?", + "input": "", + "output": "The three primary colors are red, blue, and yellow. These colors are called primary because they cannot be created by mixing other colors and all other colors can be made by combining them in various proportions. In the additive color system, used for light, the primary colors are red, green, and blue (RGB)." + }, + { + "instruction": "Describe the structure of an atom.", + "input": "", + "output": "An atom is the basic building block of all matter and is made up of three types of particles: protons, neutrons, and electrons. The structure of an atom can be described as a nucleus at the center surrounded by a cloud of electrons.\n\nThe nucleus of an atom is made up of protons and neutrons. Protons are positively charged particles and neutrons are neutral particles with no charge. Both of these particles are located in the nucleus of the atom, which is at the center of the atom and contains most of the atom's mass.\n\nSurrounding the nucleus of the atom is a cloud of electrons. Electrons are negatively charged particles that are in constant motion around the nucleus. The electron cloud is divided into shells or orbitals, and each shell can hold a certain number of electrons. The number of electrons in the outermost shell, called the valence shell, determines the chemical properties of the atom. \n\nIn a neutral atom, the number of protons in the nucleus is equal to the number of electrons in the electron cloud, so the positive and negative charges balance out and the atom has no overall charge. The number of protons, also called the atomic number, determines what element the atom is." + }, + { + "instruction": "How can we reduce air pollution?", + "input": "", + "output": "There are several ways to reduce air pollution, including:\n\n1. Reduce energy consumption: By conserving energy, we reduce the amount of pollution emitted from power plants. Some ways to achieve this include: using energy-efficient appliances and lighting, insulating homes, and shutting off lights and electronics when not in use.\n\n2. Use public transportation or carpool: Cars and trucks are major sources of pollution. By using public transportation, carpooling or biking, you can reduce the number of cars on the road, which in turn reduces emissions.\n\n3. Be responsible with waste: When waste is burned or decomposed, they can release harmful gases into the air. Dispose of hazardous waste correctly and recycle materials like plastics, paper, and glass when possible.\n\n4. Support clean energy sources: Renewable energy sources like solar and wind power generate little or no pollution. Support clean energy companies and projects, and consider installing renewable energy systems in your home.\n\n5. Drive efficiently: If you need to drive, make sure your vehicle is well maintained and drive efficiently by avoiding rapid acceleration and braking, and reducing idling.\n\n6. Be mindful of product choices: Some products and practices release more pollution than others. Choose products with eco-friendly packaging and try to minimize your use of aerosol sprays, which can release harmful chemicals into the air." + }, + { + "instruction": "Pretend you are a project manager of a construction company. Describe a time when you had to make a difficult decision.", + "input": "", + "output": "I had to make a difficult decision when I was working as a project manager at a construction company. I was in charge of a project that needed to be completed by a certain date in order to meet the client’s expectations. However, due to unexpected delays, we were not able to meet the deadline and so I had to make a difficult decision. I decided to extend the deadline, but I had to stretch the team’s resources even further and increase the budget. Although it was a risky decision, I ultimately decided to go ahead with it to ensure that the project was completed on time and that the client’s expectations were met. The project was eventually successfully completed and this was seen as a testament to my leadership and decision-making abilities." + }, + { + "instruction": "Write a concise summary of the following:\n\"Commodore 64 (commonly known as the C64 or CBM 64) was manufactured by Commodore Business Machine (CBM) in August 1982 with a starting price of $595. It was an 8-bit home computer with remarkable market success. Between 1983-1986, C64 sales amounted to about 17 million units sold, making them the best-selling single personal computer model of all time in 1983-1986. \n\nAdditionally, the Commodore 64 dominated the market with between 30% and 40% share and 2 million units sold per year, outselling the IBM PC clones, Apple Computers, and Atari computers. Adding to their success, Sam Tramiel (former Atari president), during an interview in 1989, said they were building 400,000 C64s a month for a couple of years. \"", + "input": "", + "output": "The Commodore 64 was a highly successful 8-bit home computer manufactured by Commodore Business Machine (CBM) in 1982, with sales amounting to approximately 17 million units sold between 1983-1986. It dominated the market with between 30% and 40% share and outsold its competitors, including IBM PC clones, Apple Computers, and Atari computers. At its peak, CBM was building 400,000 C64s a month for a couple of years." + }, + { + "instruction": "Explain why the following fraction is equivalent to 1/4", + "input": "4/16", + "output": "The fraction 4/16 is equivalent to 1/4 because both fractions represent the same value. A fraction can be simplified by dividing both the numerator and the denominator by a common factor. In this case, 4 is a common factor of both the numerator and the denominator of 4/16. When we divide both by 4, we get 4/4 = 1 and 16/4 = 4, so the simplified fraction is 1/4. Alternatively, we can think of this in terms of multiplication. For example, if we multiply the numerator and denominator of the fraction 1/4 by 4, we get (1x4)/(4x4), or 4/16. Since both fractions can be derived from the other through multiplication or division by the same number, they represent the same value and are equivalent." + }, + { + "instruction": "Write a short story in third person narration about a protagonist who has to make an important career decision.", + "input": "", + "output": "Sophie sat at her desk, staring blankly at the computer screen. Her mind was racing as she weighed the options in front of her. She had been offered a promotion to a senior management position within her company, but it meant moving across the country and leaving her friends and family behind. At the same time, her dream job at a rival company had finally opened up, and she had been invited for an interview. \n\nThe thought of leaving her comfortable life behind, to take a chance on something new and uncertain, made Sophie feel anxious, but also excited. She had always been one to take risks, and it had paid off in the past. But now, with such a big decision to make, Sophie couldn't help but feel overwhelmed.\n\nAfter much deliberation, Sophie made her choice. She packed her bags, said goodbye to her loved ones, and moved across the country for the new job. It was a difficult first few months, adjusting to a new city and a new company culture. But as time went by, Sophie realized that she had made the best decision for her career. The job was challenging, but also rewarding, and she was surrounded by passionate, driven colleagues who inspired her to grow and develop.\n\nIn the end, Sophie's bold move paid off. She was thriving in her new role, and had made new friends and connections in her new city. Looking back, Sophie was grateful for the opportunity to take a risk and make a change, and was confident that she had made the right decision for her career." + }, + { + "instruction": "Evaluate this sentence for spelling and grammar mistakes", + "input": "He finnished his meal and left the resturant", + "output": "There are two spelling errors in the sentence. The corrected sentence should be: \"He finished his meal and left the restaurant.\"" + }, + { + "instruction": "How did Julius Caesar die?", + "input": "", + "output": "Julius Caesar, the Roman Military general, and statesman was assassinated on March 15, 44 BC. He was stabbed to death at a meeting of the Senate in the Theatre of Pompey by a group of senators who called themselves the Liberatores. Led by Gaius Cassius Longinus, and Marcus Junius Brutus, they believed that Caesar's dictatorship was subverting the Roman Republic and sought to restore the traditional republican government. The exact number of assailants is not known, but it is believed that a group of as many as 60 conspirators participated in the assassination, and each of them took turns in stabbing Caesar. The day of his death is still known as the Ides of March." + } + ], + "local_file_name": "", + "unstructured_file_name": "", + "unstructured_chunk_size": "1200", + "unstructured_chunk_overlap": "200" + } +} \ No newline at end of file diff --git a/studio/frontend/src/features/data-recipes/learning-recipes/pdf-grounded-qa.json b/studio/frontend/src/features/data-recipes/learning-recipes/pdf-grounded-qa.json new file mode 100644 index 0000000000..647666346f --- /dev/null +++ b/studio/frontend/src/features/data-recipes/learning-recipes/pdf-grounded-qa.json @@ -0,0 +1,157 @@ +{ + "recipe": { + "model_providers": [ + { + "name": "provider_1", + "endpoint": "https://openrouter.ai/api/v1", + "provider_type": "openai", + "api_key": "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", + "extra_headers": {}, + "extra_body": {} + } + ], + "mcp_providers": [], + "model_configs": [ + { + "alias": "provider_column", + "model": "mistralai/ministral-8b-2512", + "provider": "provider_1", + "inference_parameters": { + "temperature": 0.7, + "max_tokens": 256 + } + } + ], + "seed_config": { + "source": { + "seed_type": "local", + "path": "/home/wasim/.cache/unsloth/data-recipe/seed-uploads/dc8ef7c169ed43399b7d37164495150f_50 page sample PDF.indd.jsonl" + }, + "sampling_strategy": "ordered", + "selection_strategy": null + }, + "tool_configs": [], + "columns": [ + { + "column_type": "llm-structured", + "name": "llm_structured_1", + "drop": false, + "model_alias": "provider_column", + "prompt": "Given ONLY this chunk: {{ chunk_text }} generate one answerable question, answer, and exact supporting quote from chunk. If not answerable, skip.", + "output_format": { + "type": "object", + "additionalProperties": false, + "required": [ + "question", + "answer", + "evidence_quote" + ], + "properties": { + "question": { + "type": "string" + }, + "answer": { + "type": "string" + }, + "evidence_quote": { + "type": "string" + } + } + } + } + ], + "processors": [] + }, + "run": { + "rows": 5, + "preview": true, + "output_formats": [ + "jsonl" + ] + }, + "ui": { + "nodes": [ + { + "id": "seed", + "x": 295.56977201312833, + "y": 108.19964868337735, + "width": 400 + }, + { + "id": "provider_1", + "x": 960.0115722892822, + "y": -465.06410256410254, + "width": 400 + }, + { + "id": "provider_column", + "x": 959.90231990232, + "y": -180.56654456654456, + "width": 400 + }, + { + "id": "llm_structured_1", + "x": 960, + "y": 108.25, + "width": 400 + } + ], + "edges": [ + { + "from": "provider_1", + "to": "provider_column", + "type": "semantic" + }, + { + "from": "provider_column", + "to": "llm_structured_1", + "type": "semantic" + }, + { + "from": "seed", + "to": "llm_structured_1", + "type": "canvas" + } + ], + "seed_source_type": "unstructured", + "seed_columns": [ + "chunk_text" + ], + "seed_preview_rows": [ + { + "chunk_text": "[Citation Needed] The Best of Wikipedia’s Worst Writing Conor Lastowka and Josh Fruhlinger Boring Legal Fine Print Each entry in this book contains material from Wikipedia, although the text we use may not represent the current version of any article. The URL at the bottom of each page will direct you to the source Wikipedia article; use the article’s History tab to find a list of contributors. All material in this book that is taken from Wikipedia is licensed under the Creative Commons-Attribution Share Alike 3.0 license. Here’s a quick human-readable summary of your rights to use this content: You are free: to Share—to copy, distribute and transmit the work, and to Remix—to adapt the work Under the following conditions: Attribution—You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work.) Share Alike—If you alter, transform, or build upon this work, you may distribute the resulting work only under the same, similar or a compatible license. With the understanding that: Waiver—Any of the above conditions can be waived if you get permission from the copyright holder. Other Rights—In" + }, + { + "chunk_text": "only under the same, similar or a compatible license. With the understanding that: Waiver—Any of the above conditions can be waived if you get permission from the copyright holder. Other Rights—In no way are any of the following rights affected by the license: your fair dealing or fair use rights; the author’s moral rights; and rights other persons may have either in the work itself or in how the work is used, such as publicity or privacy rights. Notice—For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to: http://creativecommons.org/licenses/by-sa/3.0/ Italicized material beneath each Wikipedia entry is © 2011 Conor Lastowka and Josh Fruhlinger. Copy-edited by Lauren Lastowka Cover design by Jaime Robinson ISBN # 978-1466346987 This book is dedicated to every person who wrote an entry that appears in it. May your citations always be needed. 6 Introduction Wikipedia. Whether you’ve used it to settle an argument, plagiarized a history report from it, or simply replaced the entire text of the biography of a respected humanitarian with the single word “dogballs,” it’s an inescapable part of the Internet" + }, + { + "chunk_text": "plagiarized a history report from it, or simply replaced the entire text of the biography of a respected humanitarian with the single word “dogballs,” it’s an inescapable part of the Internet experience. Since its launch in 2001, it has rapidly risen to become the seventh most popular website, with over 365 million readers (Source: Wikipedia). If you’re like us, when you want to know the name of the kangaroo on Shirt Tales or just want to confirm that Mother Teresa was a dogballs who helped the farts (Source: Wikipedia), The Encyclopedia That Anyone Can Edit will probably be the first place you check. But here’s the thing about letting anybody edit your encyclopedia: it means that anybody can edit your encyclopedia. And while in theory this means that one day Stephen Hawking might decide to weigh in on the entry for string theory, in reality it means that somebody who deeply cares about pro wrestling is going to call someone else a Nazi when they revert his edits about Wrestlemania XI on Razor Ramon’s page. And so we arrive at a cosmic intersection, where an obscure topic of dubious relevance is written about by the type of weirdo who logs on to Wikipedia to write about obscure" + }, + { + "chunk_text": "XI on Razor Ramon’s page. And so we arrive at a cosmic intersection, where an obscure topic of dubious relevance is written about by the type of weirdo who logs on to Wikipedia to write about obscure topics of dubious relevance. Were these authors re-watching their video of Wrestlemania XI instead of completing basic 8th grade English assignments? It’s very likely. Does this 7 stop them from attempting to emulate the academic tone of the great encyclopedias of the past as they describe a large mammalian species from the Star Wars universe that shares a common ancestor with the Wookies? It does not. The result? Some really terrible Wikipedia writing. For the past two years, we have collected this writing on our blog, [Citation Needed]. Fascinated and delighted by the brilliantly bad writing we encountered in our Wikipedia browsing, we set out to curate The Best of Wikipedia’s Worst Writing. Starting the blog was a no-brainer; our only concern was whether, after a few months of our daily mining, the well of awful Wikipedia writing would eventually run dry. By the time you read this, we will have published our thousandth entry. We started a podcast. Instead of drying up, the ocean of" + }, + { + "chunk_text": "mining, the well of awful Wikipedia writing would eventually run dry. By the time you read this, we will have published our thousandth entry. We started a podcast. Instead of drying up, the ocean of ineptitude has proven far more vast than we ever could have imagined. Through our own browsing, and with the help of a dedicated group of readers who are exploring the topics they submit for God knows what reason, we’ve continually lowered and re-lowered the bar for bad Wikipedia writing. Now, let’s get one thing straight: we love each and every entry written in this book. If you are one of the authors who have chosen to use your valuable time on this planet to write straight-faced exegeses on the subject of forgotten action figures from the seventies, we hope you don’t take offense. And if you do, we have an acceptable retort prepared for you: “You guys ran a blog about Wikipedia for two years, who the hell are you to talk?” Feel free to use it! Others may criticize us for not doing our part to help Wikipedia become “better” by revising these passages. Nothing that does not involve electrodes near our genitals would make us more miserable. In our opinion, many of the passages in this" + }, + { + "chunk_text": "to help Wikipedia become “better” by revising these passages. Nothing that does not involve electrodes near our genitals would make us more miserable. In our opinion, many of the passages in this book stand alone as works of art. Think of us as photographers preserving the memory of the great street art of the world before the joyless police come and whitewash over it. (Is that an official police responsibility? It seems beneath them. If it’s not, but they’re still forced to do it, that might explain the joylessness.) The point is, if you’re moved to correct these entries, we’re powerless to stop you. They’ve already given us joy, and we’re just happy to have encountered them. Enough introduction. Here are over two hundred of our favorite bad Wikipedia articles of all time. Comments in italics are ours. Everything else is a faithful reproduction of the way the entry stood at the moment we or our informants encountered it. We hope you will laugh, cry, maybe even learn something, and always remember to dogballs. —Conor Lastowka & Josh Fruhlinger citationneeded.tumblr.com 8 9 In barely one decade, Jimmy Wales has succeeded in establishing a worldwide network of knowledge. Wikipedia," + }, + { + "chunk_text": "remember to dogballs. —Conor Lastowka & Josh Fruhlinger citationneeded.tumblr.com 8 9 In barely one decade, Jimmy Wales has succeeded in establishing a worldwide network of knowledge. Wikipedia, his online encyclopaedia, accessible on the Internet for free, has become a symbol of a radical change in the media economy. Moreover, it revolutionized the access to knowledge as man’s most important resource and thus contributed to democratizing knowledge. The Gottlieb Duttweiler Institute, awarding the 2011 Gottlieb Duttweiler Prize to Wikipedia founder Jimmy Wales I saw the Beavis and Butt-Head episode that had Hogan’s “Real American” music on there. I don’t quite remembering it being critiqued by Beavis and Butt-Head. They sounded more like they liked the music and I don’t really remember any criticism of it (except for when it was going, when Butt-Head said “homework sucks”, but I’m not quite sure if he was referring to music or not). Wikipedia discussion page for Hulk Hogan 10 11 http://en.wikipedia.org/wiki/Polybius_(video_game) Want a Citation for this one? Please see the following 206 pages. The Roach story contained a number of inconsistencies: some of it seems to be directly" + }, + { + "chunk_text": "Want a Citation for this one? Please see the following 206 pages. The Roach story contained a number of inconsistencies: some of it seems to be directly sourced from Wikipedia- all in all, an entirely untrustworthy source. Polybius (video game) 12 http://en.wikipedia.org/wiki/General_Mills_monster-themed_breakfast_cereals You can imagine the marketing team having their first meeting after the cereal’s release. “We have good news and bad news. The good news is, your latest cereal is very, very popular. The bad news is, it’s not in any way due to the character you came up with, the box design you slaved over, the costly ad campaign, or the hours you put in coming up with free toy ideas. Gentlemen, you should probably sit down....” Franken Berry was very popular when first introduced possibly because the initial batches of the cereal used a dye that didn’t break down in the body, causing many children’s feces to be bright pink, a symptom sometimes referred to as “Frankenberry Stool.” General Mills monster-themed breakfast cereals 13 http://en.wikipedia.org/wiki/Skiffle Because if your encyclopedia can’t provide you with an unsourced claim that it admits is only one of several" + }, + { + "chunk_text": "General Mills monster-themed breakfast cereals 13 http://en.wikipedia.org/wiki/Skiffle Because if your encyclopedia can’t provide you with an unsourced claim that it admits is only one of several theories put forth about the subject, and then go on to inform you in the very same sentence that other unidentified parties disagree with that claim, then what the hell good is it? Skiffle is often said to have developed from New Orleans jazz, but this has been disputed. Skiffle 14 http://en.wikipedia.org/wiki/House_Party_%28film%29 “HP4: Coda or Mistake?” was by far the most contentious panel at HoPaCon 2009, with impassioned arguments echoing through the halls of the Kansas City International Airport Days Inn. In 2001, Immature (now going by IMx) starred in a direct-to-video sequel, House Party 4: Down to the Last Minute, which does not feature Kid or Play. The film is not considered a part of the House Party canon amongst fans. [citation needed] House Party (film) 15 http://en.wikipedia.org/wiki/Inglewood,_California So it would appear that, due to the presence of the anti- drug organization D.A.R.E. in Inglewood, there are in fact parts of Inglewood that are attempting to do good." + }, + { + "chunk_text": "So it would appear that, due to the presence of the anti- drug organization D.A.R.E. in Inglewood, there are in fact parts of Inglewood that are attempting to do good. Thus the claim that Inglewood is “always” up to no good can be assumed to be false, or at the very least a gross exaggeration. Also, many have speculated that the so-called “Doctor” Dre never actually received a PhD. D.A.R.E. America has its headquarters in Inglewood. Despite this, in the 1996 rap hit “California Love”, Dr. Dre remarks that Inglewood is “always up to no good”. Inglewood, California 16 http://en.wikipedia.org/wiki/Tyler_Perry People who feel that Tyler Perry’s 6’5” stature is severely diminished by his wearing a wig? The line in the sand has been drawn. Another comical aspect is provided by Perry’s 6’- 5” stature, which is in no way diminished by his wearing a wig. Tyler Perry 17 http://en.wikipedia.org/wiki/Bondage_bed Do not attempt to affix your bondage partner to this question mark using chains and shackles! It is purely metaphorical! It is possible to buy inflatable bondage beds; however, a question mark must remain over how effective they are. Bondage bed 18" + } + ], + "local_file_name": "", + "unstructured_file_name": "50 page sample PDF.indd.pdf", + "unstructured_chunk_size": "1200", + "unstructured_chunk_overlap": "200" + } +} \ No newline at end of file diff --git a/studio/frontend/src/features/data-recipes/learning-recipes/structured-outputs-jinja.json b/studio/frontend/src/features/data-recipes/learning-recipes/structured-outputs-jinja.json new file mode 100644 index 0000000000..d54e65201b --- /dev/null +++ b/studio/frontend/src/features/data-recipes/learning-recipes/structured-outputs-jinja.json @@ -0,0 +1,318 @@ +{ + "recipe": { + "model_providers": [ + { + "name": "provider_column", + "endpoint": "https://openrouter.ai/api/v1", + "provider_type": "openai", + "extra_headers": {}, + "extra_body": {} + } + ], + "mcp_providers": [], + "model_configs": [ + { + "alias": "ministral", + "model": "mistralai/ministral-8b-2512", + "provider": "provider_column", + "inference_parameters": { + "temperature": 0.7, + "max_tokens": 256 + } + } + ], + "tool_configs": [], + "columns": [ + { + "column_type": "sampler", + "name": "user", + "drop": true, + "sampler_type": "person_from_faker", + "params": {} + }, + { + "column_type": "sampler", + "name": "platform", + "drop": false, + "sampler_type": "category", + "params": { + "values": [ + "web", + "mobile", + "cli" + ] + } + }, + { + "column_type": "sampler", + "name": "impact_scope", + "drop": false, + "sampler_type": "category", + "params": { + "values": [ + "single_user", + "team", + "org_wide" + ] + } + }, + { + "column_type": "expression", + "name": "user_first_name", + "drop": false, + "expr": "{{ user.first_name }}", + "dtype": "str" + }, + { + "column_type": "expression", + "name": "user_full_name", + "drop": false, + "expr": "{{ user.first_name }} {{ user.last_name }}", + "dtype": "str" + }, + { + "column_type": "llm-structured", + "name": "ticket", + "drop": false, + "model_alias": "ministral", + "prompt": "Create a realistic support ticket from {{ user_full_name }} using the {{ platform }} platform. Impact scope is {{ impact_scope }}.\n", + "output_format": { + "type": "object", + "additionalProperties": false, + "required": [ + "issue_title", + "issue_summary", + "category", + "priority" + ], + "properties": { + "issue_title": { + "type": "string", + "description": "Short title of issue" + }, + "issue_summary": { + "type": "string", + "description": "1-2 sentence summary" + }, + "category": { + "type": "string", + "enum": [ + "account", + "billing", + "api", + "infra" + ], + "description": "Issue category" + }, + "priority": { + "type": "string", + "enum": [ + "P1", + "P2", + "P3" + ], + "description": "Urgency level" + } + } + } + }, + { + "column_type": "expression", + "name": "sla_target", + "drop": false, + "expr": "{% if impact_scope == 'org_wide' %}15m\n{% elif impact_scope == 'team' %}1h\n{% else %}4h\n{% endif %}", + "dtype": "str" + }, + { + "column_type": "llm-structured", + "name": "agent_reply", + "drop": false, + "model_alias": "ministral", + "prompt": "Write a concise support reply for ticket '{{ ticket.issue_title }}'. Category: {{ ticket.category }}. Priority: {{ ticket.priority }}. SLA target: {{ sla_target }}. {% if ticket.priority == 'P1' %}Tone must be urgent and action-first.{% else %}Tone must be calm and instructional.{% endif %}", + "output_format": { + "type": "object", + "additionalProperties": false, + "required": [ + "response", + "next_action" + ], + "properties": { + "response": { + "type": "string", + "description": "Support response to user" + }, + "next_action": { + "type": "string", + "enum": [ + "ask_logs", + "reset_credentials", + "escalate", + "provide_steps" + ], + "description": "Primary next action" + } + } + } + } + ], + "processors": [] + }, + "run": { + "rows": 5, + "preview": true, + "output_formats": [ + "jsonl" + ] + }, + "ui": { + "nodes": [ + { + "id": "provider_column", + "x": 1947.2039072039072, + "y": 32.08363858363858, + "width": 400 + }, + { + "id": "ministral", + "x": 1947.0573870573871, + "y": 271.94139194139194, + "width": 400 + }, + { + "id": "user", + "x": 0, + "y": 656.5, + "width": 400 + }, + { + "id": "platform", + "x": 480, + "y": 656.5, + "width": 400 + }, + { + "id": "impact_scope", + "x": 960, + "y": 656.5, + "width": 400 + }, + { + "id": "user_first_name", + "x": 1440, + "y": 895, + "width": 400 + }, + { + "id": "user_full_name", + "x": 1440, + "y": 269, + "width": 400 + }, + { + "id": "ticket", + "x": 1946.9108669108673, + "y": 657.2161172161173, + "width": 400 + }, + { + "id": "sla_target", + "x": 1440, + "y": 582, + "width": 400 + }, + { + "id": "agent_reply", + "x": 2384.5665445665445, + "y": 657.449938949939, + "width": 400 + } + ], + "edges": [ + { + "from": "platform", + "to": "impact_scope", + "type": "canvas", + "source_handle": "data-out", + "target_handle": "data-in" + }, + { + "from": "user", + "to": "user_first_name", + "type": "canvas", + "source_handle": "data-out", + "target_handle": "data-in" + }, + { + "from": "user_full_name", + "to": "ticket", + "type": "canvas", + "source_handle": "data-out", + "target_handle": "data-in" + }, + { + "from": "user", + "to": "platform", + "type": "canvas", + "source_handle": "data-out", + "target_handle": "data-in" + }, + { + "from": "user", + "to": "user_full_name", + "type": "canvas", + "source_handle": "data-out", + "target_handle": "data-in" + }, + { + "from": "user_first_name", + "to": "ticket", + "type": "canvas", + "source_handle": "data-out", + "target_handle": "data-in" + }, + { + "from": "impact_scope", + "to": "sla_target", + "type": "canvas", + "source_handle": "data-out", + "target_handle": "data-in" + }, + { + "from": "sla_target", + "to": "ticket", + "type": "canvas", + "source_handle": "data-out", + "target_handle": "data-in" + }, + { + "from": "ticket", + "to": "agent_reply", + "type": "canvas", + "source_handle": "data-out", + "target_handle": "data-in" + }, + { + "from": "provider_column", + "to": "ministral", + "type": "semantic", + "source_handle": "semantic-out-bottom", + "target_handle": "semantic-in-top" + }, + { + "from": "ministral", + "to": "ticket", + "type": "semantic", + "source_handle": "semantic-out-bottom", + "target_handle": "data-in-top" + }, + { + "from": "ministral", + "to": "agent_reply", + "type": "semantic", + "source_handle": "semantic-out", + "target_handle": "data-in-top" + } + ], + "layout_direction": "LR" + } +} \ No newline at end of file diff --git a/studio/frontend/src/features/data-recipes/learning-recipes/text-to-python.json b/studio/frontend/src/features/data-recipes/learning-recipes/text-to-python.json new file mode 100644 index 0000000000..7b65b9b1bc --- /dev/null +++ b/studio/frontend/src/features/data-recipes/learning-recipes/text-to-python.json @@ -0,0 +1,215 @@ +{ + "recipe": { + "model_providers": [ + { + "name": "provider_1", + "endpoint": "https://openrouter.ai/api/v1", + "provider_type": "openai", + "extra_headers": {}, + "extra_body": {} + } + ], + "mcp_providers": [], + "model_configs": [ + { + "alias": "model_1", + "model": "mistralai/ministral-8b-2512", + "provider": "provider_1", + "inference_parameters": { + "temperature": 0.7, + "max_tokens": 2048 + } + } + ], + "tool_configs": [], + "columns": [ + { + "column_type": "sampler", + "name": "domain", + "drop": false, + "sampler_type": "category", + "params": { + "values": [ + "Data Processing", + "Web API", + "Automation" + ] + } + }, + { + "column_type": "sampler", + "name": "task_type", + "drop": false, + "sampler_type": "subcategory", + "params": { + "category": "domain", + "values": { + "Data Processing": [ + "CSV cleaning", + "JSON transform", + "deduplicate rows" + ], + "Web API": [ + "GET endpoint", + "POST validation", + "pagination helper" + ], + "Automation": [ + "file organizer", + "log parser", + "daily report script" + ] + } + } + }, + { + "column_type": "llm-text", + "name": "instruction", + "drop": false, + "model_alias": "model_1", + "prompt": "Write one clear Python coding instruction.\nDomain: {{ domain }}\nTask type: {{ task_type }}\n\nKeep it practical and specific.\nReturn only the instruction without any code.", + "with_trace": "none" + }, + { + "column_type": "llm-code", + "name": "code_implementation", + "drop": false, + "model_alias": "model_1", + "prompt": "Write Python code for:\n{{ instruction }}\n\nRequirements:\n- runnable script or function\n- include needed imports\n- short comments only where useful\n- no markdown fences", + "code_lang": "python" + }, + { + "column_type": "llm-judge", + "name": "code_judge_result", + "drop": false, + "model_alias": "model_1", + "prompt": "Evaluate generated Python code against the instruction.\n\nInstruction:\n{{ instruction }}\n\nCode:\n{{ code_implementation }}", + "scores": [ + { + "name": "Correctness", + "description": "Follows instruction and is executable", + "options": { + "0": "bad", + "1": "partial", + "2": "good", + "3": "excellent" + } + } + ] + } + ], + "processors": [] + }, + "run": { + "rows": 5, + "preview": true, + "output_formats": [ + "jsonl" + ] + }, + "ui": { + "nodes": [ + { + "id": "provider_1", + "x": 1032.6798211423347, + "y": -450.4885376732656, + "width": 400 + }, + { + "id": "model_1", + "x": 1538.0273166472973, + "y": -483.2003290046642, + "width": 400 + }, + { + "id": "domain", + "x": 0, + "y": 24, + "width": 400 + }, + { + "id": "task_type", + "x": 480, + "y": 24, + "width": 400 + }, + { + "id": "instruction", + "x": 958.8989453654599, + "y": -9.971266983459952, + "width": 400 + }, + { + "id": "code_implementation", + "x": 1538.788058529745, + "y": -45.56493974435071, + "width": 400 + }, + { + "id": "code_judge_result", + "x": 2040.9251520522098, + "y": -13.362336454344792, + "width": 400 + } + ], + "edges": [ + { + "from": "domain", + "to": "task_type", + "type": "canvas", + "source_handle": "data-out", + "target_handle": "data-in" + }, + { + "from": "task_type", + "to": "instruction", + "type": "canvas", + "source_handle": "data-out", + "target_handle": "data-in" + }, + { + "from": "provider_1", + "to": "model_1", + "type": "semantic", + "source_handle": "semantic-out", + "target_handle": "semantic-in" + }, + { + "from": "instruction", + "to": "code_implementation", + "type": "canvas", + "source_handle": "data-out", + "target_handle": "data-in" + }, + { + "from": "model_1", + "to": "instruction", + "type": "semantic", + "source_handle": "semantic-out-bottom", + "target_handle": "data-in-top" + }, + { + "from": "model_1", + "to": "code_implementation", + "type": "semantic", + "source_handle": "semantic-out-bottom", + "target_handle": "data-in-top" + }, + { + "from": "code_implementation", + "to": "code_judge_result", + "type": "canvas", + "source_handle": "data-out", + "target_handle": "data-in" + }, + { + "from": "model_1", + "to": "code_judge_result", + "type": "semantic", + "source_handle": "semantic-out-bottom", + "target_handle": "data-in-top" + } + ], + "layout_direction": "LR" + } +} \ No newline at end of file diff --git a/studio/frontend/src/features/data-recipes/learning-recipes/text-to-sql.json b/studio/frontend/src/features/data-recipes/learning-recipes/text-to-sql.json new file mode 100644 index 0000000000..7aadf09a13 --- /dev/null +++ b/studio/frontend/src/features/data-recipes/learning-recipes/text-to-sql.json @@ -0,0 +1,231 @@ +{ + "recipe": { + "model_providers": [ + { + "name": "provider_1", + "endpoint": "https://openrouter.ai/api/v1", + "provider_type": "openai", + "extra_headers": {}, + "extra_body": {} + } + ], + "mcp_providers": [], + "model_configs": [ + { + "alias": "model_1", + "model": "mistralai/ministral-8b-2512", + "provider": "provider_1", + "inference_parameters": { + "temperature": 0.7, + "max_tokens": 2048 + } + } + ], + "tool_configs": [], + "columns": [ + { + "column_type": "sampler", + "name": "domain", + "drop": true, + "sampler_type": "category", + "params": { + "values": [ + "Ecommerce", + "Customer Support", + "Finance" + ] + } + }, + { + "column_type": "sampler", + "name": "topic", + "drop": true, + "sampler_type": "subcategory", + "params": { + "category": "domain", + "values": { + "Ecommerce": [ + "Orders and Revenue", + "Returns and Refunds", + "Product Performance" + ], + "Customer Support": [ + "Ticket Resolution", + "SLA Compliance", + "Agent Productivity" + ], + "Finance": [ + "Invoices and Payments", + "Subscription Churn", + "Monthly Cashflow" + ] + } + } + }, + { + "column_type": "sampler", + "name": "sql_task_type", + "drop": true, + "sampler_type": "category", + "params": { + "values": [ + "Filtering", + "Aggregation", + "Join Analysis", + "Trend Reporting" + ] + } + }, + { + "column_type": "sampler", + "name": "instruction_phrase", + "drop": true, + "sampler_type": "category", + "params": { + "values": [ + "Write a SQL query that", + "Create a SQL statement to", + "Develop a SQL query to" + ] + } + }, + { + "column_type": "llm-text", + "name": "sql_prompt", + "drop": false, + "model_alias": "model_1", + "prompt": "Generate one natural-language SQL task.\nContext:\n- Domain: {{ domain }}\n- Topic: {{ topic }}\n- Task type: {{ sql_task_type }}\nRules:\n- Must start exactly with: \"{{ instruction_phrase }}\"\n- Make it specific and practical.\n- Mention expected business outcome.\n- Keep it 1-2 sentences.\n- Do not include SQL code.\n- Output only the instruction text.", + "system_prompt": "You create clear, realistic business SQL tasks for training data.\n", + "with_trace": "none" + }, + { + "column_type": "llm-code", + "name": "sql", + "drop": false, + "model_alias": "model_1", + "prompt": "Write SQL for this instruction:\n{{ sql_prompt }}\nReturn ONE SQL script with this exact structure:\n-- SCHEMA\n[CREATE TABLE statements]\n[INSERT statements with sample rows]\n-- QUERY\n[final SELECT query solving the instruction]\nRules:\n- Use 2-3 tables max.\n- Use realistic snake_case names.\n- Include 5-8 rows of sample data per table.\n- Query must match task type \"{{ sql_task_type }}\".\n- Use only tables/columns you created.\n- No markdown fences.\n- No explanation text outside SQL comments shown above.", + "system_prompt": "You are an expert SQL engineer. Produce correct, runnable SQL only.\n", + "code_lang": "sql:ansi" + } + ], + "processors": [] + }, + "run": { + "rows": 5, + "preview": true, + "output_formats": [ + "jsonl" + ] + }, + "ui": { + "nodes": [ + { + "id": "domain", + "x": -18.379173679952572, + "y": 137.70260329000595, + "width": 400 + }, + { + "id": "topic", + "x": -18.6022437080035, + "y": 373.0271253737222, + "width": 400 + }, + { + "id": "sql_task_type", + "x": 477.85851567876665, + "y": 137.4202046707293, + "width": 400 + }, + { + "id": "instruction_phrase", + "x": -477.8585156787667, + "y": 138.42770371608808, + "width": 400 + }, + { + "id": "sql_prompt", + "x": -18.188598798124787, + "y": 701.5157165665104, + "width": 400 + }, + { + "id": "sql", + "x": -18.188598798124758, + "y": 950.647309355259, + "width": 400 + }, + { + "id": "model_1", + "x": -546.1001596557278, + "y": 681.8114012018752, + "width": 400 + }, + { + "id": "provider_1", + "x": -1092.2003193114556, + "y": 715.157165665104, + "width": 400 + } + ], + "edges": [ + { + "from": "domain", + "to": "topic", + "type": "canvas", + "source_handle": "data-out-bottom", + "target_handle": "data-in-top" + }, + { + "from": "domain", + "to": "sql_task_type", + "type": "canvas", + "source_handle": "data-out", + "target_handle": "data-in" + }, + { + "from": "instruction_phrase", + "to": "domain", + "type": "canvas", + "source_handle": "data-out", + "target_handle": "data-in" + }, + { + "from": "topic", + "to": "sql_prompt", + "type": "canvas", + "source_handle": "data-out-bottom", + "target_handle": "data-in-top" + }, + { + "from": "sql_prompt", + "to": "sql", + "type": "canvas", + "source_handle": "data-out-bottom", + "target_handle": "data-in-top" + }, + { + "from": "provider_1", + "to": "model_1", + "type": "semantic", + "source_handle": "semantic-out", + "target_handle": "semantic-in" + }, + { + "from": "model_1", + "to": "sql_prompt", + "type": "semantic", + "source_handle": "semantic-out", + "target_handle": "data-in" + }, + { + "from": "model_1", + "to": "sql", + "type": "semantic", + "source_handle": "semantic-out-bottom", + "target_handle": "data-in" + } + ], + "layout_direction": "LR" + } +} \ No newline at end of file diff --git a/studio/frontend/src/features/data-recipes/pages/data-recipes-page.tsx b/studio/frontend/src/features/data-recipes/pages/data-recipes-page.tsx index 3cb5a90ea0..da662909bc 100644 --- a/studio/frontend/src/features/data-recipes/pages/data-recipes-page.tsx +++ b/studio/frontend/src/features/data-recipes/pages/data-recipes-page.tsx @@ -67,8 +67,12 @@ const TEMPLATE_CARDS: TemplateCard[] = [ difficulty: "Advanced", learningBadges: ["Structured LLM", "Expression", "Jinja"], surfaceClassName: - "from-cyan-500/15 via-sky-500/5 to-transparent border-cyan-500/30", - shineColor: ["#06b6d4", "#38bdf8", "#22d3ee"], + "from-cyan-500/15 via-sky-500/5 to-transparent", + shineColor: [ + "rgb(6 182 212 / 0.45)", + "rgb(56 189 248 / 0.4)", + "rgb(34 211 238 / 0.45)", + ], learningRecipeId: "structured-outputs-jinja", }, { @@ -79,8 +83,12 @@ const TEMPLATE_CARDS: TemplateCard[] = [ difficulty: "Easy", learningBadges: ["Unstructured", "LLM Text"], surfaceClassName: - "from-violet-500/15 via-fuchsia-500/5 to-transparent border-violet-500/30", - shineColor: ["#8b5cf6", "#d946ef", "#a855f7"], + "from-violet-500/15 via-fuchsia-500/5 to-transparent", + shineColor: [ + "rgb(139 92 246 / 0.45)", + "rgb(217 70 239 / 0.4)", + "rgb(168 85 247 / 0.45)", + ], learningRecipeId: "pdf-grounded-qa", }, { @@ -91,8 +99,12 @@ const TEMPLATE_CARDS: TemplateCard[] = [ difficulty: "Easy", learningBadges: ["Seed Dataset", "LLM Text", "Prompting"], surfaceClassName: - "from-emerald-500/15 via-green-500/5 to-transparent border-emerald-500/30", - shineColor: ["#10b981", "#22c55e", "#34d399"], + "from-emerald-500/15 via-green-500/5 to-transparent", + shineColor: [ + "rgb(16 185 129 / 0.45)", + "rgb(34 197 94 / 0.4)", + "rgb(52 211 153 / 0.45)", + ], learningRecipeId: "instruction-from-answer", }, { @@ -100,11 +112,16 @@ const TEMPLATE_CARDS: TemplateCard[] = [ description: "Instruction-to-code pairs for training models that generate clean Python implementations.", icon: CodeIcon, - difficulty: "Starter", - learningBadges: ["LLM Code", "Prompting"], + difficulty: "Intermediate", + learningBadges: ["LLM Judge", "LLM Code", "Subcategory", "Category"], surfaceClassName: - "from-amber-500/15 via-orange-500/5 to-transparent border-amber-500/30", - shineColor: ["#f59e0b", "#f97316", "#fb923c"], + "from-amber-500/15 via-orange-500/5 to-transparent", + shineColor: [ + "rgb(245 158 11 / 0.45)", + "rgb(249 115 22 / 0.4)", + "rgb(251 146 60 / 0.45)", + ], + learningRecipeId: "text-to-python", }, { title: "Text to SQL", @@ -112,10 +129,15 @@ const TEMPLATE_CARDS: TemplateCard[] = [ "Natural language to SQL pairs, including schema-aware query construction patterns.", icon: Database02Icon, difficulty: "Intermediate", - learningBadges: ["Structured LLM", "Prompting"], + learningBadges: ["LLM Code", "Prompting", "Drop Columns"], surfaceClassName: - "from-blue-500/15 via-indigo-500/5 to-transparent border-blue-500/30", - shineColor: ["#3b82f6", "#6366f1", "#60a5fa"], + "from-blue-500/15 via-indigo-500/5 to-transparent", + shineColor: [ + "rgb(59 130 246 / 0.45)", + "rgb(99 102 241 / 0.4)", + "rgb(96 165 250 / 0.45)", + ], + learningRecipeId: "text-to-sql", }, { title: "Multi-Turn Chat", @@ -125,8 +147,12 @@ const TEMPLATE_CARDS: TemplateCard[] = [ difficulty: "Advanced", learningBadges: ["LLM Text", "Conversation Design"], surfaceClassName: - "from-rose-500/15 via-pink-500/5 to-transparent border-rose-500/30", - shineColor: ["#f43f5e", "#ec4899", "#fb7185"], + "from-rose-500/15 via-pink-500/5 to-transparent", + shineColor: [ + "rgb(244 63 94 / 0.45)", + "rgb(236 72 153 / 0.4)", + "rgb(251 113 133 / 0.45)", + ], }, ]; @@ -179,19 +205,19 @@ function LearningRecipeCards({ template.learningRecipeId !== undefined && loadingTemplateId === template.learningRecipeId; const isDisabled = !isReady || isLoading || Boolean(loadingTemplateId); - const visibleLearningBadges = template.learningBadges.slice(0, 3); - const extraLearningBadgeCount = Math.max(0, template.learningBadges.length - 3); + const visibleLearningBadges = template.learningBadges.slice(0, 4); + const extraLearningBadgeCount = Math.max(0, template.learningBadges.length - 4); return (