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
Explore 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

7011 Articles
article-image-everything-you-need-to-know-about-agentgpt
Avinash Navlani
02 Jul 2023
4 min read
Save for later

Everything You Need to Know about AgentGPT

Avinash Navlani
02 Jul 2023
4 min read
Advanced language models have been used in the last couple of years to create a variety of AI products, including conversational AI tools and AI assistants. A web-based platform called AgentGPT allows users to build and use AI agents right from their browsers. Making AgentGPT available to everyone and promoting community-based collaboration are its key goals.ChatGPT provides accurate, meaningful, in-depth specific answers and discussion to given input questions while AgentGPT, on the other hand, is an AI agent platform that takes an objective and achieves the goal by thinking, learning, and taking actions.AgentGPT can assist you with your goals without installing and downloading. You just need to create an account and get the power of AI-enabled Conversational AI. You have to provide a name and objective for your agent, and the agent will achieve the goal.What is AgentGPT?AgentGPT is an open-source platform that is developed by openAI and uses the GPT3.5 architecture. AgentGPT is an NLP-based technology that generates human-like text with accuracy and fluency. It can engage in conversations, question-answers, generative content, and problem-solving assistance.How does AgentGPT work?AgentGPT breaks down a given prompt into smaller tasks, and the agent completes these specific tasks in order to achieve the goal. Its core strength is engaging in real and contextual conversation. It generates dynamic discussions while learning from the large dataset. It recognizes the intentions and responds in a way that is human-like.How to Use Agent GPT?Let’s first create an account on reworkd.ai. After creating the account, deploy the agent by providing the agent's name and objective.In the snapshot below, you can see that we are deploying an agent for Fake News Detection. As a user, we just need to provide two inputs: Name and Goal. For example, in our case, we have provided Fake News Detection as the name and Build Classifier for detecting fake news articles as a goal.Image 1: AgentGPT pageOnce you click the deploy agent. It starts identifying the task and add all the task in the queue. After that one by one, it executes all the tasks.Image 2: Queue of tasksIn the below snapshot, you can see it has completed the 2 tasks and working on the third task(Extract Relevant features). In all the tasks, it has also provided the code samples to implement the task.Image 3: Code samplesOnce your goal is achieved, you can save the results by clicking on the save button in the top-right corner.You can also improve the performance by providing relevant examples, using the ReAct approach for improving the prompting, and upgrading the version from local to Pro version.You also set up AgentGPT on the local machine. For detailed instructions, you can follow this link.SummaryCurrently, AgentGPT is in the beta phase, and the developer community is actively working on its features and use cases. It is one of the most significant milestones in the era of advanced large-language models. Its ability to generate human-like responses opens up potential opportunities for industrial applications such as customer service, content generation, decision support systems, and personal assistance.Author BioAvinash Navlani has over 8 years of experience working in data science and AI. Currently, he is working as a senior data scientist, improving products and services for customers by using advanced analytics, deploying big data analytical tools, creating and maintaining models, and onboarding compelling new datasets. Previously, he was a university lecturer, where he trained and educated people in data science subjects such as Python for analytics, data mining, machine learning, database management, and NoSQL. Avinash has been involved in research activities in data science and has been a keynote speaker at many conferences in India.Link - LinkedIn    Python Data Analysis, Third edition                                            
Read more
  • 0
  • 0
  • 35626

article-image-how-open-source-language-models-could-reshape-the-tech-industry
Julian Melanson
30 Jun 2023
5 min read
Save for later

How Open-Source Language Models Could Reshape the Tech Industry

Julian Melanson
30 Jun 2023
5 min read
The world of technology, characterized by an incessant and rapid pace of evolution, is on the cusp of a seismic shift. Historically, the development and control of large language models—a key component in modern artificial intelligence systems—have been dominated by tech industry giants. However, emerging developments show that this might not be the status quo for much longer. The burgeoning field of open-source LLMs presents a potential disruption to the current balance of power in the tech industry, signaling a shift towards a more democratic and inclusive AI landscape.Major tech firms like Microsoft and Google, armed with vast financial resources, have long held the reins of the LLM market. Their position seemed unassailable as recent earnings calls indicated a thriving business built around their AI services. Yet, a leaked internal document from Google has cast a shadow of uncertainty over this seemingly secure stronghold. The central idea gleaned from this document? No company has an unassailable fortress against competition in the realm of LLMs, not even the mighty OpenAI, the organization responsible for the groundbreaking GPT-3.The story of GPT-3 is a pivotal chapter in the annals of AI history. Its 2020 release ignited a spark in the research community, illuminating the tantalizing promise of scale. With 175 billion parameters, GPT-3 showed capabilities that stretched beyond its initial training data. The success of this LLM prompted a surge of interest in the creation of larger, more complex models. This development led to an arms race among AI research labs, producing increasingly massive models such as Gopher, LaMDA, PaLM, and Megatron-Turing.However, this race towards larger LLMs engendered a substantial increase in research and development costs. The staggering financial demands associated with training and running models like GPT-3 created an environment where LLM innovation was essentially confined to the wealthiest entities in tech. With this economic pressure to recoup their considerable investment, these companies began to commercialize their technology, leading to the erection of protective "moats" around their products. These mechanisms of defensibility safeguarded their investments against the competition, obscuring their research and constraining the sharing of intellectual resources.Key elements of these moats included the proprietary control over training data, model weights, and the costs associated with training and inference. With their deep pockets, big tech companies kept the upper hand in managing the expenses tied to training and running large LLMs. This dominance rendered even open-source alternatives such as BLOOM and OPT175-B largely inaccessible to organizations without the fiscal means to support the hefty demands of these advanced models.The Coming of Open-Source Language ModelsFor a time, this state of affairs painted a bleak picture for the democratization of LLMs, with the field becoming increasingly exclusive and secretive. However, the ebb and flow of innovation and competition that define the tech industry were bound to respond. The open-source community rose to the challenge, their endeavors intensifying following the release of OpenAI's ChatGPT, an instruction-following language model that illustrated the vast potential of LLMs in a multitude of applications.These open-source alternatives are changing the game by proving that performance is not solely a function of scale. Small, nimble LLMs trained on expansive datasets have proven the ability to compete head-to-head with their larger counterparts. Moreover, the open-source models, often consisting of 7-13 billion parameters, can be fine-tuned to remarkable degrees on a modest budget and can run on consumer-grade GPUs.One such example, the open-source LLM developed by Meta, known as LLaMA, sparked a wave of similar models like Alpaca and Vicuna. These models, constructed on top of LLaMA, displayed an impressive capability for instruction-following akin to ChatGPT. The subsequent release of Dolly 2.0 by Databricks and Open Assistant further enriched the field by providing commercially usable, instruction-following LLMs that organizations can tailor to their specific needs.The impact of these open-source models is profound. They potentially democratize access to advanced AI systems, reducing the cost of training by using techniques like low-rank adaptation (LoRA) and allowing businesses to incorporate LLMs into their operations at an affordable price. This development poses a significant challenge to the established order, undermining the monopoly of tech giants on LLMs.Nonetheless, the rise of open-source models does not spell the end of cloud-based language models. Despite the democratization they promise, open-source LLMs face significant hurdles, including the prohibitive costs of pre-training. Furthermore, they may not be the best choice for all businesses. Companies without in-house machine learning expertise may still prefer the convenience of out-of-the-box, serverless solutions provided by the likes of Microsoft and Google. The entrenched distribution channels of these tech behemoths also present a formidable barrier for open-source LLMs to overcome.However, the broader implications of the open-source movement in LLMs are unmistakable. It expands the market, opens up novel applications, and puts pressure on tech giants to offer more competitive pricing. By democratizing access to advanced AI, it allows for broader participation in the AI revolution, reducing the concentration of power and innovation within a few wealthy tech companies. As the LLM landscape continues to evolve rapidly, the rise of open-source models will leave an indelible mark on the tech industry.Author BioJulian Melanson is one of the founders of Leap Year Learning. Leap Year Learning is a cutting-edge online school that specializes in teaching creative disciplines and integrating AI tools. We believe that creativity and AI are the keys to a successful future and our courses help equip students with the skills they need to succeed in a continuously evolving world. Our seasoned instructors bring real-world experience to the virtual classroom and our interactive lessons help students reinforce their learning with hands-on activities.No matter your background, from beginners to experts, hobbyists to professionals, Leap Year Learning is here to bring in the future of creativity, productivity, and learning!
Read more
  • 0
  • 0
  • 12271

article-image-revolutionizing-business-productivity-using-cassidyai
Julian Melanson
28 Jun 2023
6 min read
Save for later

Revolutionizing Business Productivity using CassidyAI

Julian Melanson
28 Jun 2023
6 min read
In recent times, the entrepreneurial environment has seen a surge in innovation, particularly in the realm of artificial intelligence. Among the stalwarts of this revolution is Neo, a startup accelerator masterminded by Silicon Valley investor Ali Partovi. In a groundbreaking move in March, Neo entered a strategic partnership with renowned AI research organization OpenAI, and tech giant Microsoft Corp. The objective was clear: to offer no-cost software and expert advice to startups orienting their focus towards AI. This partnership's results are already tangible, with CassidyAI, a startup championed by content creator Justin Fineberg, being one of the companies benefiting from this initiative.CassidyAI: A Pioneer in AI-Driven Business AutomationFineberg recently announced that CassidyAI is stepping out from the shadows, shedding its stealth mode. CassidyAI's primary function is an embodiment of innovation: facilitating businesses to create customized AI assistants, thus automating tasks, optimizing productivity, and integrating AI across entire organizations. With this aim, CassidyAI is at the forefront of a paradigm shift in business process automation and management.Amplifying Productivity: CassidyAI's VisionAt its core, CassidyAI embraces an ambitious vision: to multiply the productivity of every team within an organization by a factor of ten. This tenfold increase isn't just a lofty goal; it is a transformative approach that involves deploying AI technology across business operations. CassidyAI accomplishes this by providing a platform for generating bespoke AI assistants that cater to individual departmental needs. This process involves training these virtual assistants using the specific knowledge base and data sets of each department.Harnessing AI Across Departments: Versatile Use-CasesThe potential applications of CassidyAI's platform are practically limitless. The diversity of use cases underscores the flexibility and versatility of the AI-assistant creation process. In marketing, for instance, teams can train CassidyAI on their unique writing style and marketing objectives, thereby crafting content that aligns perfectly with the brand image. Similarly, sales teams can enhance their outreach initiatives by leveraging CassidyAI's understanding of the sales pitch, process, and customer profiles.In customer service, AI assistants can respond to inquiries accurately and efficiently, with CassidyAI's ability to access comprehensive support knowledge. Engineering teams can train CassidyAI on their technical stack and engineering methods and architecture, enabling more informed technical decisions and codebase clarity. Product teams can use CassidyAI's profound understanding of their team dynamics and user experience principles to drive product ideation and roadmap collaboration. Finally, HR departments can provide employees with quick access to HR documentation through AI assistants trained to handle such inquiries.Data Security and Transparency: CassidyAI's AssuranceBeyond its vast application range, CassidyAI distinguishes itself through its commitment to data security and transparency. The platform's ability to import knowledge from various platforms ensures a deep understanding of a company's brand, operations, and unique selling propositions. Equally important, all interactions with CassidyAI remain reliable and secure due to their stringent data handling practices and clear citation of sources.Setting Up AI Automation: A No-Code ApproachCassidyAI's approach to implementing AI in businesses is straightforward and code-free, catering to those without programming skills. Businesses begin by securely uploading their internal data and knowledge to train CassidyAI on their unique products, strategies, processes, and more. They then construct AI assistants that are fine-tuned for their distinct use cases, without the need to write a single line of code. Once the AI assistants are ready, they can be shared across the team, fostering an atmosphere of AI adoption and collaboration throughout the organization.Interestingly, the onboarding process for each company joining CassidyAI is currently personally overseen by Fineberg. Although this may limit the pace of early access, it provides a personalized and detailed introduction to CassidyAI’s capabilities and potential. Companies interested in exploring CassidyAI's offerings can request a demo through their website.CassidyAI represents a revolutionary approach to adopting AI technology in businesses. By creating tailored AI assistants that cater to the specific needs of different departments, it offers an opportunity to substantially improve productivity and streamline operations. Its emergence from stealth mode signals a new era of AI-led business automation and provides an exciting glimpse into the future of work. It is anticipated that as CassidyAI gains traction, more businesses will leverage this innovative tool to their advantage, fundamentally transforming their approach to task automation and productivity enhancement.You can browse the website and request a demo here: https://www.cassidyai.comReal-World Use casesHere are some specific examples of how CassidyAI is being used by real businesses:Centrifuge: Centrifuge is using CassidyAI to originate real-world assets and to securitize them. This is helping Centrifuge to provide businesses with access to financing and to reduce risk.Tinlake: Tinlake is using CassidyAI to automate the process of issuing and managing loans backed by real-world assets. This is helping Tinlake to provide a more efficient and cost-effective lending solution for businesses.Invoice Finance: Invoice Finance is using CassidyAI to automate the process of processing invoices and to provide financing to businesses based on the value of their invoices. This is helping Invoice Finance to provide a more efficient and timely financing solution for businesses.Bondora: Bondora is using CassidyAI to assess the risk of loans and to provide investors with more information about the loans they are considering investing in. This is helping Bondora to provide a more transparent and efficient investment platform for investors.Upstart: Upstart is using CassidyAI to assess the creditworthiness of borrowers and to provide them with more personalized lending terms. This is helping Upstart to provide a more inclusive and affordable lending solution for borrowers.These are just a few examples of how CassidyAI is being used by real businesses to improve their operations and to provide better services to their customers. As CassidyAI continues to develop, it is likely that even more use cases will be discovered.SummaryCassidyAI, a startup in partnership with Neo, OpenAI, and Microsoft, is revolutionizing business productivity through AI-driven automation. Their platform enables businesses to create customized AI-assistants, optimizing productivity and integrating AI across departments. With a no-code approach, CassidyAI caters to various use-cases, including marketing, sales, customer service, engineering, product, and HR. The platform emphasizes data security and transparency while providing a personalized onboarding process. As CassidyAI emerges from stealth mode, it heralds a new era of AI-led business automation, offering businesses the opportunity to enhance productivity and streamline operations.Author BioJulian Melanson is one of the founders of Leap Year Learning. Leap Year Learning is a cutting-edge online school that specializes in teaching creative disciplines and integrating AI tools. We believe that creativity and AI are the keys to a successful future and our courses help equip students with the skills they need to succeed in a continuously evolving world. Our seasoned instructors bring real-world experience to the virtual classroom and our interactive lessons help students reinforce their learning with hands-on activities.No matter your background, from beginners to experts, hobbyists to professionals, Leap Year Learning is here to bring in the future of creativity, productivity, and learning!
Read more
  • 0
  • 0
  • 9462

article-image-practical-ai-in-excel-create-a-linear-regression-model
M.T White
28 Jun 2023
12 min read
Save for later

Practical AI in Excel: Create a Linear Regression Model

M.T White
28 Jun 2023
12 min read
AI is often associated with complex algorithms and advanced programming, but for basic linear regression models, Excel is a suitable tool. While Excel may not be commonly linked with AI, it can be an excellent option for building statistical machine-learning models. Excel offers similar modeling capabilities as other libraries, without requiring extensive setup or coding skills. It enables leveraging machine learning for predictive analytics without writing code. This article focuses on using Excel to build a linear regression model for predicting story points completed by a software development team based on hours worked.What is Linear Regression?Before a linear regression model can be built it is important to understand what linear regression is and what it's used for.  For many, their first true shake with linear regression will come in the form of a machine learning library or machine learning cloud service. In terms of modern machine learning, linear regression is a supervised machine learning algorithm that is used for predictive analytics.  In short, linear regression is a very common and easy-to-use machine learning model that is borrowed from the field of statistics.  This means, at its core, linear regression is a statistical analysis technique that models a relationship between two or more variables.  In the most rudimentary sense, linear regression boils down to the following equation,y = mx + bAs can be seen, the equation (that is the linear regression model) is little more than the equation for a line.  No matter the library or machine learning service that is used, in its purest form linear regression will boil down to the above equation.  In short, linear regression is used for predictive, numerical models.  In other words, linear regression produces models that attempt to predict a numerical value.  This could be the weight of a person in relation to their height, the value of a stock in relation to the Dow, or anything similar to those two applications.  As stated before, the model that will be produced for this article will be used to predict the number of story points for a given number of hours worked.Why should Excel be used?Due to the statistical nature of linear regression, Excel is a prime choice for creating linear regression models.  This is especially true if (among other things) one or more of the following conditions are met,The person creating the model does not have a strong computer science or machine learning background. The person needs to quickly produce a model.The data set is very small.If a person simply needs to create a forecasting model for their team, forecast stocks, customer traffic, or whatever it may be, Excel will oftentimes be a better choice than creating a traditional program or using complex machine learning software. With that being established, how would one go about creating a linear regression model?Installing the Necessary Add-insTo build a linear regression model the following will be needed,A working copy of Excel.Analysis ToolPak add-in for Excel.The Analysis ToolPak is the workhorse for this tutorial.  As such, if it is not installed follow the steps in the next section; however, if the add-in is already installed the following section can be skipped.Installing Data Analysis ToolPak1. Click,  File -> Option -> Add-insOnce done the following wizard should appear:Figure 1 – Options Wizard2. Locate Analysis ToolPak and select it.  Once that is done the following popup will appear.Figure 2 – Add-ins WizardFor this tutorial, all that is technically needed is the Analysis ToolPak but it is a good idea to install the VBA add-in as well. 3. Verify the installation by navigating to the Data tab and verifying that the Data Analysis tools are installed.  If everything is installed properly, the following should be visible.  Figure 3 – Data Analysis ToolOnce the Analysis ToolPak is installed a linear regression model can be generated with a few clicks of the mouse. Building a Linear Regression Model to Predict Story Points. Once all the add-ins are installed, create a workbook and copy in the following data:HoursStory Points161315121511134228281830191032114117129251924172315 Before the model can be built the independent and dependent variables must be chosen.  This is a fancy way of determining which column is going to be the input and which is going to be the output for the model.  In this case, the goal is to predict the number of story points for a given number of hours worked. As such, when the model is created the number of hours will be inputted to return the number of predicted story points. This means that the number of hours worked will be the independent variable which will be on the X-Axis of the graph and the number of story points will be the dependent variable which will be on the Y-Axis. As such, to generate the model perform the following steps,1. Navigate to the Data tab and click Data Analysis.  When complete the following popup should appear.Figure 4 – Regression Analysis  Scroll down and select Regression then press the OK button.2. Once step 1 is completed the following wizard should appear.Figure 5 – Regression Setup Input the data the same way it is presented in Figure 5.  Once done The data should be rendered as in Figure 6.Figure 6 – Linear Regression Output.At this point, the linear regression model has been produced.  To make a prediction all one has to do is multiply the number of hours worked by the Hours value in the Coefficient column and add the Intercept value in the Coefficient column to that product. However, it is advisable to generate a trendline and add the line’s equation and the R-Squared value to the chart to make things easier to see.  This can be remedied by simply deleting the predicted dots and adding a trendline like in Figure 7.Figure 7 – TrendlineThe trendline will show the best fit for the model.  In other words, the model will use the equation that governs the trendline to predict a value.  To generate the line’s equation click the arrow button by Trendline and click More Options.  When this is done a sidebar should appear similar to the one in Figure 8.Figure 8 – Format Trendline MenuFrom here select the R-square value checkbox and the Display Equation on chart checkbox. When this is done those values should be displayed on the graph like in Figure 9. Figure 9 – Regression Model with line equation and R-squared valueTo create a prediction, all one has to do is plug in the number of hours for x in the equation and the computed value will be an approximation for the number of story points for the hours worked. Interperting the ModelRegression StatisticsMultiple R0.862529R Square0.743956Adjusted R Square0.722619Standard Error2.805677Observations14Now that the model is generated, how good is it?  This question can be answered with the data that was produced in Figure 6.  However, a whole book could be dedicated to interpreting those outputs, so for this article, the data in the observation group which can be thought of as the high-level summary of the model will be explored.   Consider, the following data:Regression StatisticsMultiple R0.862529R Square0.743956Adjusted R Square0.722619Standard Error2.805677Observations14 The first value is Multiple R or as it is sometimes called the Correlation Coefficient.  This value can range from -1 to 0 or 0 to 1 depending on whether the correlation is negative or positive respectively.  The closer the coefficient is to either -1 or 1 the better. With that, what is the difference between a negative and positive correlation?  Whether a correlation is negative or positive depends on the graph’s orientation which in turn means whether the correlation coefficient is positive or negative.  If the graph is downward oriented the correlation is negative. For these models, the correlation coefficient will be less than 0.  On the other hand, if the graph is upward oriented like the graph produced by the model it is said to have a positive correlation which in turn means the coefficient will be greater than 0.  Consider Figure 10,Figure 10 – Negative and Positive Correlation Ultimately it doesn’t matter if the model has a positive or negative correlation.  All the correlation means is that as one value rises the other will either rise with it or fall.  In terms of the model produced, the Multiple R-value is .86.  All things considered that is a really good correlation coefficient. The next important value to look at is the R-Squared value or the Coefficient of Determination.  This value describes how well the model fits the data.  In other words, it determines how many data points fall on the line.  The R-Squred value will range from 0 to 1.  As such, the closer the value is to 1 the better the model will be.  Though a value as close to 1 is desirable it is naïve to assume that an R-Squared of 1 will ever be achievable.  However, a lower R-Squared value is not necessarily a bad thing.  Depending on what is being measured, what constitutes a “good” R-Squared value will vary.  In the case of this model, the R-Squared is about .74 which means about 74% of the data can be explained by the model.  Depending on the context of the application that can be considered good, but it should be remembered that at most the model is only predicting 74% of what makes up the number of completed story points. Adjusted R-Squred is simply a more precise view of the R-Squared value. In simple terms, the adjusted R-Squared value determines how much of a variation in the dependent variables can be explained by the independent variables. The Adjusted R for this model is .72 which is in line with the R-Squard value.Finally, the Standard Error is the last fitting metric.  In a very simplistic sense, this metric is a measure of precision for the model.  As such, the standard error for this model is about 2.8.  Much like other metrics what constitutes good is subjective.  However, the closer the value is to 0 the more concise the model is. Using the modelNow that the model has been created, what would someone do with it, that is how would they use it?  The answer is surprisingly simple.  The whole model is a line equation.  That line will give an approximation of a value based on the given input.  In the case of this model, a person would input the number of hours worked to try to predict the number of story points. As such, someone could simply input the number of hours in a calculator, add the equation to a spreadsheet, or do anything they want with it.  Put simply, this or any other linear regression model is used by inputting a value or values and crunching the numbers.  For example, the equation rendered was as follows:y = 0.6983x - 1.1457The spreadsheet could be modified to include the followingIn this case, the user would simply have to input the number of hours worked to get a predicted number of story points. The important thing to remember is that this model along with any other regression model is not gospel.  Much like in any other machine learning system, these values are simply estimates based on the data that was fed into it.  This means if a different data set or subset is used, the model can and probably will be different. ConclusionIn summary, a simple Excel spreadsheet was used to create a linear regression model.  The linear regression model that was utilized will probably be very similar to a model generated with dedicated machine learning software.  Does this mean that everyone should abandon their machine-learning software packages and libraries and solely use Excel?  The long and the short of it is no! Excel, much like a library like Scikit-learn or any other, is a tool.  However, for laypersons that don’t have a strong computer science background and need to produce a quick regression model, Excel is an excellent tool to do so. Author BioM.T. White has been programming since the age of 12. His fascination with robotics flourished when he was a child programming microcontrollers such as Arduino. M.T. currently holds an undergraduate degree in mathematics, and a master's degree in software engineering, and is currently working on an MBA in IT project management. M.T. is currently working as a software developer for a major US defense contractor and is an adjunct CIS instructor at ECPI University. His background mostly stems from the automation industry where he programmed PLCs and HMIs for many different types of applications. M.T. has programmed many different brands of PLCs over the years and has developed HMIs using many different tools.Author of the book: Mastering PLC Programming
Read more
  • 0
  • 0
  • 66166

article-image-taskmatrix-bridging-the-gap-between-text-and-visual-understanding
Rohan Chikorde
28 Jun 2023
11 min read
Save for later

TaskMatrix: Bridging the Gap Between Text and Visual Understanding

Rohan Chikorde
28 Jun 2023
11 min read
IntroductionIn the fast-paced digital landscape of today, the fusion of text and visual understanding has become paramount. As technology continues to advance, the integration of text and visuals has become essential for enhancing communication, problem-solving, and decision-making processes. With the advent of technologies like ChatGPT and Visual Foundation Models, we now have the ability to seamlessly exchange images during conversations and leverage their capabilities for various tasks. Microsoft's TaskMatrix system serves as a revolutionary solution that bridges the gap between text and visual understanding, empowering users to harness the combined power of these domains. TaskMatrix is an innovative system developed by Microsoft, designed to facilitate collaboration between ChatGPT and Visual Foundation Models. By seamlessly integrating text and visual inputs, TaskMatrix enables users to enhance their communication, perform image-related tasks, and extract valuable insights from visual data. In this technical blog, we will explore the functionalities, applications, and technical intricacies of TaskMatrix, providing a comprehensive understanding of its potential and the benefits it offers to users. Through an in-depth analysis of TaskMatrix, we aim to shed light on how this system can revolutionize the way we interact with text and visual elements. By harnessing the power of advanced machine learning models, TaskMatrix opens up new possibilities for communication, problem-solving, and decision-making, ultimately leading to improved user experiences and enhanced outcomes. Let us now dive deep into the world of TaskMatrix and uncover its inner workings and capabilities.Understanding TaskMatrixTaskMatrix is an open-source system developed by Microsoft with the aim of bridging the gap between ChatGPT and Visual Foundation Models. It serves as a powerful platform that enables the integration of image-related tasks within conversations, revolutionizing the way we communicate and solve problems. One of the key features of TaskMatrix is its ability to facilitate image editing. Users can now manipulate and modify images directly within the context of their conversations. This functionality opens up new avenues for creative expression and enables a richer visual experience during communication. Furthermore, TaskMatrix empowers users with the capability of performing object detection and segmentation tasks. By leveraging the advanced capabilities of Visual Foundation Models, the system can accurately identify and isolate objects within images. This functionality enhances the understanding of visual content and facilitates better communication by providing precise references to specific objects or regions of interest. The integration of TaskMatrix with ChatGPT is seamless, allowing users to combine the power of natural language processing with visual understanding. By exchanging images and leveraging the domain-specific knowledge of Visual Foundation Models, ChatGPT becomes more versatile and capable of handling diverse tasks effectively. TaskMatrix introduces the concept of templates, which are pre-defined execution flows for complex tasks. These templates facilitate collaboration between different foundation models, enabling them to work together cohesively. With templates, users can execute multiple tasks seamlessly, leveraging the strengths of different models and achieving more comprehensive results. Moreover, TaskMatrix supports both English and Chinese languages, making it accessible to a wide range of users across different linguistic backgrounds. The system is designed to be extensible, welcoming contributions from the community to enhance its functionalities and expand its capabilities.Key Features and FunctionalitiesTaskMatrix provides users with a wide range of powerful features and functionalities that empower them to accomplish complex tasks efficiently. Let's explore some of the key features in detail:Template-based Execution Flows: One of the standout features of TaskMatrix is its template-based approach. Templates are pre-defined execution flows that encapsulate specific tasks. They serve as a guide for executing complex operations involving multiple foundation models. Templates streamline the process and ensure smooth collaboration between different models, making it easier for users to achieve their desired outcomes.Language Support: TaskMatrix supports multiple languages, including English and Chinese. This broad language support ensures that users from various linguistic backgrounds can leverage the system's capabilities effectively. Whether users prefer communicating in English or Chinese, TaskMatrix accommodates their needs, making it a versatile and accessible platform for a global user base.Image Editing: TaskMatrix introduces a unique feature that allows users to perform real-time image editing within the conversation flow. This capability enables users to enhance and modify images seamlessly, providing a dynamic visual experience during communication. From basic edits such as cropping and resizing to more advanced adjustments like filters and effects, TaskMatrix equips users with the tools to manipulate images effortlessly.Object Detection and Segmentation: Leveraging the power of Visual Foundation Models, TaskMatrix facilitates accurate object detection and segmentation. This functionality enables users to identify and locate objects within images, making it easier to reference specific elements during conversations. By extracting valuable insights from visual content, TaskMatrix enhances the overall understanding and communication of complex concepts.Integration with ChatGPT: TaskMatrix seamlessly integrates with ChatGPT, a state-of-the-art language model developed by OpenAI. This integration enables users to combine the power of natural language processing with visual understanding. By exchanging images and leveraging the strengths of both ChatGPT and TaskMatrix, users can address a wide range of tasks and challenges, ranging from creative collaborations to problem-solving scenarios.Technical ImplementationTaskMatrix utilizes a sophisticated technical implementation that combines the power of machine learning models, APIs, SDKs, and specialized frameworks to seamlessly integrate text and visual understanding. Let's take a closer look at the technical intricacies of TaskMatrix.Machine Learning Models: At the core of TaskMatrix are powerful machine learning models such as ChatGPT and Visual Foundation Models. ChatGPT, developed by OpenAI, is a state-of-the-art language model that excels in natural language processing tasks. Visual Foundation Models, on the other hand, specialize in visual understanding tasks such as object detection and segmentation. TaskMatrix leverages the capabilities of these models to process and interpret both text and visual inputs.APIs and SDKs: TaskMatrix relies on APIs and software development kits (SDKs) to integrate with the machine learning models. APIs provide a standardized way for TaskMatrix to communicate with the models and send requests for processing. SDKs offer a set of tools and libraries that simplify the integration process, allowing TaskMatrix to seamlessly invoke the necessary functionalities of the models.Specialized Frameworks: TaskMatrix utilizes specialized frameworks to optimize the execution and resource management of the machine learning models. These frameworks efficiently allocate GPU memory for each visual foundation model, ensuring optimal performance and fast response times, even for computationally intensive tasks. By leveraging the power of GPUs, TaskMatrix can process and analyze images with speed and accuracy.Intelligent Routing: TaskMatrix employs intelligent routing algorithms to direct user requests to the appropriate model. When a user engages in a conversation that involves an image-related task, TaskMatrix analyzes the context and intelligently determines which model should handle the request. This ensures that the right model is invoked for accurate and relevant responses, maintaining the flow and coherence of the conversation.Seamless Integration: TaskMatrix seamlessly integrates the responses from the visual foundation models back into the ongoing conversation. This integration ensures a natural and intuitive user experience, where the information and insights gained from visual analysis seamlessly blend with the text-based conversation. The result is a cohesive and interactive communication environment that leverages the combined power of text and visual understanding.By combining machine learning models, APIs, SDKs, specialized frameworks, and intelligent routing algorithms, TaskMatrix achieves a technical implementation that seamlessly integrates text and visual understanding. This implementation optimizes performance, resource management, and user experience, making TaskMatrix a powerful tool for enhancing communication, problem-solving, and collaboration. System Architecture:Image 1: System ArchitectureGetting Started with TaskMatrixTo get started with TaskMatrix, you can follow the step-by-step instructions and documentation provided in the TaskMatrix GitHub repository. This repository serves as a central hub of information, offering comprehensive guidelines, code samples, and examples to assist users in setting up and utilizing the system effectively. Access the GitHub Repository: Begin by visiting the TaskMatrix GitHub repository, which contains all the necessary resources and documentation. You can find the repository by searching for "TaskMatrix" on the GitHub platform.Follow the Setup Instructions:The repository provides clear instructions on how to set up TaskMatrix. This typically involves installing the required dependencies, configuring the APIs and SDKs, and ensuring the compatibility of the system with your development environment. The setup instructions will vary depending on your specific use case and the programming language or framework you are using.# clone the repo git clone https://github.com/microsoft/TaskMatrix.git # Go to directory cd visual-chatgpt # create a new environment conda create -n visgpt python=3.8 # activate the new environment conda activate visgpt #  prepare the basic environments pip install -r requirements.txt pip install  git+https://github.com/IDEA-Research/GroundingDINO.git pip install  git+https://github.com/facebookresearch/segment-anything.git # prepare your private OpenAI key (for Linux) export OPENAI_API_KEY={Your_Private_Openai_Key} # prepare your private OpenAI key (for Windows) set OPENAI_API_KEY={Your_Private_Openai_Key} # Start TaskMatrix ! # You can specify the GPU/CPU assignment by "--load", the parameter indicates which # Visual Foundation Model to use and where it will be loaded to # The model and device are separated by underline '_', the different models are separated by comma ',' # The available Visual Foundation Models can be found in the following table # For example, if you want to load ImageCaptioning to cpu and Text2Image to cuda:0 # You can use: "ImageCaptioning_cpu,Text2Image_cuda:0" # Advice for CPU Users python visual_chatgpt.py --load ImageCaptioning_cpu,Text2Image_cpu # Advice for 1 Tesla T4 15GB  (Google Colab)                      python visual_chatgpt.py --load "ImageCaptioning_cuda:0,Text2Image_cuda:0"                               # Advice for 4 Tesla V100 32GB                           python visual_chatgpt.py --load "Text2Box_cuda:0,Segmenting_cuda:0,    Inpainting_cuda:0,ImageCaptioning_cuda:0,    Text2Image_cuda:1,Image2Canny_cpu,CannyText2Image_cuda:1,    Image2Depth_cpu,DepthText2Image_cuda:1,VisualQuestionAnswering_cuda:2,    InstructPix2Pix_cuda:2,Image2Scribble_cpu,ScribbleText2Image_cuda:2,    SegText2Image_cuda:2,Image2Pose_cpu,PoseText2Image_cuda:2,    Image2Hed_cpu,HedText2Image_cuda:3,Image2Normal_cpu,    NormalText2Image_cuda:3,Image2Line_cpu,LineText2Image_cuda:3" Explore Code Samples and Examples: The TaskMatrix repository offers code samples and examples that demonstrate how to use the system effectively. These samples showcase various functionalities and provide practical insights into integrating TaskMatrix into your projects. By exploring the code samples, you can better understand the implementation details and gain inspiration for incorporating TaskMatrix into your own applications.Engage with the Community: TaskMatrix has an active community of users and developers who are passionate about the system. You can engage with the community by participating in GitHub discussions, submitting issues or bug reports, and even contributing to the development of TaskMatrix through pull requests. The community is a valuable resource for support, knowledge sharing, and collaboration.DemoExample 1:Image 2: Demo Part 1  Image 3: Demo Part 2Example 2Image 5: Automatically generated description ConclusionTaskMatrix revolutionizes the synergy between text and visual understanding by seamlessly integrating ChatGPT and Visual Foundation Models. By enabling image-related tasks within conversations, TaskMatrix opens up new avenues for collaboration and problem-solving. With its intuitive template-based execution flows, language support, image editing capabilities, and object detection and segmentation functionalities, TaskMatrix empowers users to efficiently tackle diverse tasks.As the fields of natural language understanding and computer vision continue to evolve, TaskMatrix represents a significant step forward in bridging the gap between text and visual understanding. Its potential applications are vast, spanning industries such as e-commerce, virtual assistance, content moderation, and more. Embracing TaskMatrix unlocks a world of possibilities, where the fusion of text and visual elements enhances human-machine interaction and drives innovation to new frontiers.Author BioRohan Chikorde is an accomplished AI Architect professional with a post-graduate in Machine Learning and Artificial Intelligence. With almost a decade of experience, he has successfully developed deep learning and machine learning models for various business applications. Rohan's expertise spans multiple domains, and he excels in programming languages such as R and Python, as well as analytics techniques like regression analysis and data mining. In addition to his technical prowess, he is an effective communicator, mentor, and team leader. Rohan's passion lies in machine learning, deep learning, and computer vision.LinkedIn
Read more
  • 0
  • 0
  • 6456

article-image-bloomberggpt-putting-finance-to-work-using-large-language-models
Julian Melanson
28 Jun 2023
7 min read
Save for later

BloombergGPT: Putting Finance to Work using Large Language Models

Julian Melanson
28 Jun 2023
7 min read
In recent years, the financial industry has experienced a significant surge in the amount and complexity of data. This exponential growth has underscored the need for advanced artificial intelligence models capable of comprehending and processing the specialized language used in finance. Addressing this demand, Bloomberg unveiled BloombergGPT, a revolutionary language model trained on a diverse range of financial data.The Rise of BloombergGPTReleased on March 30th, BloombergGPT represents a groundbreaking development in the financial sector's application of AI technology. By focusing specifically on finance-related tasks, BloombergGPT aims to enhance existing NLP applications employed by Bloomberg, including sentiment analysis, named entity recognition, news classification, and question answering. Furthermore, this sophisticated model holds the promise of unlocking new possibilities for leveraging the vast amounts of data accessible through the Bloomberg Terminal, thereby empowering the firm's customers and fully harnessing the potential of AI in the financial domain.Unleashing the Power of BloombergGPTBloombergGPT boasts two notable capabilities that propel it beyond generic language models. First, it possesses the ability to generate Bloomberg Query Language (BQL), which serves as a query language for accessing and analyzing financial data on the Bloomberg platform. BQL, a powerful and intricate tool, enables various financial tasks such as data searching, analysis, report creation, and insight generation. BloombergGPT's proficiency in transforming natural language queries into valid BQL fosters more intuitive interactions with financial data, streamlining the querying process and enhancing user experience.The second noteworthy feature of BloombergGPT is its capability to provide suggestions for news headlines. This functionality proves invaluable for news applications and aids journalists in constructing compelling and informative newsletters. By inputting paragraphs, BloombergGPT can generate relevant and engaging titles, saving time and enhancing the efficiency of content creation.Training BloombergGPT: A Domain-Specific ApproachTo train BloombergGPT, Bloomberg employed a domain-specific approach, combining their own financial data with augmented online text data. This strategy demonstrates the value of developing language models tailored to specific industries, surpassing the utility of generic models. The training process involved building a dataset of English-language financial documents, incorporating 363 billion financial-specific tokens from Bloomberg's proprietary data assets and an additional 345 billion generic tokens from online text datasets, including The Pile, C4, and Wikipedia.The resulting domain-specific language model, BloombergGPT, comprises an impressive 50 billion parameters and is optimized for financial tasks. Notably, BloombergGPT outperforms popular open-source language models such as GPT-NeoX, OPT, and Bloom in finance-specific tasks. Furthermore, it exhibits remarkable performance in generic language tasks, including summarization, often rivaling the performance of GPT-3 based on Bloomberg's benchmarks.Applications and Advantages:BloombergGPT's introduction opens up a wealth of possibilities for employing language models in the financial technology realm. One such application is sentiment analysis, which enables the assessment of sentiments in articles, particularly those related to individual companies. Automatic entity recognition is another area where BloombergGPT excels, offering the potential for streamlined data extraction and analysis. Additionally, the model is adept at answering financial questions, providing prompt and accurate responses to user inquiries.Bloomberg's news division can leverage BloombergGPT to automatically generate compelling headlines for newsletters, reducing manual effort and improving efficiency. The model's capability to formulate queries in Bloomberg's proprietary query language (BQL) with minimal examples further augments its versatility. Users can interact with BloombergGPT using natural language, specifying their data requirements, and allowing the model to generate the appropriate BQL, expediting data extraction from databases.Shawn Edwards, Bloomberg's Chief Technology Officer, emphasizes the immense value of developing the first language model focused on the financial domain. The domain-specific approach not only allows for the creation of diverse applications but also yields superior performance compared to developing custom models for each specific task. This advantage, coupled with a faster time-to-market, positions BloombergGPT as a game-changer in the finance industry.The Future of BloombergGPT:BloombergGPT's potential extends beyond its current capabilities. As the model continues to train and optimize on financial data, further progress, and advancements are expected. Its application can be broadened to encompass a wider range of financial tasks, ultimately facilitating more accurate and efficient decision-making in the financial industry.BloombergGPT represents a significant milestone in the advancement of financial natural language processing. By addressing the unique language intricacies of the financial industry, this domain-specific language model holds immense potential for revolutionizing how financial data is analyzed, queried, and leveraged. With its impressive 50 billion parameters and exceptional performance in financial NLP tasks, BloombergGPT positions itself as a powerful tool that will shape the future of the finance industry.Use-casesAutomating research tasks: BloombergGPT is being used by researchers at the University of Oxford to automate the task of summarizing large medical datasets. This has allowed the researchers to save a significant amount of time and effort, and it has also allowed them to identify new insights that they would not have been able to find otherwise.Creating content: BloombergGPT is being used by businesses such as Nike and Coca-Cola to create content for their websites and social media channels. This has allowed these businesses to produce high-quality content more quickly and easily, and it has also helped them to reach a wider audience.Improving customer service: BloombergGPT is being used by customer service teams at companies such as Amazon and PayPal to provide customers with more personalized and informative responses. This has helped these companies to improve their customer satisfaction ratings.Generating code: BloombergGPT is being used by developers at companies such as Google and Facebook to generate code for new applications. This has helped these developers to save time and effort, and it has also allowed them to create more complex and sophisticated applications.Translating languages: BloombergGPT is being used by businesses such as Airbnb and Uber to translate their websites and apps into multiple languages. This has helped these businesses to expand into new markets and to reach a wider audience.These are just a few examples of how BloombergGPT is being used in the real world. As it continues to develop, it is likely that even more use cases will be discovered.SummaryIn recent years, the financial industry has faced a surge in data complexity, necessitating advanced artificial intelligence models. BloombergGPT, a language model trained on financial data, represents a groundbreaking development in the application of AI in finance. It aims to enhance Bloomberg's NLP applications, providing improved sentiment analysis, named entity recognition, news classification, and question answering. Notably, BloombergGPT can generate Bloomberg Query Language (BQL) and suggest news headlines, streamlining financial data querying and content creation. By training the model on domain-specific data, BloombergGPT outperforms generic models and offers various applications, including sentiment analysis, entity recognition, and prompt financial question answering. With further advancements expected, BloombergGPT has the potential to revolutionize financial NLP, enabling more accurate decision-making. The model's versatility and superior performance position it as a game-changer in the finance industry, with applications ranging from automating research tasks to improving customer service and code generation.Author BioJulian Melanson is one of the founders of Leap Year Learning. Leap Year Learning is a cutting-edge online school that specializes in teaching creative disciplines and integrating AI tools. We believe that creativity and AI are the keys to a successful future and our courses help equip students with the skills they need to succeed in a continuously evolving world. Our seasoned instructors bring real-world experience to the virtual classroom and our interactive lessons help students reinforce their learning with hands-on activities.No matter your background, from beginners to experts, hobbyists to professionals, Leap Year Learning is here to bring in the future of creativity, productivity, and learning!
Read more
  • 0
  • 0
  • 22336
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 $19.99/month. Cancel anytime
article-image-writing-a-customized-cover-letter-for-a-specific-job-in-minutes-using-chatgpt
Jesse Liberty
28 Jun 2023
6 min read
Save for later

Writing a Customized Cover Letter for a Specific Job in Minutes using ChatGPT

Jesse Liberty
28 Jun 2023
6 min read
Crafting a compelling cover letter is crucial for programmers seeking new opportunities. ChatGPT can give you a great running start. The more you give it to work with in the prompt, the more tailored and accurate the letter will be.Here is what I prompted: Write a cover letter for a resume for a programmer with over 30 years of experience in C, C++ and C#, git, and creating APIs. The programmer has worked in mobile, front end and back end and most recently has been building APIs for a large enterprise code-base using C#, SQL and Dapper, deployed to Azure using Docker. The position he is applying for includes working on back-end systems in C#, though they are advertising it as full-stack.Make it professional but no more than one page. ChatGPT didn't hesitate Here is what it spit out (I've left off the header with name, address, etc.): Dear [Recipient's Name],I am writing to express my interest in the position of a Programmer at [Company Name], as advertised on [Job Board/Company Website]. With over 30 years of experience in programming and a strong background in C, C++, and C#, I am confident in my ability to contribute to your team and help drive the success of your projects.Throughout my career, I have gained extensive knowledge and expertise in a wide range of programming languages and technologies. I have successfully worked in mobile, front-end, and back-end development, adapting to changing industry trends and applying best practices in each domain. Recently, my focus has been on building robust APIs for a large enterprise code-base using C#, SQL, and Dapper. I have also gained expertise in deploying applications to Azure using Docker, ensuring scalability, reliability, and security.One of my key strengths is my ability to create efficient and well-structured code that is maintainable and extensible. I thrive in collaborative environments, where I can contribute to the development of complex back-end systems. I have a solid understanding of software development principles, design patterns, and architectural concepts, allowing me to deliver high-quality solutions that meet business requirements.Throughout my career, I have been involved in the full software development lifecycle, from gathering requirements and designing solutions to implementation, testing, and maintenance. I am well-versed in version control systems like Git and have experience working in Agile development environments, ensuring timely and iterative delivery of software projects.I am excited about the opportunity to join [Company Name] and contribute to its continued success. I believe that my extensive experience in C#, coupled with my skills in building APIs, will enable me to make immediate and meaningful contributions to your back-end systems. Furthermore, my versatility and willingness to learn new technologies make me well-suited for the advertised full-stack position.I would welcome the opportunity to discuss how my skills and experience align with the needs of [Company Name]. Thank you for considering my application. I have attached my resume for your review, and I look forward to the possibility of an interview.Sincerely,[Your Name] Wow! That sounds like a candidate I'd want to talk with. Notice that it added a number of important (and correct) skills that were not in my prompt. It extrapolated what other skills I must have based on what I told it. For example, I didn't mention anything in the third paragraph, yet it provided a very powerful endorsement of these (assumed?) skills.I'm not sure I'd send this cover letter as-is, but with a little editing, it really would be ready to go.Just for an ego boost, I then asked ChatGPT if it knew me. My prompt was "Who is Jesse Liberty" and it spits out a pretty good bio: Jesse Liberty is a well-known software developer, author, and educator in the field of computer programming. He has been actively involved in the software industry for many years, specializing in various programming languages and technologies. Jesse has authored numerous books on software development, covering topics such as C#, .NET, ASP.NET, and mobile app development. He has also contributed to online learning platforms and delivered lectures and workshops at conferences and events. Jesse Liberty is recognized for his expertise and contributions to the programming community. While that was very gratifying, you must be careful. It doesn't always get things right. I asked, "Is Jesse Liberty a Microsoft MVP?" and it responded. As of my knowledge cutoff in September 2021, Jesse Liberty has not been listed as a Microsoft Most Valuable Professional (MVP). However, please note that MVP status can change over time, and it's always best to verify the most up-to-date information from official sources.By switching to ChatGPT4 I got a more accurate response:As of my last training cut-off in September 2021, Jesse Liberty, a noted author, speaker, and expert in .NET and mobile development, has been a Microsoft MVP in the past. However, the Microsoft MVP (Most Valuable Professional) status is a yearly award, and the list of awardees can change from year to year. It's not possible for me to confirm whether Jesse Liberty is a Microsoft MVP as of 2023 because my training data only goes up until September 2021. For the most up-to-date information, please check Microsoft's official MVP website.The biggest risk I've seen with ChatGPT is that it is so much fun it can become a real-time sink, so caveat emptor.Author BioJesse Liberty is a full-time hands-on programmer, specializing in C#, git, and .NET MAUI. He hosts the popular Yet Another Podcast and is the author of more than a dozen best-selling programming books. Liberty is a Certified Xamarin Developer, a Xamarin MVP, and a Microsoft MVP. He was a Technical Evangelist for Microsoft, a Distinguished Software Engineer at AT&T; a Software Architect for PBS, and a Vice President of Information Technology at Citibank, and he was on the teaching staff at Brandeis University. Jesse is a recognized expert and has spoken at conferences worldwide. Links - LinkedIn  .NET MAUI for C# Developers 
Read more
  • 0
  • 0
  • 13401

article-image-exploring-text-to-image-with-adobe-firefly
Joseph Labrecque
28 Jun 2023
9 min read
Save for later

Exploring Text to Image with Adobe Firefly

Joseph Labrecque
28 Jun 2023
9 min read
About Adobe FireflyWe first introduced Adobe Firefly in the article Animating Adobe Firefly Content with Adobe Animate published on June 14th of 2023. Let’s have a quick recap before moving ahead with a deeper look at Firefly itself.Adobe Firefly is a new set of generative AI tools which can be accessed via https://firefly.adobe.com/ by anyone with an Adobe ID that isn’t restricted by age or other factors. While Firefly is in beta… all generated images are watermarked with a Firefly badge in the lower left corner and Adobe recommends that it only be used for personal image generation and not for commercial use. These restrictions will change, of course, once Firefly procedures become integrated within Adobe software such as Photoshop and Illustrator. We plan to explore how to use Firefly-driven workflows within creative desktop software in future articles.Image 1: The Adobe Firefly websiteA couple of things make Firefly unique as a prompt-based image-generation service:The generative models were all trained on Adobe Stock content which Adobe already has rights to. This differs from many other such Ais whose models are trained on sets of content scraped from the web or otherwise acquired in a less-than-ideal way in terms of artist's rights.Firefly is accessed through a web-based interface and not through a Discord bot or installed software. The design of the user experience is pleasant to interface with and provides a low barrier to entry.Firefly goes way beyond prompt-based image generation. A number of additional generative workflows currently exist for use – with a number of additional procedures in exploration. As mentioned, Firefly as a web-based service may be a temporary channel – as more of the procedures are tested and integrated within existing desktop software.In the remainder of this article, we will focus on the text-to-image basics available in Firefly.Using Text to Image within FireflyWe will begin our explorations of Adobe Firefly with the ability to generate an image from a detailed text prompt. This is the form of generative AI that most people have some experience with and will likely come easily to those who have used similar services such as MidJourney, Stable Diffusion, or others.When you first enter the Firefly web experience, you will be presented with the various workflows available.We want to locate the Text to Image module and click Generate to enter the experience.Image 2: The Text to image module in FireflyFrom there, you’ll be taken to a view that showcases images generated through this process, along with a text input that invites you to enter a prompt to “describe the image you want to generate”.Image 3: The text-to-image prompt requests your input to beginEnter the following simple prompt: “Castle in a field of flowers”Click the Generate button when complete. You’ll then be taken into the heart of the Firefly experience.  Image 4: The initial set of images is generated from your promptWhen you enter the text-to-image module, you are presented with a set of four images generated from the given prompt. The prompt itself appears beneath the set of images and along the right-hand side is a column of options that can be adjusted.Exploring the Text-to-Image UIWhile the initial set of images that Firefly has generated do match our simple prompt pretty closely… we can manipulate a lot of additional controls which can have great influence upon the generated images.The first set of parameters you will see along the right-hand side of the screen is the Aspect ratio.Image 5: The image set aspect ratio can be adjustedThere is a rather large set of options in a dropdown selection that determines the aspect ratio of the generated images. As we see above, the default is Square (1:1). Let’s change that to Landscape (4:3) by choosing that option from the dropdown.Below that set of options, you will find Content-type.Image 6: Content type defines a stylistic bias for your imagesThe default is set to Art but you also have Photo, Graphic, and None as alternative choices. Each one of these will apply a bias to how the image is generated to be more photographic, more like a graphic, or even more traditional artwork. Choosing None will remove all such bias and allow your prompt to carry the full weight of intention. Chose None before moving on – as we will change our prompt to be much more descriptive to better direct Firefly.Beneath this, you will find the Styles section of options.Image 7: Styles are predefined terms that can be activated as neededStyles are basically keywords that are appended to your prompt in order to influence the results in very specific ways. These style prompts function just as if you’ve written the term as part of your written prompt. They exist as a sort of a predefined list of stylistic options that are easily added and removed from your prompt and are categorized by concepts such as Movements, Techniques, Materials, and more. As styles are added to your prompt, they appear beneath it and can be easily removed in order to allow easy exploration of ideas.At the very bottom of this area of the interface are a set of dropdown selections which include options for Color and tone, Lighting, and Composition.Image 8: You can also influence color and tone, lighting, and compositionJust as with the sections above, as you apply certain choices in these categories, they appear as keywords below your prompt. Choose a Muted color from the Color and tone list. Additionally, apply the Golden hour option from the Lighting dropdown.  Remember… you can always add any of these descriptors into the text prompt itself – so don’t feel limited by only the choices presented through the UI.Using a More Detailed Text PromptOkay – now that we’ve adjusted the aspect ratio and have either cleared or set a number of additional options… let’s make our text prompt more descriptive in order to generate a more interesting image.Change the current text prompt, which reads “castle in a field of flowers” to now read the much more detailed “vampiric castle in a field of flowers with a forest in the distance and mountains against the red sky”.Click the Generate button to have Firefly re-interpret our intent using the new prompt, presenting a much more detailed set of images derived from the prompt along with any keyword options we’ve included.Image 9: The more detail you put into your prompt – the more control you have over the generative visualsIf you find one of the four new images to be acceptable, it can be easily downloaded to your computer.Image 10: There are many options when hovering over an image – including downloadSimply hover your mouse over the chosen image and a number of additional options appear. We will explore these additional options in much greater detail in a future article. Click the download icon to begin the download process for that image.As Firefly begins preparing the image for download, a small overlay dialog appears.Image 11: Content credentials are applied to the image as it is downloadedFirefly applies metadata to any generated image in the form of content credentials and the image download process begins.What are content credentials? They are driven as part of the Content Authenticity Initiative to help promote transparency in AI. This is how Adobe describes content credentials in their Firefly FAQ:Content Credentials are sets of editing, history, and attribution details associated with content that can be included with that content at export or download. By providing extra context around how a piece of content was produced, they can help content producers get credit and help people viewing the content make more informed trust decisions about it. Content Credentials can be viewed by anyone when their respective content is published to a supporting website or inspected with dedicated tools. -- AdobeOnce the image is downloaded, it can be viewed and shared just like any other image file.Image 12: The chosen image is downloaded and ready for useAlong with content credentials, a small badge is placed upon the lower right of the image which visually identifies the image as having been produced with Adobe Firefly (beta).There is a lot more Firefly can do – and we will explore these additional options and procedures in the coming articles.Author BioJoseph is a Teaching Assistant Professor, Instructor of Technology, University of Colorado Boulder / Adobe Education Leader / Partner by DesignJoseph Labrecque is a creative developer, designer, and educator with nearly two decades of experience creating expressive web, desktop, and mobile solutions. He joined the University of Colorado Boulder College of Media, Communication, and Information as faculty with the Department of Advertising, Public Relations, and Media Design in Autumn 2019. His teaching focuses on creative software, digital workflows, user interaction, and design principles and concepts. Before joining the faculty at CU Boulder, he was associated with the University of Denver as adjunct faculty and as a senior interactive software engineer, user interface developer, and digital media designer.Labrecque has authored a number of books and video course publications on design and development technologies, tools, and concepts through publishers which include LinkedIn Learning (Lynda.com), Peachpit Press, and Adobe. He has spoken at large design and technology conferences such as Adobe MAX and for a variety of smaller creative communities. He is also the founder of Fractured Vision Media, LLC; a digital media production studio and distribution vehicle for a variety of creative works.Joseph is an Adobe Education Leader and member of Adobe Partners by Design. He holds a bachelor’s degree in communication from Worcester State University and a master’s degree in digital media studies from the University of Denver.Author of the book: Mastering Adobe Animate 2023
Read more
  • 0
  • 0
  • 17101

article-image-building-and-deploying-web-app-using-langchain
Avratanu Biswas
26 Jun 2023
12 min read
Save for later

Building and deploying Web App using LangChain

Avratanu Biswas
26 Jun 2023
12 min read
So far, we've explored the LangChain modules and how to use them (refer to the earlier blog post on LangChain Modules here). In this section, we'll focus on the LangChain Indexes and Agent module and also walk through the process of creating and launching a web application that everyone can access. To make things easier, we'll be using Databutton, an all-in-one online workspace to build and deploy web apps, integrated with Streamlit, a Python web- development framework known for its support in building interactive web applications.What are LangChain Agents?In simpler terms, LangChain Agents are tools that enable Large Language Models (LLMs) to perform various actions, such as accessing Google search, executing Python calculations, or making SQL queries, thereby empowering LLMs to make informed decisions and interact with users by using tools and observing their outputs. The official documentation of LangChain describes Agents as:" …there is an agent which has access to a suite of tools. Depending on the user input, the agent can then decide which, if any, of these tools to call… In building agents, there are several abstractions involved. The Agent abstraction contains the application logic, receiving user input and previous steps to return either an AgentAction (tool and input) or AgentFinish (completion information). Agent covers another aspect, called Tools, which represents the actions agents can take, while Toolkits group tools for specific use cases (e.g., SQL querying). Lastly, the Agent Executor manages the iterative execution of the agent with the available tools. Thus, in this section, we will briefly explore such abstractions while using the Agent functionality to integrate tools and primarily focus on building a real-world easily deployable web application.IndexesThis module provides utility functions for structuring documents using indexes and allowing LLMs to interact with them effectively. We will focus on one of the most commonly used retrieval systems, where indexes are used to find the most relevant documents based on a user's query. Additionally, LangChain supports various index and retrieval types, with a focus on vector databases for unstructured data. We will explore this component in detail as it can be leveraged in a wide number of real-world applications.Image 1 Langchain workflow by AuthorWorkflow of a question & answer generation interface using Retrieval index, where we leverage all types of Indexes which LangChain provides. Indexes are primarily of four types, namely : Document Loaders, Text Splitters, VectorStores, and Retrievers. Briefly, (a) the documents fetched from any datasource is split into chunks using text splitter modules (b) Embeddings are created (c)Stored over a vector store index ( vector databases such as chromadb / pinecone / weaviate, etc ) (d) Queries from the user is retrieved via retrieval QA chain We will use the  WikipediaLoader to load Wikipedia documents related to our query "LangChain" and retrieve the metadata and a portion of the page content of the first document.from langchain.document_loaders import WikipediaLoader docs = WikipediaLoader(query='LangChain', load_max_docs=2).load() docs[0].metadata docs[0].page_content[:400]CharacterTextSplitter is used to split the loaded documents into smaller chunks for further processing.from langchain.text_splitter import CharacterTextSplitter text_splitter = CharacterTextSplitter(chunk_size=4000, chunk_overlap=0) texts = text_splitter.split_documents(docs)The OpenAIEmbeddings the module is then employed to generate embeddings for the text chunks.from langchain.embeddings import OpenAIEmbeddings embeddings = OpenAIEmbeddings(openai_api_key=OPENAI_API_KEY)We will use Chroma vector store, which is created from the generated text chunks and embeddings, allowing for efficient storage and retrieval of vectorized data.Next, the RetrievalQA module is instantiated with an OpenAI LLM and the created retriever, setting up a question-answering system.from langchain.vectorstores import Chroma db = Chroma.from_documents(texts, embeddings) retriever = db.as_retriever() from langchain.chains import RetrievalQA from langchain.llms import OpenAI Qa  = RetrievalQA.from_chain_type(llm=OpenAI(openai_api_key=OPENAI_API_KEY), chain_type="stuff", retriever=retriever)At this stage, we can easily seek answers from the stored indexed data. For instance, query = "What is LangChain?" qa.run(query)LangChain is a framework designed to simplify the creation of applications using large language models (LLMs).query = "When was LangChain founded?" qa.run(query)LangChain was founded in October 2022.query = "When was LangChain founded?" qa.run(query)LangChain was founded in October 2022.query = "Who is the founder?" qa.run(query) The founder of LangChain is Harrison Chase.The Q&A functionality implemented using the retrieval chain provides reasonable answers to most of our queries. Different types of indexes provided by LangChain, can be leveraged for various real-world use cases involving data structuring and retrieval. Moving forward, we will delve into the next section, where we will focus on the final component called the "Agent." During this section, we will not only gain a hands-on understanding of its usage but also build and deploy a web app using an online workspace called Databutton.Building Web App using DatabuttonPrerequisitesTo begin using Databutton, all that is required is to sign up through their official website. Once logged in, we can either create a blank template app from scratch or choose from the pre-existing templates provided by Databutton.Image by Author | Screen grasp showing on how to start working with a new blank appOnce the blank app is created, we generate our online workspace consisting of several features for building and deploying the app. We can immediately begin writing our code within the online editor. The only requirement at this stage is to include the necessary packages or dependencies that our app requires.Image by Author | Screen grasp showing the different components available within the Databutton App's online workspace. Databutton's workspace initialization includes some essential packages by default. However, for our specific app, we need to add two additional packages - openai and langchain. This can be easily accomplished within the "configuration" workspace of Databutton.Image by Author | Screen grasp of the configuration options within Databutton's online workspace. Here we can add the additional packages which we need for working with our app. The workspace is generated with few pre-installed dependencies.Writing the codeNow that we have a basic understanding of Agents and their abstraction methods, let's put them to use, alongside incorporating some basic Streamlit syntax for the front end.Importing the required modules: For building the web app, we will require the Streamlit library and several LangChain modules. Additionally, we will utilise a helper function that relies on the sys and io libraries for capturing and displaying function outputs. We will discuss the significance of this helper function towards the end to better understand its purpose.# Modules to Import import streamlit as st import sys import io import re from typing import Callable, Any from langchain.agents.tools import Tool from langchain.agents import initialize_agent from langchain.llms import OpenAI from langchain.chains import LLMChain from langchain import LLMMathChain from langchain import PromptTemplateUsing the LangChain modules and building the main user interface: We set the title of the app using st.title() syntax and also enables the user to enter their OpenAI API key using the st.text_input() widget.# Set the title of the app st.title("LangChain `Agent` Module Usage Demo App") # Get the OpenAI API key from the user OPENAI_API_KEY = st.text_input( "Enter your OpenAI API Key to get started", type="password" )As we discussed in the previous sections, we need to define a template for the prompt that incorporates a placeholder for the user's query.# Define a template for the prompt template = """You are a friendly and polite AI Chat Assistant. You must try to provide accurate but concise answers. If you don't know the answer, just say "I don't know." Question: {query} Answer: """ # Create a prompt template object with the template prompt = PromptTemplate(template=template, input_variables=["query"])Next, we implement a conditional loop. If the user has provided an OpenAI API key, we proceed with the flow of the app. The user is asked to enter their query using the st.text_input() widget.# Check if the user has entered an OpenAI API key if OPENAI_API_KEY: # Get the user's query query = st.text_input("Ask me anything")Once the user has the correct API keys inserted, from this point onward, we will proceed with the implementation of LangChain modules. Some of these modules may be new to us, while others may have already been covered in our previous sections.Next, we create instances of the OpenAI language model, OpenAI, the LLMMathChain for maths-related queries, and the LLMChain for general-purpose queries.# Check if the user has entered a query if query: # Create an instance of the OpenAI language model llm = OpenAI(temperature=0, openai_api_key=OPENAI_API_KEY) # Create an instance of the LLMMathChain for math-related queries llm_math_chain = LLMMathChain.from_llm(llm=llm, verbose=True) # Create an instance of the LLMChain for general-purpose queries llm_chain = LLMChain(llm=llm, prompt=prompt)Following that, we create a list of tools that the agent will utilize. Each tool comprises a name, a corresponding function to handle the query, and a brief description.# Create a list of tools for the agent tools = [ Tool( name="Search", func=llm_chain.run, description="Useful for when you need to answer general purpose questions", ), Tool( name="Calculator", func=llm_math_chain.run, description="Useful for when you need to answer questions about math", ), ]Further, we need to initialize a zero-shot agent with the tools and other parameters. This agent employs the ReAct framework to determine which tool to utilize based solely on the description associated with each tool. It is essential to provide a description of each tool.# Initialize the zero-shot agent with the tools and parameters zero_shot_agent = initialize_agent( agent="zero-shot-react-description", tools=tools, llm=llm, verbose=True, max_iterations=3, ) And now finally, we can easily call the zero-shot agent with the user's query using the run(query) method.# st.write(zero_shot_agent.run(query))However, this would only yield the final outcome of the result within our Streamlit UI, without providing access to the underlying LangChain thought process (i.e. the verbose ) that we typically observe in a Notebook environment. This information is crucial to understand which tools our agent is opting for based on the user query. To address this, a helper function called capture_and_display_output was created.# Helper function to dump LangChain Verbose / Though Process # Function to capture and display the output of a function def capture_and_display_output(func: Callable[..., Any], args, **kwargs) -> Any: # Redirect stdout to a string buffer original_stdout = sys.stdout sys.stdout = output_catcher = io.StringIO() # Call the function and capture the response response = func(args, *kwargs) # Restore the original stdout and get the captured output sys.stdout = original_stdout output_text = output_catcher.getvalue() # Clean the output text by removing escape sequences cleaned_text = re.sub(r"\x1b\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]", "", output_text) # Split the cleaned text into lines and concatenate them with line breaks lines = cleaned_text.split("\n") concatenated_string = "\n".join([s if s else "\n" for s in lines]) # Display the captured output in an expander with st.expander("Thoughts", expanded=True): st.write(concatenated_string)This function allows users to monitor the actions undertaken by the agent. Consequently, the response from the agent is displayed within the UI.# Call the zero-shot agent with the user's query and capture the output response = capture_and_display_output(zero_shot_agent.run, query) Image by Author | Screen grasp of the app in local deployment displays the entire verbose or rather the thought process  Deploy and Testing of the AppThe app can now be easily deployed by clicking the "Deploy" button on the top left-hand side. The deployed app will provide us with a unique URL that can be shared with everyone!Image by Author | Screen grasp of the Databutton online workspace showing the Deploy options. Yay! We have successfully built and deployed a LangChain-based web app from scratch. Here's the link to the app ! The app also consists of a view code page , which can be accessed via this link.To test the web app, we will employ two different types of prompts. One will be a general question that can be answered by any LLMs, while the other will be a maths-related question. Our hypothesis is that the LangChain agents will intelligently determine which agents to execute and provide the most appropriate response. Let's proceed with the testing to validate our assumption.Image by Author | Screen grasped from the deployed web app.Two different prompts were used to validate our assumptions. Based on the thought process ( displayed in the UI under the thoughts expander ), we can easily interpret which Tool has been chosen by the Agent. (Left) Usage of LLMMath chain incorporating Tool (Right) Usage of a simple LLM Chain incorporating Tool.ConclusionTo summarise, we have not only explored various aspects of working with LangChain and LLMs but have also successfully built and deployed a web app powered by LangChain. This demonstrates the versatility and capabilities of LangChain in enabling the development of powerful applications.ReferencesLangChain Agents official documentation : https://python.langchain.com/en/latest/modules/agents.htmlDatabutton : https://www.databutton.io/Streamlit :  https://streamlit.io/ Build a Personal Search Engine Web App using Open AI Text Embeddings : https://medium.com/@avra42/build-a-personal-search-engine-web-app-using-open-ai-text-embeddings-d6541f32892dPart 1: Using LangChain for Large Language Model — powered Applications: https://www.packtpub.com/article-hub/using-langchain-for-large-language-model-powered-applicationsDeployed Web app - https://databutton.com/v/23ks6sem Source code for the app - https://databutton.com/v/23ks6sem/View_CodeAuthor BioAvratanu Biswas, Ph.D. Student ( Biophysics ), Educator, and Content Creator, (Data Science, ML & AI ).Twitter    YouTube    Medium     GitHub
Read more
  • 0
  • 0
  • 18743

article-image-emotionally-intelligent-ai-transforming-healthcare-with-wysa
Julian Melanson
22 Jun 2023
6 min read
Save for later

Emotionally Intelligent AI: Transforming Healthcare with Wysa

Julian Melanson
22 Jun 2023
6 min read
Artificial Intelligence is reshaping the boundaries of industries worldwide, and healthcare is no exception. An exciting facet of this technological revolution is the emergence of empathetic AI, sophisticated algorithms designed to understand and respond to human emotions.The advent of AI in healthcare has promised efficiency, accuracy, and predictability. However, a crucial element remained largely unexplored: the human component of empathetic understanding. Empathy, defined as the capacity to understand and share the feelings of others, is fundamental to human interactions. Especially in healthcare, a practitioner's empathy can bolster patients' immune responses and overall well-being. Unfortunately, complex emotions associated with medical errors—such as hurt, frustration, and depression—often go unaddressed. Furthermore, emotional support is strongly correlated with the prognosis of chronic diseases such as cardiovascular disorders, cancer, and diabetes, underscoring the need for empathetic care. So how can we integrate empathy into AI? To find the answer, let's examine Wysa, an AI-backed mental health service platform.Wysa, leveraging AI's power, simulates a conversation with a chatbot to provide emotional support to users. It offers an interactive platform for people experiencing mood swings, stress, and anxiety, delivering personalized suggestions and tools to manage their mental health. This AI application extends beyond mere data processing and ventures into the realm of human psychology, demonstrating a unique fusion of technology and empathy.In 2022, the U.S. Food and Drug Administration (FDA) awarded Wysa the Breakthrough Device Designation. This designation followed an independent, peer-reviewed clinical trial published in the Journal of Medical Internet Research (JMIR). The study demonstrated Wysa's efficacy in managing chronic musculoskeletal pain and associated depression and anxiety, positioning it as a potential game-changer in mental health care.Wysa's toolset is primarily based on cognitive behavioral therapy (CBT), a type of psychotherapy that helps individuals change unhelpful thought patterns. It deploys a smartphone-based conversational agent to deliver CBT, effectively reducing symptoms of depression and anxiety, improving physical function, and minimizing pain interference.The FDA Breakthrough Device program is designed to expedite the development and approval of innovative medical devices and products. By granting this designation, the FDA acknowledged Wysa's potential to transform the treatment landscape for life-threatening or irreversibly debilitating diseases. This prestigious endorsement facilitates efficient communication between Wysa and the FDA's experts, accelerating the product's development during the premarket review phase.Wysa's success encapsulates the potential of empathetic AI to revolutionize healthcare. However, to fully capitalize on this opportunity, healthcare organizations need to revise and refine their strategies. An effective emotional support mechanism, powered by empathetic AI, can significantly enhance patient safety, satisfaction scores, and ultimately, the quality of life. For this to happen, continued development of technologies that cater to patients' emotional needs is paramount.While AI's emergence in healthcare has often been viewed through the lens of improved efficiency and decision-making, the human touch should not be underestimated. As Wysa demonstrates, AI has the potential to extend beyond its traditional boundaries and bring a much-needed sense of empathy into the equation. An emotionally intelligent AI could be instrumental in providing round-the-clock emotional support, thereby revolutionizing mental health care.As we advance further into the AI era, the integration of empathy into AI systems signifies an exciting development. AI platforms like Wysa, which blends technological prowess with human-like understanding, could be a pivotal force in transforming the healthcare landscape. As empathetic AI continues to evolve, it holds the promise of bridging the gap between artificial and human intelligence, ultimately enhancing patient care in the healthcare sector.A Step-By-Step Guide To Using WysaDownload the App: Android users can download Wysa from the Google Play Store. If you're an Apple user, you can find Wysa in the Apple App Store.Explore the App: Once installed, you can explore Wysa’s in-app activities which feature various educational modules, or “Packs”. These packs cover a range of topics, from stress management and managing anger, to coping with school stress and improving sleep.Engage with Wysa Bot: Each module features different “exercises” guided by the Wysa AI bot, a friendly penguin character. These exercises may involve question-answers, mindfulness activities, or short exercise videos. While all the modules can be viewed in the free app, only one exercise per module is accessible. To unlock the entire library, you’ll need to upgrade to the premium app.Consider Therapy Option: Wysa also offers a “therapy” option, which gives you access to a mental health coach and all the content in the premium version. Do note that this service is not formal therapy as provided by licensed therapists. The coaches are based in the US or India, and while they can offer support and encouragement, they are not able to provide diagnoses or treatment.Attend Live Sessions: Live sessions are carried out through instant messaging in the app, lasting for 30 minutes each week. In between these live sessions, you can message your coach at any time and usually expect at least a daily response.Complete Assigned Tasks: After each live session, your coach will assign you specific tasks to complete before your next session. You will complete these tasks guided by the Wysa AI bot.Maintain Anonymity: An important feature of Wysa is its respect for user privacy. The app doesn't require you to create an account, enter your real name, or provide an email address. To get started, all you need is a nickname.*Remember, Wysa is a tool designed to help manage stress and anxiety, improve sleep, and promote overall mental wellbeing. However, it does not replace professional psychological or medical advice. Always consult with a healthcare professional if you are in need of immediate assistance or dealing with severe mental health issues.SummaryArtificial intelligence (AI) is transforming healthcare in many ways, including by providing new tools for mental health management. One example of an AI-powered mental health app is Wysa, which uses conversational AI to help users cope with stress, anxiety, and depression. Wysa has been clinically proven to be effective in reducing symptoms of mental illness, and it can be used as a supplement to traditional therapy or as a standalone intervention.As AI continues to develop, it is likely that we will see even more innovative ways to use this technology to improve mental health care. AI-powered apps like Wysa have the potential to make mental health care more accessible and affordable, and they can also help to break down the stigma around mental illnesses.Author BioJulian Melanson is one of the founders of Leap Year Learning. Leap Year Learning is a cutting-edge online school that specializes in teaching creative disciplines and integrating AI tools. We believe that creativity and AI are the keys to a successful future and our courses help equip students with the skills they need to succeed in a continuously evolving world. Our seasoned instructors bring real-world experience to the virtual classroom and our interactive lessons help students reinforce their learning with hands-on activities.No matter your background, from beginners to experts, hobbyists to professionals, Leap Year Learning is here to bring in the future of creativity, productivity, and learning!
Read more
  • 0
  • 0
  • 7295
article-image-making-the-most-of-chatgpt-code-interpreter-plugin
Julian Melanson
22 Jun 2023
5 min read
Save for later

Making the Most of ChatGPT Code Interpreter Plugin

Julian Melanson
22 Jun 2023
5 min read
As we stand on the threshold of a new age in Artificial Intelligence,, OpenAI recently announced the rollout of its ChatGPT Code Interpreter plugin for ChatGPT Plus subscribers, marking a significant evolution in the capabilities of AI. This groundbreaking technology is not merely another link in the AI chain but rather an exemplar of the transformative capabilities AI can bring to the table, particularly in programming and data analysis.The ChatGPT Code Interpreter plugin positions itself as an invaluable tool for developers, promising to significantly augment and streamline their workflows. Among its multiple functionalities, three stand out due to their potential impact on the programming landscape and data analysis, which work in tandem to extract valuable insights.Data VisualizationAt its core, the ChatGPT Code Interpreter excels in the domain of data visualization. In a world increasingly reliant on data, the ability to transform complex datasets into visually comprehensible and comprehensive formats is priceless. The plugin simplifies the arduous task of crunching through complex numbers and data sets, producing insightful visualizations without the need for prompt engineering. This proficiency in creatively rendering data echoes the power of platforms like Wolfram, introducing a new era of ease and efficiency in data comprehension.Here’s an example from Justin Fineberg’s TikTok: Click hereFile ConversionThe ChatGPT Code Interpreter extends its versatility into the realm of file conversion. This feature provides a simple solution to the often cumbersome task of converting files from one format to another. Its impressive functionality ranges from changing audio file formats, like MP3 to WAV, to converting an image into a text file. This capability paves the way for more accessible content transformation, such as easily convert PDF documents into editable text files.Here’s an example from Twitter user Riley Goodside: Click herePython Code ExecutionWhat sets the ChatGPT Code Interpreter plugin apart is its prowess in executing Python code within a sandboxed, firewalled execution environment. This essentially means that all the data visualizations are generated using Python, thereby lending the plugin an additional layer of power and versatility.As the plugin is still in its alpha stage, gaining access currently involves joining a waitlist, and  OpenAI has not publicly stated when a large-scale rollout will take place. However, those eager to explore its features have an alternative route via Discord's GPT Assistant bot, which already incorporates the Code Interpreter plugin to enhance its features and functionalities.This revolutionary plugin is not merely an advanced code interpreter; it's a complete tool that uses Python to generate code from natural language input and run it. The results are then presented within the dialogue box. The chatbot’s functionality extends to solving mathematical problems, data analysis and visualization, and file conversion, with an adeptness in these domains that rivals experienced coders.Beyond its immediate capabilities, the ChatGPT Code Interpreter plugin has broader implications for the programming and data analysis industry. It is reminiscent of Github Copilot X in its design, aimed at making workflows more creative and efficient. For instance, when asked to plot a function, the plugin not only generates the graph but also offers the option to 'show work', revealing the exact code it created and executed to generate the graph.The accessibility and user-friendliness of the plugin are expected to democratize the coding landscape, opening up the world of programming to a wider audience. This feature holds tremendous potential to accelerate collaborations, allowing technical and non-technical team members to work together more effectively on data analysis projects.Practical use cases for the ChatGPT Code Interpreter extend beyond the realm of programming, spanning various industries. Marketing teams, for instance, can leverage their capabilities to analyze customer data, segment audiences, and create targeted campaigns. Finance teams can utilize the plugin for tasks like financial modeling, forecasting, and risk analysis. Similarly, human resource teams can use it to analyze employee data, identify performance trends, and make data-driven hiring decisions. Even the healthcare sector stands to benefit, as the tool can analyze patient data, identify patterns in health outcomes, and thus enhance patient care.Accessing ChatGPT Code InterpreterIf you’re selected from the waitlist, here’s a step-by-step guide on how to install the plugin:Ensure you're a ChatGPT Plus subscriber, paying the $20 monthly fee.Log into ChatGPT on the OpenAI website.Click on 'Settings', then the three-dot menu next to your login name.In the 'Beta features' menu, enable 'Plug-ins'. For web browsing access, enable that too.Close the menu, find the language model selector, and choose 'Plugin Store' from the drop-down.Click 'All plug-ins', find 'Code Interpreter' in the list and install it.Now, you can interact with ChatGPT using the Code Interpreter plug-in.SummaryThe ChatGPT Code Interpreter plugin presents a transformative approach to programming and data analysis, automating code generation, facilitating data exploration, and improving code quality. This plugin empowers users to derive more value from their data, aiding in the formulation of strategic insights. As AI continues to evolve, tools like the ChatGPT Code Interpreter will undoubtedly play an instrumental role in shaping the future of data interaction and understanding, ultimately revolutionizing the landscape of data analysis.Author BioJulian Melanson is one of the founders of Leap Year Learning. Leap Year Learning is a cutting-edge online school that specializes in teaching creative disciplines and integrating AI tools. We believe that creativity and AI are the keys to a successful future and our courses help equip students with the skills they need to succeed in a continuously evolving world. Our seasoned instructors bring real-world experience to the virtual classroom and our interactive lessons help students reinforce their learning with hands-on activities.No matter your background, from beginners to experts, hobbyists to professionals, Leap Year Learning is here to bring in the future of creativity, productivity, and learning!
Read more
  • 0
  • 0
  • 5087

article-image-creating-cicd-pipelines-effortlessly-using-chatgpt
Sagar Lad
22 Jun 2023
5 min read
Save for later

Creating CI/CD Pipelines Effortlessly using ChatGPT

Sagar Lad
22 Jun 2023
5 min read
 In the fast-paced world of software development, continuous integration and continuous delivery (CI/CD) pipelines have become crucial for efficient and reliable software deployment. However, building and maintaining these pipelines can be a daunting task, requiring extensive knowledge and expertise. But what if there was a way to simplify this process and make it more accessible to developers of all skill levels? Enter ChatGPT, the groundbreaking language model developed by OpenAI. In this article, we explore how ChatGPT can effortlessly guide developers in building robust CI/CD pipelines, revolutionizing the way software is delivered.What is DevOps?DevOps team is a combination of the Development team and Operations team working together in order to accelerate the time to market and quality of the software development. DevOps way of working is more a shift in the mindset which has a major effect on the team and organization’s way of working. With the DevOps mindset, there are no silos between the development and operations teams. DevOps team mainly focuses on the automation to increase the reliability by enabling continuous integration, and continuous deployment pipelines.Image 1 : DevOps Lifecycle DevOps Lifecycle mainly consists of setting up an automated and collaborative environment to discover, plan, build, and test the artefacts. Once the artefacts are downloaded, they can be deployed to their respective environments. Throughout the DevOps lifecycle, the complete team has to work closely to maintain the alignment, velocity, and quality of the deliverables.DevOps implementation mainly involves below activities :Discover productAn iterative approach for agile planningBuild pipelines for branching, merging, and workflows for the development processAutomated Testing using CI pipelines Deployment using release pipelinesOperationalize and manage end-to-end IT deliveryContinuous monitoring of the deployed softwareContinuous feedback and improvements for future releaseChatGPT for DevOpsAutomation: DevOps Tools like Jenkins, Ansible, Terraform, etc provide workflow automation. On the other hand, we can use chatGPT to automate the below DevOps activities that require manual intervention.Automation Testing: Testing scenarios and automated testing can be enabled using the chatGPT as a part of the continuous build pipeline.Release documentation: Maintaining documentation for each feature is a manual and tedious task. With the help of chatGPT, we can write code in any language to create an automated documentation for each release. With ChatGPT, we can generate code for bicep templates and YAML for Azure DevOps, Terraform , Jenkins, and Lambda code for the DevOps activities.  DevSecOps Implementation: Security is a critical factor in order to develop any software. ChatGPT can be used to monitor cloud resources, manage and detect security vulnerabilities , and scan for networking issues, open ports, database, and storage configurations as per the industry standards and requirements.Continuous Monitoring: Customised dashboard for monitoring is a key metric for proactive monitoring and taking data-driven decisions. We can create a dashboard using the chatGPT to generate code including a variety of components such as charts, graphs, and tables.Let’s now ask chatGPT for each of these steps to create a DevOps process flow for a software project. The first step is to set up the Azure DevOps repository structure including the branching policies, and pre, and post-deployment approval:Image 2: Azure Devop Repo structure & branching policiesAs you can see, a recommendation from ChatGPT is to create a new Azure DevOps repository with proper naming conventions. In order to set up the branching policies, we need to configure the build validations, set up the reviewers, status check, and work item linking in the Azure Boards.Image 3: Azure DevOps Continuous Integration PipelineHere, we have requested chatGPT to create a YAML continuous integration build pipeline in Azure DevOps including the code quality checks and testing. ChatGPT provides us with a YAML pipeline that has multiple stages - one for sonarqube, one for fortify code quality checks, one for automation testing, and one to download the artefacts. Once the CI pipeline is ready, let’s ask ChatGPT to build IaC(Infrastructure as a Code Pipeline) to deploy Azure services like Azure Data Factory and Azure Databricks.Image 4 : Azure DevOps Continuous Deployment PipelinesHere, we can see the step-by-step process to build the continuous deployment pipelines which are using shell script to deploy the Azure Data Factory and Azure CLI to deploy the Azure Databricks. This pipeline also has an integration with the branches to include and it is using variable groups to create a generic pipeline. Let’s see how we can build monitoring dashboards using chatGPT:ConclusionSo chatGPT is not a threat to the DevOps engineers but it will boost up productivity by embracing the technology to set up and implement the DevOps way of working.  In order to get the desired results, detailed prompt input should be provided to generate content from chatGPT to meet the expectations.Author BioSagar Lad is a Cloud Data Solution Architect with a leading organization and has deep expertise in designing and building Enterprise-grade Intelligent Azure Data and Analytics Solutions. He is a published author, content writer, Microsoft Certified Trainer, and C# Corner MVP.Link - Medium , Amazon , LinkedIn
Read more
  • 0
  • 0
  • 12518

article-image-creating-essay-generation-methods-with-chatgpt-api
Martin Yanev
22 Jun 2023
11 min read
Save for later

Creating Essay Generation Methods with ChatGPT API

Martin Yanev
22 Jun 2023
11 min read
This article is an excerpt from the book, Building AI Applications with ChatGPT API, by Martin Yanev. This book will help you master ChatGPT, Whisper, and DALL-E APIs by building nine innovative AI projectsIn this section, we will dive into the implementation of the key functions within the essay generator application. These functions are responsible for generating the essay based on user input and saving the generated essay to a file. By understanding the code, you will be able to grasp the inner workings of the application and gain insight into how the essay generation and saving processes are accomplished.We will begin by exploring the generate_essay() function. This function will retrieve the topic entered by the user from the input field. It will then set the engine type for the OpenAI API, create a prompt using the topic, and make a request to the OpenAI API for essay generation. The response received from the API will contain the generated essay, which will be extracted and displayed in the essay output area of the application. To add that functionality, simply remove the pass placeholder and follow the code below.def generate_essay(self): topic = self.topic_input.text()    length = 500    engine = "text-davinci-003"    prompt = f"Write an {length/1.5} words essay on the following topic: {topic} \n\n"    response = openai.Completion.create(engine=engine, prompt=prompt, max_tokens=length)    essay = response.choices[0].text    self.essay_output.setText(essay)Here, we retrieve the topic entered by the user from the topic_input QLineEdit widget and assign it to the topic variable using the text() method. This captures the user's chosen topic for the essay. For now, we can define the length variable and set it to 500. This indicates the desired length of the generated essay. We will modify this value later by adding a dropdown menu with different token sizes to generate essays of different lengths.We can also specify the engine used for the OpenAI API to be text-davinci-003, which will generate the essay. You can adjust this value to utilize different language models or versions based on your requirements. We can also create the prompt variable, which is a string containing the prompt for the essay generation.It is constructed by concatenating the text Write a {length/1.5} essay on the following topic: where the length/1.5 variable specifies how many words our essay should be. We need to divide the tokens number by 1.5, as 1 word in English represents about 1.5 tokes. After specifying the instructions, we can pass the topic variable to the prompt. This prompt serves as the initial input for the essay generation process and provides context for the generated essay.Once all variables are defined, we make a request to the ChatGPT API with the specified engine, prompt, and the maximum number of tokens (in this case, 500). The API processes the prompt and generates a response, which is stored in the response variable. From the response, we extract the generated essay by accessing the text attribute of the first choice. This represents the generated text of the essay. Finally, we can pass the AI response to the essay_output, displaying it in the user interface for the user to read and interact with.Moving on, we will examine the save_essay() function. This function will retrieve the topic and the generated essay. It will utilize the docx library to create a new Word document and add the final essay to the document. The document will then be saved with the filename based on the provided topic, resulting in a Word document that contains the generated essay. After removing the pass keyword, you can implement the described functionality using the code snippet below.def save_essay(self):    topic = self.topic_input.text()    final_text = self.essay_output.toPlainText()    document = docx.Document()    document.add_paragraph(final_text)    document.save(topic + ".docx")Here we retrieve the text entered in the topic_input widget and assign it to the topic variable using the text() method. This captures the topic entered by the user, which will be used as the filename for the saved essay. Next, we use the toPlainText() method on the essay_output widget to retrieve the generated essay text and assign it to the final_text variable. This ensures that the user can edit the ChatGPT-generated essay before saving it. By capturing the topic and the final text, we are now equipped to proceed with the necessary steps to save the essay to a file.We can now use the docx library to create a new Word document by calling docx.Document(), which initializes an empty document. We then add a paragraph to the document by using the add_paragraph() method and passing in the final_text variable, which contains the generated essay text. This adds the generated essay as a paragraph to the document. We can now save the document by calling document.save() and providing a filename constructed by concatenating the topic variable, which represents the topic entered by the user. This saves the document as a Word file with the specified filename.You can now test your Essay Generator by running the code in PyCharm and generating an essay following the steps below (see Figure 8.3):Enter a topic: Write an essay topic of your choice in the Topic Input field. For this example, I have chosen the topic “Ancient Egypt”.Generate Essay: Perform a single click on the Generate Essay button. The app will reach ChatGPT API and within a few seconds, you will have your essay displayed inside the Essay Output field.Edit the Essay: You can edit the essay generated by the Artificial Intelligence before saving it.Save: Perform a single click on the Save button. This action will save the edited essay to a Word document utilizing the save_essay() method. The Word document will be saved in the root directory of your project.Figure 8.3: Essay Generator creating an “Ancient Egypt” essayOnce the essay has been saved to a Word document, you can reshare it with your peers, submit it as a school assignment or use any Word styling options on it.This section discussed the implementation of key functions in our essay generator application using the ChatGPT API. We built the generate_essay() method that retrieved the user’s topic input and sent a request to the ChatGPT API for generating an AI essay. We also developed the save_essay() method that saved the generated essay in a Word document.In the next section, we will introduce additional functionality to the essay generator application. Specifically, we will allow the user to change the number of AI tokens used for generating the essay.Controlling the ChatGPT API TokensIn this section, we will explore how to enhance the functionality of the essay generator application by allowing users to have control over the number of tokens used when communicating with ChatGPT. By enabling this feature, users will be able to generate essays of different lengths, tailored to their specific needs or preferences. Currently, our application has a fixed value of 500 tokens, but we will modify it to include a dropdown menu that provides different options for token sizes.To implement this functionality, we will make use of a dropdown menu that presents users with a selection of token length options. By selecting a specific value from the dropdown, users can indicate their desired length for the generated essay. We will integrate this feature seamlessly into the existing application, empowering users to customize their essay-generation experience.Let's delve into the code snippet that will enable users to control the token length. You can add that code inside the initUI() methods, just under the essay_output resizing:self.essay_output.resize(1100, 500) length_label = QLabel('Select Essay Length:', self) length_label.move(327, 40) self.length_dropdown = QComboBox(self) self.length_dropdown.move(320, 60) self.length_dropdown.addItems(["500", "1000", "2000", "3000", "4000"])The code above introduces a QLabel, length_label, which serves as a visual indication for the purpose of the dropdown menu. It displays the text Select Essay Length to inform users about the functionality.Next, we create a QcomboBox length_dropdown which provides users with a dropdown menu to choose the desired token length. It is positioned below the length_label using the move() method. The addItems() function is then used to populate the dropdown menu with a list of token length options, ranging from 500 to 4000 tokens. Users can select their preferred length from this list.The final step is to implement the functionality that allows users to control the number of tokens used when generating the essay, we need to modify the generate_essay() function. The modified code should be the following:def generate_essay(self):    topic = self.topic_input.text()    length = int(self.length_dropdown.currentText())    engine = "text-davinci-003"    prompt = f"Write an {length/1.5} words essay on the following topic: {topic} \n\n"    response = openai.Completion.create(engine=engine, prompt=prompt, max_tokens=length)    essay = response.choices[0].text   self.essay_output.setText(essay)In the modified code, the length variable is updated to retrieve the selected token length from the length_dropdown dropdown menu. The currentText() method is used to obtain the currently selected option as a string, which is then converted to an integer using the int() function. This allows the chosen token length to be assigned to the length variable dynamically.By making this modification, the generate_essay() the function will utilize the user-selected token length when making the request to the ChatGPT API for essay generation. This ensures that the generated essay will have the desired length specified by the user through the dropdown menu.We can now click on the Run button in PyCharm and verify that the Dropdown menu works properly. As shown in Figure 8.4, a click on the Dropdown menu will show users all options specified by the addItems() function.Figure 8.4: Controlling essay length.The user will be able to choose a token amount between 500 and 4000. Now you can select the 4000 tokens option, resulting in a longer length of the generated essay. We can follow the steps from our previous example and verify that the ChatGPT API generates a longer essay for “Ancient Egypt” when the number of tokens is increased from 500 to 4000.This is how you can enhance the functionality of an essay generator application by allowing users to control the number of tokens used when communicating with ChatGPT. By selecting a specific value from the dropdown menu, users can now indicate their desired length for the generated essay. We achieved that by using the QComboBox to create the dropdown menu itself. The modified generate_essay() method retrieved the selected token length from the dropdown menu and dynamically assigned it to the length variable.SummaryIn conclusion, leveraging the capabilities of ChatGPT API to enhance essay generation opens up a world of interactive creativity. By incorporating practical examples and step-by-step instructions, we have explored how to generate essay-generating elements and make them interact seamlessly with ChatGPT. This powerful combination allows for the production of compelling, coherent, and engaging essays effortlessly. With the ever-evolving potential of AI, the future of essay generation holds immense possibilities. By embracing these techniques, writers and researchers can unlock their full creative potential and revolutionize the way we generate written content.Author BioMartin 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.LinkedInUdemy
Read more
  • 0
  • 0
  • 5548
article-image-how-to-work-with-langchain-python-modules
Avratanu Biswas
22 Jun 2023
13 min read
Save for later

How to work with LangChain Python modules

Avratanu Biswas
22 Jun 2023
13 min read
This article is the second part of a series of articles, please refer to Part 1 for learning how to Get to grips with LangChain framework and how to utilize it for building LLM-powered AppsIntroductionIn this section, we dive into the practical usage of LangChain modules. Building upon the previous overview of LangChain components, we will work within a Python environment to gain hands-on coding experience. However, it is important to note that this overview is not a substitute for the official documentation, and it is recommended to refer to the documentation for a more comprehensive understanding.Choosing the Right Python EnvironmentWhen working with Python, Jupyter Notebook and Google Colab are popular choices for quickly getting started in the Python environment. Additionally, Visual Studio Code (VSCode) Atom, PyCharm, or Sublime Text integrated with a conda environment are also excellent options. While many of these can be used, Google Colab is used here for its convenience in quick testing and code sharing. Find the code link here.PrerequisitesBefore we begin, make sure to install the necessary Python libraries. Use the pip command within a notebook cell to install them.Installing LangChain: In order to install the "LangChain" library, which is essential for this section, you can conveniently use the following command:!pip install langchainRegular Updates: Personally, I would recommend taking advantage of LangChain’s frequent releases by frequently upgrading the packages. Use the following command for this purpose:!pip install langchain  - -  upgradeIntegrating LangChain with LLMs: Previously, we discussed how the LangChain library facilitates interaction with Large Language Models (LLMs) provided by platforms such as OpenAI, Cohere, or HuggingFace. To integrate LangChain with these models, we need to follow these steps:Obtain API Keys: In this tutorial, we will use OpenAI. We need to sign up; to easily access the API keys for the various endpoints which Open AI provides. The key must be confidential. You can obtain the API via this link.Install Python Package: Install the required Python package associated with your chosen LLM provider. For OpenAI language models, execute the command:!pip install openaiConfiguring the API Key for OpenAI: To initialize the API key for the OpenAI library, we will use the getpass Python Library. Alternatively, you can set the API key as an environment variable.# Importing the library OPENAI_API_KEY = getpass.getpass() import getpass # In order to double check # print(OPENAI_API_KEY) # not recommendedRunning the above lines of code will create a secure text input widget where we can enter the API key, obtained for accessing OpenAI LLMs endpoints. After hitting enter, the inputted value will be stored as the assigned variable OPENAI_API_KEY, allowing it to be used for subsequent operations throughout our notebook.We will explore different LangChain modules in the section below:Prompt TemplateWe need to import the necessary module, PromptTemplate, from the langchain library. A multi-line string variable named template is created - representing the structure of the prompt and containing placeholders for the context, question, and answer which are the crucial aspects of any prompt template.Image by Author | Key components of a prompt template is shown in the figure. A PromptTemplate the object is instantiated using the template variable. The input_variables parameter is provided with a list containing the variable names used in the template, in this case, only the query.:from langchain import PromptTemplate template = """ You are a Scientific Chat Assistant. Your job is to answer scientific facts and evidence, in a bullet point wise. Context: Scientific evidence is necessary to validate claims, establish credibility, and make informed decisions based on objective and rigorous investigation. Question: {query} Answer: """ prompt = PromptTemplate(template=template, input_variables=["query"])The generated prompt structure can be further utilized to dynamically fill in the question placeholder and obtain responses within the specified template format. Let's print our entire prompt! print(prompt) lc_kwargs={'template': ' You are an Scientific Chat Assistant.\nYour job is to reply scientific facts and evidence in a bullet point wise.\n\nContext: Scientific evidence is necessary to validate claims, establish credibility, \nand make informed decisions based on objective and rigorous investigation.\n\nQuestion: {query}\n\nAnswer: \n', 'input_variables': ['query']} input_variables=['query'] output_parser=None partial_variables={} template=' You are an Scientific Chat Assistant.\nYour job is to reply scientific facts and evidence in a bullet point wise.\n\nContext: Scientific evidence is necessary to validate claims, establish credibility, \nand make informed decisions based on objective and rigorous investigation.\n\nQuestion: {query}\n\nAnswer: \n' template_format='f-string' validate_template=TrueChainsThe LangChain documentation covers various types of LLM chains, which can be effectively categorized into two main groups: Generic chains and Utility chains.Image 2: ChainsChains can be broadly classified into Generic Chains and Utility Chains. (a) Generic chains are designed to provide general-purpose language capabilities, such as generating text, answering questions, and engaging in natural language conversations by leveraging LLMs. On the other contrary, (b) Utility Chains: are specialized to perform specific tasks or provide targeted functionalities. These chains are fine-tuned and optimized for specific use cases. Note, although Index-related chains can be classified into a sub-group, here we keep such chains under the banner of utility chains. They are often considered to be very useful while working with Vector databases.Since this is the very first time we are running the LLM chain, we will walk through the code in detail.We need to import the OpenAI LLM module from langchain.llms and the LLMChain module from langchain Python package.Then, an instance of the OpenAI LLM is created, using the arguments such as temperature (affects the randomness of the generated responses), openai_api_key (the API key for OpenAI which we just assigned before), model (the specific OpenAI language model to be used - other models are available here), and streaming. Note the verbose argument is pretty useful to understand the abstraction that LangChain provides under the hood, while executing our query.Next, an instance of LLMChain is created, providing the prompt (the previously defined prompt template) and the LLM (the OpenAI LLM instance).The query or question is defined as the variable query.Finally, the llm_chain.run(query) line executes the LLMChain with the specified query, generating the response based on the defined prompt and the OpenAI LLM:# Importing the OpenAI LLM module from langchain.llms import OpenAI # Importing the LLMChain module from langchain import LLMChain # Creating an instance of the OpenAI LLM llm = OpenAI(temperature=0.9, openai_api_key=OPENAI_API_KEY, model="text-davinci-003", streaming=True) # Creating an instance of the LLMChain with the provided prompt and OpenAI LLM llm_chain = LLMChain(prompt=prompt,llm=llm, verbose=True) # Defining the query or question to be asked query = "What is photosynthesis?" # Running the LLMChain with the specified query print(llm_chain.run(query)) Let's have a look at the response that is generated after running the chain with and without verbose,a) with verbose = True;Prompt after formatting:You are an Scientific Chat Assistant. Your job is to reply scientific facts and evidence in a bullet point wise.Context: Scientific evidence is necessary to validate claims, establish credibility, and make informed decisions based on objective and rigorous investigation. Question: What is photosynthesis?Answer:> Finished chain.• Photosynthesis is the process used by plants, algae and certain bacteria to convert light energy from the sun into chemical energy in the form of sugars.• Photosynthesis occurs in two stages: the light reactions and the Calvin cycle. • During the light reactions, light energy is converted into ATP and NADPH molecules.• During the Calvin cycle, ATP and NADPH molecules are used to convert carbon dioxide into sugar molecules.  b ) with verbose = False;• Photosynthesis is a process used by plants and other organisms to convert light energy, normally from the sun, into chemical energy which can later be released to fuel the organisms' activities.• During photosynthesis, light energy is converted into chemical energy and stored in sugars.• Photosynthesis occurs in two stages: light reactions and the Calvin cycle. The light reactions trap light energy and convert it into chemical energy in the form of the energy-storage molecule ATP. The Calvin cycle uses ATP and other molecules to create glucose.Seems like our general-purpose LLMChain has done a pretty decent job and given a reasonable output by leveraging the LLM.Now let's move onto the utility chain and understand it, using a simple code snippet:from langchain import OpenAI from langchain import LLMMathChain llm = OpenAI(temperature=0.9,openai_api_key= OPENAI_API_KEY) # Using the LLMMath Chain / LLM defined in Prompt Template section llm_math = LLMMathChain.from_llm(llm = llm, verbose = True) question = "What is 4 times 5" llm_math.run(question) # You know what the response would be 🎈Here the utility chain serves a specific function, i.e. to solve a fundamental maths question using the LLMMathChain. It's crucial to look at the prompt used under the hood for such chains. However , in addition, a few more notable utility chains are there as well,BashChain: A utility chain designed to execute Bash commands and scripts.SQLDatabaseChain: This utility chain enables interaction with SQL databasesSummarizationChain: The SummarizationChain is designed specifically for text summarization tasks.Such utility chains, along with other available chains in the LangChain framework, provide specialized functionalities and ready-to-use tools that can be utilized to expedite and enhance various aspects of the language processing pipeline.MemoryUntil now, we have seen, each incoming query or input to the LLMs or to its subsequent chain is treated as an independent interaction, meaning it is "stateless" (in simpler terms, information IN, information OUT). This can be considered as one of the major drawbacks, as it hinders the ability to provide a seamless and natural conversational experience for users who are seeking reasonable responses further on. To overcome this limitation and enable better context retention, LangChain offers a broad spectrum of memory components that are extremely helpful.Image by Author | The various types of Memory modules that LangChain provides.By utilizing the memory components supported, it becomes possible to remember the context of the conversation, making it more coherent and intuitive. These memory components allow for the storage and retrieval of information, enabling the LLMs to have a sense of continuity. This means they can refer back to previous relevant contexts, which greatly enhances the conversational experience for users. A typical example of such memory-based interaction is the very popular chatbot - ChatGPT, which remembers the context of our conversations.Let's have a look at how we can leverage such a possibility using LangChain:from langchain.llms import OpenAI from langchain.chains import ConversationChain from langchain.memory import ConversationBufferMemory llm = OpenAI(temperature=0, openai_api_key= OPENAI_API_KEY) conversation = ConversationChain( llm=llm, verbose=True, memory = ConversationBufferMemory() ) In the above code, we have initialized an instance of the ConversationChain class, configuring it with the OpenAI language model, enabling verbose mode for detailed output, and utilizing a ConversationBufferMemory for memory management during conversations. Now, let's begin our conversation,conversation.predict(input="Hi there!I'm Avra") Prompt after formatting:The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.Current conversation:Human: Hi there! I'm AvraAI:> Finished chain.' Hi, Avra! It's nice to meet you. My name is AI. What can I do for you today?Let's add a few more contexts to the chain, so that later we can test the context memory of the chain.conversation.predict(input="I'm interested in soccer and building AI web apps.")Prompt after formatting:The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know.Current conversation:Human: Hi there!I'm AvraAI:  Hi Avra! It's nice to meet you. My name is AI. What can I do for you today?Human: I'm interested in soccer and building AI web apps.AI:> Finished chain.' That's great! Soccer is a great sport and AI web apps are a great way to explore the possibilities of artificial intelligence. Do you have any specific questions about either of those topics?Now, we make a query, which requires the chain to trace back to its memory storage and provide a reasonable response based on it.conversation.predict(input="Who am I and what's my interest ?")Prompt after formatting:The following is a friendly conversation between a human and an AI. The AI is talkative and provides lots of specific details from its context. If the AI does not know the answer to a question, it truthfully says it does not know. Current conversation:Human: Hi there!I'm AvraAI:  Hi Avra! It's nice to meet you. My name is AI. What can I do for you today?Human: I'm interested in soccer and building AI web apps.AI:  That's great! Soccer is a great sport and AI web apps are a great way to explore the possibilities of artificial intelligence. Do you have any specific questions about either of those topics?Human: Who am I and what's my interest ?AI:> Finished chain.' That's a difficult question to answer. I don't have enough information to answer that question. However, based on what you've told me, it seems like you are Avra and your interests are soccer and building AI web apps.The above response highlights the significance of the ConversationBufferMemory chain in retaining the context of the conversation. It would be worthwhile to try out the above example without a buffer memory to get a clear perspective of the importance of the memory module. Additionally, LangChain provides several memory modules that can enhance our understanding of memory management in different ways, to handle conversational contexts.Moving forward, we will delve into the next section, where we will focus on the final two components called the “Indexes” and the "Agent." During this section, we will not only gain a hands-on understanding of its usage but also build and deploy a web app using an online workspace called Databutton.ReferencesLangChain Official Docs - https://python.langchain.com/en/latest/index.htmlCode available for this section here (Google Collab) - https://colab.research.google.com/drive/1_SpAvehzfbYYdDRnhU6v9-KHwIHMC1yj?usp=sharingPart 1: Using LangChain for Large Language Model — powered Applications : https://www.packtpub.com/article-hub/using-langchain-for-large-language-model-powered-applicationsPart 3 : Building and deploying Web App using LangChain <Insert Link>How to build a Chatbot with ChatGPT API and a Conversational Memory in Python: https://medium.com/@avra42/how-to-build-a-chatbot-with-chatgpt-api-and-a-conversational-memory-in-python-8d856cda4542Databutton - https://www.databutton.io/Author BioAvratanu Biswas, Ph.D. Student ( Biophysics ), Educator, and Content Creator, ( Data Science, ML & AI ).Twitter    YouTube    Medium     GitHub
Read more
  • 0
  • 0
  • 26077

article-image-exploring-openai-chatgpt-as-a-researcher-a-writer-and-a-software-user
Urszula Witherell
22 Jun 2023
6 min read
Save for later

Exploring OpenAI ChatGPT as a Researcher, a Writer and a Software User

Urszula Witherell
22 Jun 2023
6 min read
Artificial Intelligence is now a hot topic. The concept is not that new. In translations from one language to another, it was used since the 1960s to prepare rough drafts with the idea that the text will be refined by human editors. We interviewed Urszula Witherell, the author of the book Adobe Acrobat Ninja for her perspectives on using AI, specifically freely available ChatGPT: as a Reader, a Writer, and a Software User. What is your experience using ChatGPT as a Reader/Researcher?I am a curious person, and my mind constantly questions where and why. I love exploring new ideas, learning about people living in different cultures, and exploring different perspectives on topics that matter to me. AI as a research tool is wonderful, although very quickly I learned about its limitations. A simple test was to search for my own name. It knew nothing. My ego was not bruised as I am not a celebrity or want to be one. On the other hand, a simple search on Google very quickly found my name, my address, my family members, and everything I did online going back at least a decade. ChatGPT insisted that it knew nothing about me since its training ended in September 2021, 2 years ago. Similarly, when asked about a company website that has been active for at least 20 years it gave this reply: “I apologize for the confusion, but as an AI language model, I don't have the capability to browse the internet or visit specific websites. My responses are based on pre-existing knowledge up until September 2021. Therefore, I'm unable to provide a real-time description or analysis of the website “ or “Without specific information, I can't provide details about the website's content, purpose, or any other features it may have. It's always a good idea to visit the website directly to gather accurate and up-to-date information.” This made me ask a question how is ChatGPT trained? Where does the data come from?Once I manually copied information from the website and asked ChatGPT to generate a new response. It expanded on dry data and formulated a nice description of the website content.Image 1: ChatGPT cannot figure out what is the content of the websiteFigure 2: ChatGPT expanded the descriptionWhen I asked for descriptions of cities, landmarks, or public figures ChatGPT did provide sufficient information in full sentences with rich vocabulary. When asked to regenerate responses it provided fresh and even better-formulated descriptions. Again, not knowing where the data for AI come from, I depended on what I already knew about the locations to evaluate the accuracy of the response. It made me think about the famous quote: “Trust but verify”. So, compare results from multiple other sources to get the results that you can trust. Asked about liking a city, this is what I got: “As an AI language model, I don't have personal opinions or emotions, so I don't have the ability to like or dislike anything. However, I can provide information.” Not quite a chatty, opinionated friend, at least not yet.What is your experience using ChatGPT as a Writer?I think this is where the AI can be very helpful as it can be a thesaurus, spell-checker, and grammar checker all at once. It can re-write sentences; from just a rough draft it can expand descriptions and literally be your personal assistant during the writing process. You can see this in the screenshot example. As a bilingual person I often wonder how to express ideas in Polish for my friends in Poland. I discovered that translations of English text to Polish are very good. Grammar is correct, vocabulary is rich enough and sentences are full and mostly sound natural. Much better than what I had experienced in the past using Google Translate, when translated text needed a real human translator to be understood by a Polish-only speaking person (my parents). Of course, there are some flaws, such as the assumption of the male gender as an author. In Polish all nouns are assigned one of three genders: feminine (yes, ladies first), masculine and neutral. This is where corrections were needed. Additionally, since an example to be translated was a chapter of the software guide, it used many English terms in Polish grammatical form. My English teacher would faint at such a transgression, as we were always taught to use native expressions in place of foreign adoptions. But since technology vocabulary originated in English, so the rest of the world must just deal with it. I can live with that. I will depend on ChatGPT as a writer from now on. Definitely thumbs up!What about the perspective of a software user?Well, this is where the results vary, and it simply depends on what you are looking for. I tested a question about authoring Adobe InDesign documents for PDF accessibility and compliance with Section 508 requirements in the USA. ChatGPT provided a very detailed, step-by-step description of how to proceed, but in responses regenerated multiple times it missed the most advanced method when automated alt-text tags can be generated from image metadata using Object Styles. So again, AI helped, but I needed to know already what I could possibly do. Great help from a writer’s perspective, but not so good for someone who is exploring more advanced software functions.It is exciting to explore new platforms and technology. Like any new frontier, it brings excitement but also fear. And again, I am reminded that we as humans have not changed at all. Our toys changed, and we became more sophisticated and powerful, but we continue to need guidance on how to use yet another newly found power and knowledge. History is not a strong enough deterrent from misuse.SummaryIn conclusion, the interview with Urszula sheds light on the versatile applications of ChatGPT in the roles of a researcher, writer, and software engineer. Urszula highlights the efficiency and creativity enabled by ChatGPT, allowing her to tackle complex research problems, generate high-quality content, and even assist in software development tasks. Through her experiences, we gain insights into the immense potential of ChatGPT as a powerful tool for augmenting productivity and innovation across various domains. As the technology continues to evolve, researchers and professionals can leverage ChatGPT to unlock new possibilities and achieve greater efficiency in their work.Author BioUrszula is an expert graphic designer, software instructor, and consultant. As an instructor, she taught thousands of Adobe software users in government agencies and private corporations. Her easy-going and effective presentation style of complex features earned her many loyal clients. Her consulting work related to PDF included creating templates, editing files, and providing recommendations on the document production process. The final goal was to ensure that each publication met the highest publishing and accessibility standards, which was achieved successfully. Urszula also designed training curriculum and reference materials on proper document construction prior to conversion to PDF in a relevant authoring software, such as MS Word, Adobe InDesign, and FrameMaker.Author of the book: Adobe Acrobat Ninja
Read more
  • 0
  • 0
  • 1850
Modal Close icon
Modal Close icon