Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds

How-To Tutorials

6719 Articles
article-image-connecting-cloud-object-storage-with-databricks-unity-catalog
Pulkit Chadha
07 Nov 2024
10 min read
Save for later

Connecting Cloud Object Storage with Databricks Unity Catalog

Pulkit Chadha
07 Nov 2024
10 min read
This article is an excerpt from the book, Data Engineering with Databricks Cookbook, by Pulkit Chadha. This book shows you how to use Apache Spark, Delta Lake, and Databricks to build data pipelines, manage and transform data, optimize performance, and more. Additionally, you’ll implement DataOps and DevOps practices, and orchestrate data workflows.IntroductionDatabricks Unity Catalog allows you to manage and access data in cloud object storage using a unified namespace and a consistent set of APIs. With Unity Catalog, you can do the following: Create and manage storage credentials, external locations, storage locations, and volumes using SQL commands or the Unity Catalog UI Access data from various cloud platforms (AWS S3, Azure Blob Storage, or Google Cloud Storage) and storage formats (Parquet, Delta Lake, CSV, or JSON) using the same SQL syntax or Spark APIs Apply fine-grained access control and data governance policies to your data using Databricks SQL Analytics or Databricks Runtime In this article, you will learn what Unity Catalog is and how it integrates with AWS S3. Getting ready Before you start setting up and configuring Unity Catalog, you need to have the following prerequisites: A Databricks workspace with administrator privileges A Databricks workspace with the Unity Catalog feature enabled A cloud storage account (such as AWS S3, Azure Blob Storage, or Google Cloud Storage) with the necessary permissions to read and write data How to do it… In this section, we will first create a storage credential, the IAM role, with access to an s3 bucket. Then, we will create an external location in Databricks Unity Catalog that will use the storage credential to access the s3 bucket. Creating a storage credential You must create a storage credential to access data from an external location or a volume. In this example, you will create a storage credential that uses an IAM role taccess the S3 Bucket. The steps are as follows: 1. Go to Catalog Explorer: Click on Catalog in the left panel and go to Catalog Explorer. 2. Create storage credentials: Click on +Add and select Add a storage credential. Figure 10.1 – Add a storage credential 3. Enter storage credential details: Give the credential a name, the IAM role ARN that allows Unity Catalog to access the storage location on your cloud tenant, and a comment if you want, and click on Create. Figure 10.2 – Create a new storage credential Important note To learn more about IAM roles in AWS, you can reference the user guide here: https:// docs.aws.amazon.com/IAM/latest/UserGuide/introduction.html. 4. Get External ID: In the Storage credential created dialog, copy the External ID value and click on Done. Figure 10.3 – External ID for the storage credential 5. Update the trust policy with an External ID: Update the trust policy associated with the IAM role and add the External ID value for sts:ExternalId:  Figure 10.4 – Updated trust policy with External ID Creating an external location An external location contains a reference to a storage credential and a cloud storage path. You need to create an external location to access data from a custom storage location that Unity Catalog uses to reference external tables. In this example, you will create an external location that points to the de-book-ext-loc folder in an S3 bucket. To create an external location, you can follow these steps: 1. Go to Catalog Explorer: Click on Catalog in the left panel to go to Catalog Explorer. 2. Create external location: Click on +Add and select Add an external location:  Figure 10.5 – Add an external location 3. Pick an external location creation method: Select Manual and then click on Next:  Figure 10.6 – Create a new external location 4. Enter external location details: Enter the external location name, select the storage credential, and enter the S3 URL; then, click on the Create button:  Figure 10.7 – Create a new external location manually 5. Test connection: Test the connection to make sure you have set up the credentials accurately and that Unity Catalog is able to access cloud storage:  Figure 10.8 – Test connection for external location If everything is set up right, you should see a screen like the following. Click on Done:  Figure 10.9 – Test connection results See also Databricks Unity Catalog: https://www.databricks.com/product/unity-catalog What is Unity Catalog: https://docs.databricks.com/en/data-governance/ unity-catalog/index.html Databricks Unity Catalog documentation: https://docs.databricks.com/en/ compute/access-mode-limitations.html Databricks SQL documentation: https://docs.databricks.com/en/datagovernance/unity-catalog/create-tables.html Databricks Unity Catalog: A Comprehensive Guide to Features, Capabilities, and Architecture: https://atlan.com/databricks-unity-catalog/ Step By Step Guide on Databricks Unity Catalog Setup and its key Features: https:// medium.com/@sauravkum780/step-by-step-guide-on-databricks-unitycatalog-setup-and-its-features-1d0366c282b7 Conclusion In summary, connecting to cloud object storage using Databricks Unity Catalog provides a streamlined approach to managing and accessing data across various cloud platforms such as AWS S3, Azure Blob Storage, and Google Cloud Storage. By utilizing a unified namespace, consistent APIs, and powerful governance features, Unity Catalog simplifies the process of creating and managing storage credentials and external locations. With built-in fine-grained access controls, you can securely manage data stored in different formats and cloud environments, all while leveraging Databricks' powerful data analytics capabilities. This guide walks through setting up an IAM role and creating an external location in AWS S3, demonstrating how easy it is to connect cloud storage with Unity Catalog. Author BioPulkit Chadha is a seasoned technologist with over 15 years of experience in data engineering. His proficiency in crafting and refining data pipelines has been instrumental in driving success across diverse sectors such as healthcare, media and entertainment, hi-tech, and manufacturing. Pulkit’s tailored data engineering solutions are designed to address the unique challenges and aspirations of each enterprise he collaborates with.
Read more
  • 0
  • 0
  • 1298

article-image-fighting-together-against-fraudulent-ticketing-websites-and-individuals
Marek Krajewski
13 Oct 2024
2 min read
Save for later

Fighting together against fraudulent ticketing websites and individuals

Marek Krajewski
13 Oct 2024
2 min read
Whilst we are absolutely thrilled by the success of the Diljit Dosanjh Dil-Luminati Tour it has come to our attention that fake tickets for Diljit Dosanjh’s Dil-lumanati Tour in India are being sold by unauthorized individuals and on fake websites. We are incredibly disheartened by these attempts to fraud genuine fans out of an opportunity to attend the tour.At Zomato Live we always strive to be ‘fan first’ and seeing multiple websites and platforms that mimic ours, asking fans to part with their money for non-existent tickets goes against everything that we stand for. On our side we have taken legal action against these fraudulent websites and individuals and are actively working with the authorities to have them taken down.Please note that Zomato Live is the official ticketing partner for Diljit Dosanjh’s Dil-luminati Tour in India which is accessible only through Zomato app, or at https://www.zomato.com/live, and the tickets issued are in physical form only. The tickets purchased from any other third-party direct selling or reselling platforms such as Viagogo, Ticombo, StubHub, and other unofficial sources will be considered invalid, and individuals holding these tickets will be denied entry to the event.We will continue to push legal action against all mediums taking part in this type of activity. In addition we urge everyone to refrain from engaging or buying from third-party reselling platforms such as Viagogo, Ticombo, StubHub, and other unofficial individuals or social handles.Thank you for your cooperation and understanding!
Read more
  • 0
  • 0
  • 536

article-image-the-big-brand-theory-freshness-flavour-and-innovation-thats-bakingo
Lalith h
13 Oct 2024
5 min read
Save for later

The Big Brand Theory | Freshness, Flavour and Innovation. That’s Bakingo!

Lalith h
13 Oct 2024
5 min read
The inception of Bakingo is a tale of foresight and ambition shared by three engineering friends—Shrey Sehgal, Himanshu Chawla, and Suman Patra. As passionate foodies, they felt that their sweet cravings were never fully satisfied.In many cities, only two or three prominent bakery brands thrived. What stood out, however, was the absence of a unified, national bakery brand — a gap that seemed impossible to ignore. This realization led Shrey, Himanshu, and Suman onto an exciting new venture!Founders of Bakingo: (From Left) Suman Patra, Himanshu Chawla, Shrey SehgalFrom simple concepts to sweet creationsThe roots of Bakingo trace back to the trio’s experience in running another venture, FlowerAura, a bootstrapped gifting business which they launched in 2011. What began in a modest basement steadily grew into a flourishing company. The valuable insights into logistics and operations that they got from those days, would later become pivotal to the creation and growth of Bakingo.As first-generation entrepreneurs, the founders understood the significant risk they were taking by starting their own business. Suman says, “We met in college, stayed connected, and eventually decided to take a leap of faith and launch our first venture together.”In 2014-15, while running FlowerAura, the founders noticed that ordering a cake was inconvenient—customers relied on local bakeries due to the absence of online delivery options. Moreover, the taste and quality of cakes varied widely from city to city, making it difficult for customers to find consistent, high-quality cakes across different parts of the country.This is how they came up with the idea of launching Bakingo in 2016. The vision was simple, yet ambitious – deliver freshly baked, high-quality cakes and desserts right to customers’ doorsteps.Since they had previously relied on vendors who were primarily spread across different states, they wished to monitor operations more closely when they established Bakingo. Recognizing the value of quality control, they set up dark stores which were entirely run by the brand.Suman says “Our learnings from running FlowerAura helped us leverage our technological acumen to streamline operations, minimize wastage, and ensure customer-centric values were at the forefront of our business model”.By actively seeking and valuing customer feedback, Bakingo continually refines its products and services. This ensures that each interaction with the brand is memorable and delightful.The brand also focuses on creating customized cakes for specific themes and occasions, such as birthdays, anniversaries, and festivals, ensuring that customers can find the perfect cake for every celebration.Bakingo sets itself apart by using technology extensively to ensure that every process, from baking to delivery, is meticulously monitored and optimized. This results in minimal wastage and maximized freshness, guaranteeing that customers receive the best products possible.
Read more
  • 0
  • 0
  • 506

article-image-test-by-lalith
Lalith
09 Oct 2024
1 min read
Save for later

test by lalith

Lalith
09 Oct 2024
1 min read
test content
Read more
  • 0
  • 0
  • 379

article-image-what-is-metas-llama-31-405b-how-it-works-use-cases-more
Sami Salkosuo
08 Aug 2024
6 min read
Save for later

What Is Meta's Llama 3.1 405B? How It Works, Use Cases & More

Sami Salkosuo
08 Aug 2024
6 min read
Having 405 billion parameter puts it in contention for a high position on the LMSys Chatbot Arena Leaderboard, a measure of performance scored from blind user votes.In recent months, the top spot has alternated between versions of OpenAI GPT-4, Anthropic Claude 3, and Google Gemini. Currently, GPT-4o holds the crown, but the smaller Claude 3.5 Sonnet takes the second spot, and the impending Claude 3.5 Opus is likely to take the first position if it can be released before OpenAI updates GPT-4o.That means competition at the high end is tough, and it will be interesting to see how Llama 3.1 405B stacks up to these competitors. While we wait for Llama 3.1 405B to appear on the leaderboard, some benchmarks are provided later in the article.Multi-lingual capabilitiesThe main update from Llama 3 to Llama 3.1 is better non-English support. The training data for Llama 3 was 95% English, so it performed poorly in other languages. The 3.1 update provides support for German, French, Italian, Portuguese, Hindi, Spanish, and Thai.Longer contextLlama 3 models had a context window—the amount of text that can be reasoned about at once—of 8k tokens (around 6k words). Llama 3.1 brings this up to a more modern 128k, making it competitive with other state-of-the-art LLMs.This fixes an important weakness for the Llama family. For enterprise use cases like summarizing long documents, generating code that involves context from a large codebase, or extended support chatbot conversations, a long context window that can store hundreds of pages of text is essential.Open model license agreementThe Llama 3.1 models are available under Meta's custom Open Model License Agreement. This permissive license grants researchers, developers, and businesses the freedom to use the model for both research and commercial applications.In a significant update, Meta has also expanded the license to allow developers to utilize the outputs from Llama models, including the 405B model, to enhance other models.In essence, this means that anyone can utilize the model's capabilities to advance their work, create new applications, and explore the possibilities of AI, as long as they adhere to the terms outlined in the agreement.How Llama 3.1 405B Works?This section explains the technical details of how Llama 3.1 405B works, including its architecture, training process, data preparation, computational requirements, and optimization techniques.Transformer architecture with tweaks Llama 3.1 405B is built upon a standard decoder-only Transformer architecture, a design common to many successful large language models.While the core structure remains consistent, Meta has introduced minor adaptations to enhance the model's stability and performance during training. Notably, the Mixture-of-Experts (MoE) architecture is intentionally excluded, prioritizing stability and scalability in the training process.Source: Meta AIThe diagram illustrates how Llama 3.1 405B processes language. It starts with the input text being divided into smaller units called tokens and then converted into numerical representations called token embeddings.These embeddings are then processed through multiple layers of self-attention, where the model analyzes the relationships between different tokens to understand their significance and context within the input.The information gathered from the self-attention layers is then passed through a feedforward network, which further processes and combines the information to derive meaning. This process of self-attention and feedforward processing is repeated multiple times to deepen the model's understanding.Finally, the model uses this information to generate a response token by token, building upon previous outputs to create a coherent and relevant text. This iterative process, known as autoregressive decoding, enables the model to produce a fluent and contextually appropriate response to the input prompt.Multi-phase training processDeveloping Llama 3.1 405B involved a multi-phase training process. Initially, the model underwent pre-training on a vast and diverse collection of datasets encompassing trillions of tokens. This exposure to massive amounts of text allows the model to learn grammar, facts, and reasoning abilities from the patterns and structures it encounters.Following pre-training, the model undergoes iterative rounds of supervised fine-tuning (SFT) and direct preference optimization (DPO). SFT involves training on specific tasks and datasets with human feedback, guiding the model to produce desired outputs.DPO, on the other hand, focuses on refining the model's responses based on preferences gathered from human evaluators. This iterative process progressively enhances the model's ability to follow instructions, improve the quality of its responses, and ensure safety.Data quality and quantityMeta claims to have strongly emphasized the quality and quantity of training data. For Llama 3.1 405B, this involved a rigorous data preparation process, including extensive filtering and cleaning to enhance the overall quality of the datasets.Interestingly, the 405B model itself is used to generate synthetic data, which is then incorporated into the training process to further refine the model's capabilities.Scaling up computationallyTraining a model as large and complex as Llama 3.1 405B requires a tremendous amount of computing power. To put it in perspective, Meta used over 16,000 of NVIDIA's most powerful GPUs, the H100, to train this model efficiently.They also made significant improvements to their entire training infrastructure to ensure it could handle the immense scale of the project, allowing the model to learn and improve effectively.Quantization for inferenceTo make Llama 3.1 405B more usable in real-world applications, Meta applied a technique called quantization, which involves converting the model's weights from 16-bit precision (BF16) to 8-bit precision (FP8). This is like switching from a high-resolution image to a slightly lower resolution: it preserves the essential details while reducing the file size.Similarly, quantization simplifies the model's internal calculations, making it run much faster and more efficiently on a single server. This optimization makes it easier and more cost-effective for others to utilize the model's capabilities.Llama 3.1 405B Use CasesLlama 3.1 405B offers various potential applications thanks to its open-source nature and large capabilities.Synthetic data generationThe model's ability to generate text that closely resembles human language can be used to create large amounts of synthetic data.This synthetic data can be valuable for training other language models, enhancing data augmentation techniques (making existing data more diverse), and developing realistic simulations for various applications.Model distillationThe knowledge embedded within the 405B model can be transferred to smaller, more efficient models through a process called distillation.Think of model distillation as teaching a student (a smaller AI model) the knowledge of an expert (the larger Llama 3.1 405B model). This process allows the smaller model to learn and perform tasks without needing the same level of complexity or computational resources as the larger model.This makes it possible to run advanced AI capabilities on devices like smartphones or laptops, which have limited power compared to the powerful servers used to train the original model.A recent example of model distillation is OpenAI’s GPT-4o mini, which is a distilled version of GPT-4o.Research and experimentationLlama 3.1 405B serves as a valuable research tool, enabling scientists and developers to explore new frontiers in natural language processing and artificial intelligence.Its open nature encourages experimentation and collaboration, accelerating the pace of discovery.Industry-specific solutionsBy adapting the model to data specific to particular industries, such as healthcare, finance, or education, it's possible to create custom AI solutions that address the unique challenges and requirements of those domains.
Read more
  • 3
  • 12
  • 1061

article-image-twrtewtwe
wetewtwet
07 Mar 2024
1 min read
Save for later

twrtewtwe

wetewtwet
07 Mar 2024
1 min read
ewfnuiwen FIUWEb uifbhweiu FBWeiubhf iuewbhfui bgequfgeq gfuieqghFI UGH EQfgiueqwbfiueqbIU RFBewoufg rueq wghriugequirg wiurgi ueqgruife qgbuirfbg eqiu frbg ieqwbriueqbr iuqeb
Read more
  • 0
  • 0
  • 760
Unlock access to the largest independent learning library in Tech for FREE!
Get unlimited access to 7500+ expert-authored eBooks and video courses covering every tech area you can think of.
Renews at €14.99/month. Cancel anytime
article-image-test
test
13 Feb 2024
1 min read
Save for later

test

test
13 Feb 2024
1 min read
test egni4 nrgijbn 4irgbwr hubvuhiw brhuw4b higb ewruhgb hurwbg hiuwbr3hig brwhigbh uwebrgu ybwr3iygbihew rbghiweinhniuiubnibni Test
Read more
  • 0
  • 0
  • 782

article-image-test-11
rohith
03 Jul 2023
1 min read
Save for later

Test 11

rohith
03 Jul 2023
1 min read
sfdg his df sdiohfipsdj  sdifhsdjpfhq 9dqi diaohsd8iagb8owd eaw' a8gwbehdisaj'dasid adasdsfcfgsfg lsijf ni0whe9f wh9wef8hwe9 h8w9 he9r0fwe 09hfw9eh0s9hr 8fqh  wad'wq8egsfb8qg 8hed q8g8dwe8r8hewodhasb h8a igdb89wehf8 q9as fhworhf0weo8shfd8oh8fhwe8hr8hwe8 8wuegf8w ef wh8fehw eh fweb fw]s fh9w8eh8qehq8whrohwe rwerwe
Read more
  • 0
  • 0
  • 366

article-image-4-ways-to-treat-a-hallucinating-ai-with-prompt-engineering
Andrei Gheorghiu
02 Jun 2023
9 min read
Save for later

4 Ways to Treat a Hallucinating AI with Prompt Engineering

Andrei Gheorghiu
02 Jun 2023
9 min read
Hey there, fellow AI enthusiast! Are you tired of your LLM (Large Language Model) creating random, nonsensical outputs? Fear not, because today I’m opening the box of prompt engineering pills looking for something to help you reduce those pesky hallucinations.First, let's break down what we're dealing with. Prompt engineering is the art of creating input prompts for AI models in a way that guides them towards generating more accurate, relevant, and useful responses. Think of it as gently nudging your AI model in the right direction, so it doesn't end up lost in a sea of information. The word “engineering” was probably not the wisest choice in many people’s opinion but that’s already history as everybody got used to it as it is. In my opinion, it’s more of a mix of logical thinking, creativity, language, and problem-solving skills. It feels a lot like writing code but using just natural language instead of structured syntax and vocabulary. While the user gets the freedom of using their own language and depth, with great freedom comes great responsibility. An average prompt will probably result in an average answer. The issue I’m addressing in this article is just one example from the many pitfalls that can be avoided with some basic prompt hygiene when interacting with AI.Now, onto the bizarre world of hallucinations. In the AI realm, hallucinations refer to instances when an AI model (particularly LLMs) generates output that is unrelated, implausible, or just plain weird. Some of you may have been there already, asking an AI model like GPT-3 to write a paragraph about cats, only to get a response about aliens invading Earth! And while the issue has been greatly mitigated in GPT-4 and similar newer AI models, it’s still something to be concerned about, especially if you’re looking for precise, fact-based responses. To make matters worse, sometimes the hallucinated answer sounds very convincing and seems to be plausible in the given context.For example, when asked the name of the Voodoo Lady in the Monkey Island series of games ChatGPT provides a series of convincing answers, all of which are wrong: It’s a bit of a trick question, as she is simply known as the Voodoo Lady in the original series of games, but you can see how convinced ChatGPT is of the answers that it provides (and continued to provide). If I hadn’t already known the answer, then I never would have known that ChatGPT was hallucinating. What Are the Technical Reasons Why AI Models Hallucinate? Training Data: Machine learning models are trained on vast amounts of text data from diverse sources. This data may contain inconsistencies, noise, and biases. As a result, when generating text, the model might output content that is influenced by these inconsistencies or noise, leading to hallucinations.Probabilistic Nature: Generative models like GPTs are based on probabilistic techniques that predict the next token (e.g., word or character) in a sequence, given the context. They estimate the likelihood of each token appearing and sample tokens based on these probabilities. If you’ve ever watched “Family Feud” on TV, you get a pretty good idea of what token prediction means. This sampling process can sometimes result in unpredictable and implausible outputs, as the model might choose less likely tokens, generating hallucinations. To make matters worse, GPTs are usually not built to say "I don't know" when they lack information. Instead, they produce the most likely answer.  Lack of Ground Truth: Unlike supervised learning tasks where there is a clear ground truth for the model to learn from, generative tasks do not have a single correct output. Most LLMs that we use do not have the capability to check the facts in their output against a real-time validated source as they do not have Internet access. The absence of a ground truth can make it difficult for the model to learn constraints and discern what is plausible or correct, leading to the generation of hallucinated content.  Optimization Challenges: During training, the models are optimized using a loss function that measures the discrepancy between the generated output and the expected outcome. In generative tasks, this loss function may not always capture the nuances of human language, making it difficult for the model to learn the correct patterns and avoid hallucinations.Model Complexity: State-of-the-art generative models like GPT-3 have billions of parameters that make them highly expressive and capable of capturing complex patterns in the data. However, this complexity can also result in overfitting and memorization of irrelevant or spurious patterns, causing hallucinations in generated outputs.So, clearly, we have a problem to solve. Here are four tips for how to improve your prompts and get better responses from ChatGPT. Four Tips for Improving Your Prompts Not being clear and specific in your promptsTo get the best results, you must clearly understand the problem yourself first. Make sure you know what you want to achieve and keep your prompts focused on that objective. The more explicit your prompt, the better the AI model can understand what you're looking for. So instead of asking, "Tell me about the Internet," try something like, "Explain how the Internet works and its importance in modern society." By doing this, you're giving your AI model a clearer picture of what you want. Sometimes you’ll have to make your way through multiple prompt iterations to get the result you’re after. Sometimes results you'll get may steer away from the initial topic. Make sure to stay on track and avoid deviating from the task at hand. Make sure you bring the conversation back in focus, otherwise the hallucination effect may amplify. Ignoring the power of an exampleEveryone loves examples they say, even AI models! Providing examples in your prompt helps your model understand the context and generate more accurate responses. For instance, "Write a brief history of Python, similar to how the history of Java is described in this article {example}" This not only gives the AI a clear topic but also a reference point to follow. Providing a well-structured example can also save you a lot of time in explaining the output you’re expecting to receive. Without an example your prompt might be too generic, allowing too much freedom in interpretation. Think about it like a conversation. Sometimes, the best approach to make yourself understood by the other party is to provide an example. Do you want to make sure there’s no misunderstanding from the start? Include an example in your initial prompt. Not following “Divide et Impera”Have you ever tried to build IKEA furniture without instructions? It's a bit like that for AI models dealing with complex prompts. Too many nuts and bolts to keep track of. Too many variables to consider. Instead of asking the model to "Explain the process of creating a neural network," break it down into smaller, more manageable tasks like, "Step 1: Define the problem, Step 2: Collect and prepare data," and so on. This way, the AI can tackle each step individually and generate more coherent outputs. It’s also very useful when you are trying to generate a more verbose and comprehensive response and not just a simple factual answer. You can, of course, combine both approaches asking the AI to provide the steps first, and then asking for more information on each step. Relying on the first response you receiveAs most LLMs in use today do not provide enough transparency in their reasoning process, working with them sometimes feels like interacting with a magic box. The non-deterministic nature of generative AI can further amplify this problem, so when you need precision it's best to experiment with various prompt formats and compare the results. Pro tip: some open-source models can already be queried in parallel using this website:   Or, when interacting with a single AI model, try multiple approaches for your query like rephrasing the prompt, asking a question or presenting it as a statement.For example, if you're looking for information about cloud computing, you could try:"What is cloud computing and how does it work?""Explain cloud computing and its benefits.""Cloud computing has transformed the IT industry; discuss its impact and future potential."Some LLMs, such as Google's Bard, provide multiple responses by default so you can pick the most suitable from among them. Compare the outputs. Validate any important facts with other independent sources. Look for implausible or weird responses. Although a hallucination is possible, by using different prompts you’ll greatly reduce the probability of generating the same hallucination every time and therefore it’s going to be easier to detect it.Returning to our Voodoo Lady example earlier, by rephrasing the question we can get the right answer from ChatGPT.  And there you have it! By trying to avoid these common mistakes you'll be well on your way to minimizing AI hallucinations and getting the output you're looking for. We all know how fast and unpredictable this domain can be, so the best approach is to learn together and share best practices among the community. The best prompt engineering books have not yet been written and there’s a ton of new things to learn about this emergent technology, so let’s stay in touch and share our findings!Happy prompting!  About the Author Andrei Gheorghiu is an experienced trainer with a passion for helping learners achieve their maximum potential. He always strives to bring a high level of expertise and empathy to his teaching. With a background in IT audit, information security, and IT service management, Andrei has delivered training to over 10,000 students across different industries and countries. He is also a Certified Information Systems Security Professional and Certified Information Systems Auditor, with a keen interest in digital domains like Security Management and Artificial Intelligence. In his free time, Andrei enjoys trail running, photography, video editing and exploring the latest developments in technology.You can connect with Andrei on:LinkedinTwitter
Read more
  • 1
  • 36
  • 1691

article-image-lorem-ipsum-dolor-sit-amet-honor
Surajit Basak
30 May 2023
3 min read
Save for later

Lorem ipsum dolor sit amet honor

Surajit Basak
30 May 2023
3 min read
What is Lorem Ipsum?Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.Why do we use it?It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like). Where does it come from?Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of "de Finibus Bonorum et Malorum" (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, "Lorem ipsum dolor sit amet..", comes from a line in section 1.10.32.The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from "de Finibus Bonorum et Malorum" by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.Where can I get some?There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn't anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.
Read more
  • 1
  • 19
  • 238
article-image-summarizing-data-with-openai-chatgpt
Greg Beaumont
29 May 2023
5 min read
Save for later

Summarizing Data with OpenAI ChatGPT

Greg Beaumont
29 May 2023
5 min read
Introduction In the ever-expanding landscape of data analysis, the ability to summarize vast amounts of information concisely and accurately is invaluable. Enter ChatGPT, an advanced AI language model developed by OpenAI. In this article, we delve into the realm of data summarization with ChatGPT, exploring how this powerful tool can revolutionize the process of distilling complex datasets into concise and informative summaries. Numerous databases feature free text fields that comprise entries from a diverse array of sources, including survey results, physician notes, feedback forms, and comments regarding incident reports for the FAA Wildlife Strike database that we have used in this book. These text entry fields represent a wide range of content, from structured data to unstructured data, making it challenging to extract meaning from them without the assistance of sophisticated natural language processing tools. The Remarks field of the FAA Wildlife Strike database contains text that was presumably entered by people involved in filling out the incident form about an aircraft striking wildlife. A few examples of the remarks for recent entries are shown in Power BI in the following screenshot: Figure 12.6 – Examples of Remarks from the FAA Wildlife Strike Database You will notice that the remarks have a great deal of variability in the format of the content, the length of the content, and the acronyms that were used. Testing one of the entries by simply adding a statement at the beginning to “Summarize the following:” yields the following result: Figure 12.7 – Summarizing the remarks for a single incident using ChatGPT Summarizing data for a less detailed Remarks field yields the following results: Figure 12.8 – Summarization of a sparsely populated results field In order to obtain uniform summaries from the FAA Wildlife Strike data's Remarks field, one must consider entries that vary in robustness, sparsity, completeness of sentences, and the presence of acronyms and quick notes. The workshop accompanying this technical book is your chance to experiment with various data fields and explore diverse outcomes. Both the book and the Packt GitHub site will utilize a standardized format as input to a GPT model that can incorporate event data and produce a consistent summary for each row. An example of the format is as follows:  Summarize the following in three sentences: A [Operator] [Aircraft] struck a [Species]. Remarks on the FAA report were: [Remarks]. Using data from an FAA Wildlife Strike Database event to test this approach in OpenAI ChatGPT is shown in the following screenshot: Figure 12.9 – OpenAI ChatGPT testing a summarization of the remarks field Next, you test another scenario that had more robust text in the Remarks field: Figure 12.10 – Another scenario with robust remarks tested using OpenAI ChatGPT Summary This article explores how ChatGPT can revolutionize the process of condensing complex datasets into concise and informative summaries. By leveraging its powerful language generation capabilities, ChatGPT enables researchers, analysts, and decision-makers to quickly extract key insights and make informed decisions. Dive into the world of data summarization with ChatGPT and unlock new possibilities for efficient data analysis and knowledge extraction. Author Bio: Greg Beaumont is a Data Architect at Microsoft; Greg is an expert in solving complex problems and creating value for customers. With a focus on the healthcare industry, Greg works closely with customers to plan enterprise analytics strategies, evaluate new tools and products, conduct training sessions and hackathons, and architect solutions that improve the quality of care and reduce costs. With years of experience in data architecture and a passion for innovation, Greg has a unique ability to identify and solve complex challenges. He is a trusted advisor to his customers and is always seeking new ways to drive progress and help organizations thrive. For more than 15 years, Greg has worked with healthcare customers who strive to improve patient outcomes and find opportunities for efficiencies. He is a veteran of the Microsoft data speaker network and has worked with hundreds of customers on their data management and analytics strategies.You can follow Greg on LinkedInThis article is an excerpt from the book, Machine Learning with Microsoft Power BI | Packt (packtpub.com), by Greg Beaumont
Read more
  • 3
  • 3
  • 1129

article-image-how-to-add-code-block-support-on-ck-editor-in-vue-3-project
Surajit Basak
27 May 2023
2 min read
Save for later

How to add code block support on CK Editor in Vue 3 Project

Surajit Basak
27 May 2023
2 min read
Exercitationem voluptatibus saepe veritatis quibusdam similique. Sed consequatur dolores sunt fuga et. Voluptas rerum reiciendis rerum velit et eos. Ut ut ex sunt consectetur rem cum. Quia ut veritatis minus ad. Aliquid suscipit dicta consequatur est sunt beatae. Quas vel unde dolorem maiores non reiciendis. Tempora laborum et necessitatibus suscipit error repellat. Doloremque quibusdam et nisi excepturi dolorum quia eveniet. Voluptas sed quibusdam numquam non sunt consequatur. Iste et illum provident modi aut qui. Et facere iusto ut earum repudiandae. Modi voluptatibus doloribus eaque iusto quos aspernatur. In officia eum et dolor. Atque minima odit harum omnis quos provident. Sequi deleniti id saepe quam iusto est omnis.Qoute Block StyleAn object at rest remains at rest, and an object in motion remains in motion at constant speed and in a straight line unless acted on by an unbalanced force.- By Isaac NewtonThe acceleration of an object depends on the mass of the object and the amount of force applied.- By Isaac NewtonWhenever one object exerts a force on another object, the second object exerts an equal and opposite on the first.- By Isaac NewtonTesting for image block using file uploader:Testing for image that was uploaded using url (Centered image): Slide image:How can I add code block support to CKEditor 5 on vue 2 projectAdd first you need to install the ckeditor code block:npm i @ckeditor/ckeditor5-code-blockWhen install is finished import the plugin:import { CodeBlock } from '@ckeditor/ckeditor5-code-block';Then Add that code block to your ck editor config:editorConfig: { plugins: [CodeBlock], toolbar: { items: ['codeBlock'] }, codeBlock: { languages: [ { language: 'plaintext', label: 'Plain text' }, // The default language. { language: 'c', label: 'C' }, { language: 'cs', label: 'C#' }, { language: 'cpp', label: 'C++' }, { language: 'css', label: 'CSS' }, { language: 'diff', label: 'Diff' }, { language: 'html', label: 'HTML' }, { language: 'java', label: 'Java' }, { language: 'javascript', label: 'JavaScript' }, { language: 'php', label: 'PHP' }, { language: 'python', label: 'Python' }, { language: 'ruby', label: 'Ruby' }, { language: 'typescript', label: 'TypeScript' }, { language: 'xml', label: 'XML' } ] } }Here is the demo php code:<?php class MySpecialClass { public function __construct(User $user, Service $service, Product $product) {} public function authenticate() { $this->user->login(); } public function process() { $this->product->generateUUID(); try { return $this->service->validate($this->product) ->deliver(); } catch (MySpecialErrorHandler $e) { $e->throwError(); } } }
Read more
  • 2
  • 7
  • 1372

article-image-interact-with-chatgpt-api-using-open-ai-python-library
430
23 May 2023
8 min read
Save for later

Interact with ChatGPT API using Open AI Python Library

430
23 May 2023
8 min read
How to use the OpenAI Python library to interact with the ChatGPT API Using the ChatGPT API with Python is a relatively simple process. You'll first need to make sure you create a new PyCharm project called ChatGPTResponse as shown in the following screenshot:This is for testing purpose dshfku busdikfk sihdfios difh 9shfoisduhf osbidl dfhiosh lfos ighsog j idfshf os'd fids ij si'djfisd jf  sdfjops  PACKT PLUS                                                                                                      Fig 1: New Project Window in PyCharm Once you have that setup, you can use the OpenAI Python library to interact with the ChatGPT API. Open a new Terminal in PyCharm, make sure that you are in your project folder and install the openai package: $ pip install openai Next, you need to create a new Python file in your PyCharm project on the left top corner perform a Right-click on the folder ChatGPTResponse | New | Python File.  Name the file app.py and click hit Enter. You should now have a new Python file in your project directory:                                                                                                                   Fig 2: New Python File To get started, you'll need to import the openai library into your Python file. Also, you'll need to provide your OpenAI API Key. You can obtain an API Key from the OpenAI website by following the steps outlined in the previous sections of this book. Then you'll need to set it as a parameter in your Python code. Once your API Key is set up, you can start interacting with the ChatGPT API. import openaiopenai.api_key = “YOUR_API_KEY” Replace YOUR_API_KEY with the API key you obtained from the OpenAI platform page. Now, you can ask the user for a question using the input() function:question = input("What would you like to ask ChatGPT? ") The input() function is used to prompt the user to input a question they would like to ask the ChatGPT API. The function takes a string as an argument, which is displayed to the user when the program is run. In this case, the question string is "What would you Like to ask ChatGPT?". When the user types their question and presses enter, the input() function will return the string that the user typed. This string is then assigned to the variable question.To pass the user question from your Python script to ChatGPT, you will need to use the ChatGPT API Completion function: response = openai.Completion.create(    engine="text-davinci-003",    prompt=question,    max_tokens=1024,    n=1,    stop=None,    temperature=0.8,) The openai.Completion.create() function in the code is used to send a request to the ChatGPT API to generate a completion of the user's input prompt. The engine parameter specifies the ChatGPT engine to use for the request, and in this case, it is set to "text-davinci-003". The prompt parameter specifies the text prompt for the API to complete, which is the user's input question in this case. The max_tokens parameter specifies the maximum number of tokens the response should contain.  The n parameter specifies the number of completions to generate for the prompt. The stop parameter specifies the sequence where the API should stop generating the response. The temperature parameter controls the creativity of the generated response. It ranges from 0 to 1. Higher values will result in more creative but potentially less coherent responses, while lower values will result in more predictable but potentially fewer interesting responses. Later in the book, we will delve into how these parameters impact the responses received from ChatGPT. The function returns a JSON object containing the generated response from the ChatGPT API, which then can be accessed and printed to the console in the next line of code.print(response)In the project pane on the left-hand side of the screen, locate the Python file you want to run. Right-click on the app.py file and select Run app.py from the context menu. You should receive a message in the run window  that asks you to write a question to the ChatGPT.                                                                                                                              Fig 3: Run windowOnce you have entered your question, press the Enter key to submit your request to the ChatGPT API. The response generated by the ChatGPT API model will be displayed in the run window as a complete JSON object: { "choices": [    {     "finish_reason": "stop",     "index": 0,     "logprobs": null,     "text": "\n\n1. Start by getting in the water. If you're swimming in a pool, you can enter the water from the side, ………….    }  ], "created": 1681010983, "id": "cmpl-73G2JJCyBTfwCdIyZ7v5CTjxMiS6W", "model": "text-davinci-003", "object": "text_completion", "usage": {    "completion_tokens": 415,   "prompt_tokens": 4,   "total_tokens": 419  }} This JSON response produced by the OpenAI API contains information about the response generated by the GPT-3 model. This response consists of the following fields:The choices field contains an array of objects with the generated responses, which in this case only contains one response object. The text field within the response object contains the actual response generated by the GPT-3 model.The finish_reason field indicates the reason why the response was generated; in this case it was because the model reached the stop condition specified in the API request.The created field specifies the Unix timestamp of when the response was created. The id field is a unique identifier for the API request that generated this response.The model field specifies the GPT-3 model that was used to generate the response. The object field specifies the type of object that was returned, which in this case is text_completion.The usage field provides information about the resource usage of the API request. It contains information about the number of tokens used for the completion, the number of tokens in the prompt, and the total number of tokens used. The two most important parameter from the response is the text field, that contains the answer to the question asked to ChatGPT API. This is why most API users would like to access only that parameter from the JSON object. You can easily separate the text from the main body as follows: answer = response["choices"][0]["text"]print(answer) By following this approach, you can guarantee that the variable answer will hold the complete ChatGPT API text response, which you can then print to verify. Keep in mind that ChatGPT responses can significantly differ depending on the input, making each response unique.OpenAI: 1. Start by getting in the water. If you're swimming in a pool, you can enter the water from the side, ladder, or diving board. If you are swimming in the ocean or lake, you can enter the water from the shore or a dock. 2. Take a deep breath in and then exhale slowly. This will help you relax and prepare for swimming.SummaryIn this tutorial, you implemented a simple ChatGPT API response, by sending a request to generate a completion of a user's input prompt/question. You have also learned how to set up your API Key and how to prompt the user to input a question, and finally, how to access the generated response from ChatGPT in the form of a JSON object containing information about the response.  About the Author Martin Yanev is an experienced Software Engineer who has worked in the aerospace and medical industries for over 8 years. He specializes in developing and integrating software solutions for air traffic control and chromatography systems. Martin is a well-respected instructor with over 280,000 students worldwide, and he is skilled in using frameworks like Flask, Django, Pytest, and TensorFlow. He is an expert in building, training, and fine-tuning AI systems with the full range of OpenAI APIs. Martin has dual master's degrees in Aerospace Systems and Software Engineering, which demonstrates his commitment to both practical and theoretical aspects of the industry. https://www.linkedin.com/in/martinyanev/https://www.udemy.com/user/martin-yanev-3/ 
Read more
  • 0
  • 2
  • 266
article-image-new-test-title
661
23 May 2023
2 min read
Save for later

New test title

661
23 May 2023
2 min read
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.import java.util.Scanner; public class HelloWorld { public static void main(String[] args) { // Creates a reader instance which takes // input from standard input - keyboard Scanner reader = new Scanner(System.in); System.out.print("Enter a number: "); // nextInt() reads the next integer from the keyboard int number = reader.nextInt(); // println() prints the following line to the output screen System.out.println("You entered: " + number); } }# Python program to check if the input number is odd or even. # A number is even if division by 2 gives a remainder of 0. # If the remainder is 1, it is an odd number. num = int(input("Enter a number: ")) if (num % 2) == 0: print("{0} is Even".format(num)) else: print("{0} is Odd".format(num))
Read more
  • 0
  • 0
  • 385

article-image-test-title-54567
661
23 May 2023
1 min read
Save for later

Test title 54567

661
23 May 2023
1 min read
This is text and something. aasasasLorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Read more
  • 0
  • 0
  • 666