<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Laurentiu Raducu</title>
    <description>The latest articles on Forem by Laurentiu Raducu (@bitheap_tech).</description>
    <link>https://forem.com/bitheap_tech</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1028523%2Faa1d08d6-1442-4894-88ca-3bbfdc10cf0a.jpg</url>
      <title>Forem: Laurentiu Raducu</title>
      <link>https://forem.com/bitheap_tech</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/bitheap_tech"/>
    <language>en</language>
    <item>
      <title>Microservices are bad for your mental health</title>
      <dc:creator>Laurentiu Raducu</dc:creator>
      <pubDate>Wed, 14 Aug 2024 12:08:46 +0000</pubDate>
      <link>https://forem.com/bitheap_tech/microservices-are-bad-for-your-mental-health-1nm0</link>
      <guid>https://forem.com/bitheap_tech/microservices-are-bad-for-your-mental-health-1nm0</guid>
      <description>&lt;p&gt;Short, tldr version here: &lt;a href="https://www.youtube.com/watch?v=wtXrOXYO0LA" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=wtXrOXYO0LA&lt;/a&gt;&lt;br&gt;
Long version below 👇&lt;/p&gt;

&lt;p&gt;Last month I wrote a hit piece on software in general, venting my decade-long frustrations as a user of commercial software. While I briefly touched on today’s topic, I didn’t delve into it deeply. So, I plan to share my experiences with microservices and explain why this trend is causing burnout and immense frustration among developers.&lt;/p&gt;

&lt;p&gt;There are many myths surrounding microservices. Some people advocating for them say that scaling-related problems are solved by following this architecture. Some say that it enables high development speed, while others exaggerate how great it is in comparison to monoliths. These myths were propagated by tech gurus and influencers, people who don’t usually write code to create successful products, but rather philosophize about different tech topics. They don’t have the time to develop products, as their role as professional conference speakers occupies most of their time.&lt;/p&gt;

&lt;p&gt;Engineers mistakenly look for answers formulated by these philosophers (or thought leaders). Instead of thinking critically about problems and trying to simulate what the outcome will be, they will just go to a conference, listen to these professional conference speakers, and start idolizing the nice stories they’ve heard.&lt;/p&gt;

&lt;p&gt;As a consultant working mostly with large enterprises, I am amazed to see how huge budgets are being allocated to moving away from monolithic to microservice architectures. The motivation seems always to be related to scaling, but the only thing that scales in the end is their cloud costs. I tried to track down some of these initiatives, and most of them come from non-technical CTOs trying to impress the board members by shoving the latest buzzwords in their faces. A limited subset of these initiatives are influenced by visits from tech gurus, and only in one case was this architecture style a promising change and came organically from the engineering teams.&lt;/p&gt;

&lt;h1&gt;
  
  
  Why Microservices Suck?
&lt;/h1&gt;

&lt;p&gt;In my latest blog post I got some really nasty answers, as well as some death threats on my YouTube channel, therefore I have to give you the following disclaimer. In this post, I am going to give my personal opinion based on anecdotes from my experience as a consultant. Although this might seem controversial, my aim is to raise awareness around the pitfalls of this architectural choice. My aim is not to insult or challenge anyone personally, so don’t take this post too seriously. If you don’t agree and you cannot supply constructive criticism, just stop reading, it’s that simple.&lt;/p&gt;

&lt;h2&gt;
  
  
  Microservices do not scale better than monoliths
&lt;/h2&gt;

&lt;p&gt;Established tech voices always tell you that rather than scaling vertically, by adding hardware resources to a server, like it’s being done in the case of monoliths, it’s better to do it horizontally, by adding another server. This is often false. (or “This is not always true.”)&lt;/p&gt;

&lt;p&gt;Contrary to what you’ve heard so far from the biggest voices in tech, there is no superiority when it comes to scaling with neither of these architectures. Let’s break this down with a clear example:&lt;/p&gt;

&lt;p&gt;Imagine you have a monolith service for an e-commerce app, which is containerized and deployed on two machines, with a load balancer balancing the requests between the two. You are convinced by a tech guru that in order to scale, you must convert everything to microservices. You decide to split your monolith into multiple services:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Authentication&lt;/li&gt;
&lt;li&gt;Products&lt;/li&gt;
&lt;li&gt;Orders&lt;/li&gt;
&lt;li&gt;Payments&lt;/li&gt;
&lt;li&gt;Stock&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Of course, you won’t go with these simple names, so you get your team to brainstorm some cool names for your services, inspired by either comic books, mythology, or astronomy. Since you are also agile, you need to add story points to this effort, so you will end up losing some time in endless debates about what the difference between 2, 3, and 5 story points is, and you finish by adopting the t-shirt size estimation method.&lt;/p&gt;

&lt;p&gt;After all this effort, you end up with two machines for each service and a load balancer for each, which means a total of 10 machines (without the gateway service), a huge amount of bloatware given by the many HTTP requests going between services, and a new living hell for maintaining the contracts between these new services. How is this scalable if, for each new service, you need to provision a new machine (or two), find the best strategy for balancing the load, and make sure the contracts won’t break when developing new features?&lt;/p&gt;

&lt;h2&gt;
  
  
  Microservices are not testable
&lt;/h2&gt;

&lt;p&gt;As humans, we are not able to predict what a change is going to cause in a complex system. Without proper simulations or testing against a system that replicates the real one, you cannot predict what will happen. In software, testing is absolutely critical for ensuring software quality, we all know that. However, in the case of microservices, testability is often lower than in the case of monoliths.&lt;/p&gt;

&lt;p&gt;On the one hand, you have the tests developed for the service itself. Let’s stick with the same e-commerce app, where we want to define tests for our payments service. Devs will write unit and system tests, which will assess how individual components behave when fed certain inputs. They need to make a change to adapt the quantity field, which is the field that is supposed to hold the information on the quantity of the product that the customer needs to pay for, from integer to double. After deploying the change, production gets broken, and the company loses thousands of dollars for not allowing customers to buy anything for a few minutes.&lt;/p&gt;

&lt;p&gt;Even though the tests were green, the integration between the service supplying the quantity and the payment service wasn’t tested properly. The quantity was still sent as an integer instead of being adapted to double, to match the expectation of the consumer (payment service).&lt;/p&gt;

&lt;p&gt;There are ways to address this issue of testing the integration of the services, but none of these ways are easy enough, and require constant maintenance. Contract testing is one of the options. In contract testing, you define the consumer’s HTTP request and the provider’s expected response. You send the request and the expectation to a third-party service (in the case of Consumer-driven Contract Testing from Pact, the broker), and this service will execute the request against the provider, and check the response against the expectation. This sounds great in theory, but:&lt;/p&gt;

&lt;p&gt;Both the consumer and provider need to make assumptions about the behavior of specific fields in the contract that are not explicitly enforced. For example, a consumer might expect a “quantity” field to be always positive, while the provider might allow zero to indicate “out of stock”. The consumer assumes it’s always positive because that fits its usage pattern. Meanwhile, the provider assumes it needs the flexibility of zero for inventory management. In the context of verifying the schema, this kind of assumptions would never be checked.&lt;br&gt;
The effort for maintaining these tests is huge, on one hand, in the case of teams that are in early-stage development. It doesn’t provide flexibility in dealing with the rapidly evolving interfaces. On the other hand, legacy systems might need to invest in performing big amounts of refactoring in order to enable this type of testing, which is impractical for most of the organizations.&lt;br&gt;
The learning curve is steep – devs will have to fully understand the concept, spend time developing proof of concepts, test their assumptions, which drains a lot of time and energy from focusing on critical business requirements.&lt;br&gt;
You can always default to end-to-end tests, which will give you the confidence and fidelity that the changes won’t break your system. However, these tests are slow, and in the context of microservices, in a really entangled architecture, devs will spend a lot of time defining, maintaining, debugging and even running those tests. It’s just not worth it to wait hours and hours for the tests to end in order to deploy a change.&lt;/p&gt;

&lt;h2&gt;
  
  
  Development is very slow for microservices
&lt;/h2&gt;

&lt;p&gt;You’ve heard that right! It takes a lot of time for a developer to push a change in this architecture, which leads to sluggish development cycles. A primary reason for this is the increased cognitive load and context switching that developers face. With numerous independent services, each with its own codebase, dependencies, and deployment processes, developers must constantly switch between different contexts to understand and modify the system. This continuous mental juggling can significantly impede development speed, especially for complex systems with a multitude of microservices.&lt;/p&gt;

&lt;p&gt;Furthermore, debugging and troubleshooting become more cumbersome in a microservice environment. When an issue arises, pinpointing the root cause can be time-consuming as developers need to trace the interaction path through multiple services. This process involves analyzing logs, tracking requests, and potentially reproducing the issue in different environments, further adding to the development time. The distributed nature of microservices can also make it challenging to maintain a holistic view of the system, leading to inefficiencies and delays in resolving problems.&lt;/p&gt;

&lt;p&gt;All in all, I think microservices are bad for your mental health as an engineer. What appears to be a huge jump in quality of life, leading to fast development, better flexibility and improved scalability, turns out to be a huge pain. Constant context switching, increased stress from observing and understanding all the interactions, and the hazardous nature of adding changes to your services will easily make you burn out and lose motivation for your work.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Simplify Your Taxes with AI: How to Create a Tax Consultant Using OpenAI API and Python</title>
      <dc:creator>Laurentiu Raducu</dc:creator>
      <pubDate>Tue, 18 Apr 2023 07:29:24 +0000</pubDate>
      <link>https://forem.com/bitheap_tech/simplify-your-taxes-with-ai-how-to-create-a-tax-consultant-using-openai-api-and-python-2j2j</link>
      <guid>https://forem.com/bitheap_tech/simplify-your-taxes-with-ai-how-to-create-a-tax-consultant-using-openai-api-and-python-2j2j</guid>
      <description>&lt;p&gt;Tax consulting can be a complex and time-consuming process for individuals and businesses alike. With changing tax laws and regulations, it’s crucial to stay up-to-date and accurate in tax planning and compliance. Fortunately, artificial intelligence (AI) has the potential to streamline the tax consulting process, and one powerful tool in this realm is the OpenAI API.&lt;/p&gt;

&lt;p&gt;OpenAI is a leading AI research organization that offers a powerful language generation API, which can be leveraged to create a tax consultant using Python. By utilizing the OpenAI API, you can automate the generation of tax-related information, forms, deductions, and credits, making the tax consulting process more efficient and accurate.&lt;/p&gt;

&lt;p&gt;In this blog post, we will explore how to create a tax consultant using the OpenAI API and Python. We will delve into the capabilities of the OpenAI API, provide step-by-step instructions on setting up your tax consultant project, discuss the development process, and explore how machine learning can enhance the tax consultant’s capabilities. So, let’s dive into the world of AI-powered tax consulting and see how it can simplify your taxes and save you time and effort.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting Up Your Tax Consultant Project
&lt;/h2&gt;

&lt;p&gt;Setting up your tax consultant project with Python and the OpenAI API is a straightforward process. Here’s an outline of the steps you’ll need to follow:&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Prerequisites
&lt;/h3&gt;

&lt;p&gt;Before getting started, ensure that you have the following prerequisites in place:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Python: Make sure you have Python installed on your machine. You can download the latest version of Python from the official Python website (&lt;a href="https://www.python.org/"&gt;https://www.python.org/&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;OpenAI API Credentials: You’ll need to obtain API credentials from OpenAI to access their API. You can sign up for an account and obtain the necessary credentials from the OpenAI website (&lt;a href="https://www.openai.com/"&gt;https://www.openai.com/&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;Python Libraries: Install the necessary Python libraries for interfacing with the OpenAI API. The main library you’ll need is the openai library, which provides Python bindings for the OpenAI API. You can install it using pip, the Python package manager, with the following command:
&lt;code&gt;pip install openai&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 2: Setting Up the Project Environment
&lt;/h3&gt;

&lt;p&gt;Once you have the prerequisites in place, you can set up your Python project environment for creating the tax consultant. Here are some instructions and code snippets to guide you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a New Python Project: Start by creating a new directory for your tax consultant project. You can use your favorite Python IDE or text editor to create a new Python file (.py) within this directory.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Import the Required Libraries: In your Python file, import the openai library and any other libraries you may need for your project. Here's an example:&lt;br&gt;
&lt;code&gt;import openai&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Authenticate with OpenAI API: Use your OpenAI API credentials to authenticate with the API. You can do this by setting the OPENAI_API_KEY environment variable in your Python script, or by passing your API key as a parameter when initializing the openai library. Here's an example:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import openai

openai.api_key = "YOUR_API_KEY"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Define Functions and Variables: Define any functions or variables that you’ll need for your tax consultant project. For example, you might define a function to generate tax-related information, or variables to store input data.&lt;/li&gt;
&lt;li&gt;Test the API Connection: Finally, test your API connection by making a simple API call. For example, you can use the openai.Completion.create() method to generate a basic text completion. Here's an example:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import openai

openai.api_key = "YOUR_API_KEY"

response = openai.Completion.create(
  prompt="Hello, I'm testing the OpenAI API!",
  max_tokens=50
)
print(response.choices[0].text)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you receive a response from the API, it means your project environment is set up correctly, and you’re ready to start building your tax consultant using the OpenAI API and Python!&lt;/p&gt;

&lt;p&gt;With the project environment set up, you can now move on to the development of your tax consultant, which involves leveraging the capabilities of the OpenAI API to generate tax-related information and provide accurate responses. In the next section, we’ll explore the development process in more detail, so you can start creating your own AI-powered tax consultant.&lt;/p&gt;

&lt;h2&gt;
  
  
  Section 3: Developing the Tax Consultant
&lt;/h2&gt;

&lt;p&gt;Once you have set up your project environment, you can start developing your tax consultant using the OpenAI API and Python. In this section, we will discuss the approach for developing the tax consultant and explore the different components involved in the process.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Data Input: The first step in developing the tax consultant is to define the input data that will be provided to the API. This can include information such as the user’s income, deductions, credits, and other relevant tax details. You can collect this information from the user through a user interface or by programmatically retrieving data from external sources.&lt;/li&gt;
&lt;li&gt;Processing Data: Once you have collected the input data, you can process it to generate meaningful queries or prompts to send to the OpenAI API. This can involve formatting the data in a way that is compatible with the API’s input requirements, such as creating a prompt that asks a specific question or provides a context for generating tax-related information.&lt;/li&gt;
&lt;li&gt;Generating Responses: The core functionality of the tax consultant is to generate accurate and relevant tax-related information using the OpenAI API. You can utilize the OpenAI API’s language generation capabilities to generate responses that include tax forms, deductions, credits, and other tax-related information. You can experiment with different prompt engineering techniques, such as tweaking the prompt, adjusting the temperature and max tokens parameters, to fine-tune the responses to meet your desired level of accuracy and comprehensiveness.
Here’s an example of how you can use the OpenAI API to generate a tax-related information response:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import openai

openai.api_key = "YOUR_API_KEY"

income = 50000
deductions = 10000
prompt = f"Generate a tax form for a person with an income of ${income} and deductions of ${deductions}."

response = openai.Completion.create(
  prompt=prompt,
  max_tokens=200
)
tax_info = response.choices[0].text

processed_tax_info = process_tax_info(tax_info)

print(processed_tax_info)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Customizing the Tax Consultant: You can also customize the behavior of your tax consultant by training it with your own data. The OpenAI API allows for fine-tuning using custom datasets, which can enable your tax consultant to provide more accurate and tailored responses based on your specific use case or domain expertise. Fine-tuning involves training the model with additional data, such as tax laws, regulations, and specific tax scenarios, to make it more proficient in generating tax-related information.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The tax consultant developed using the OpenAI API and Python can provide automated and accurate tax-related information, including forms, deductions, and credits.&lt;/p&gt;

&lt;p&gt;Creating a tax consultant with the OpenAI API and Python can be a game-changer in the world of taxes! Gone are the days of sifting through stacks of forms and scratching your head over complicated deductions.&lt;/p&gt;

&lt;p&gt;It’s difficult to say at this point how hard will this industry be disrupted by AI. According to this paper published by OpenAI, tax consultants are 100% exposed to the capabilities of AI. However, without any legislation in place, it is difficult to say if AI will replace anyone. In the meantime, we can enjoy a productivity boost given by these tools. Happy coding!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Optional Chaining in JavaScript: Simplify your Code and Avoid Unwanted Errors</title>
      <dc:creator>Laurentiu Raducu</dc:creator>
      <pubDate>Mon, 20 Feb 2023 19:01:19 +0000</pubDate>
      <link>https://forem.com/bitheap_tech/optional-chaining-in-javascript-simplify-your-code-and-avoid-unwanted-errors-20lh</link>
      <guid>https://forem.com/bitheap_tech/optional-chaining-in-javascript-simplify-your-code-and-avoid-unwanted-errors-20lh</guid>
      <description>&lt;p&gt;If you've been writing JavaScript code for a while, you've probably encountered situations where you need to access properties or methods of an object, but you're not sure if the object is defined or has the desired property or method. In the past, you may have written verbose code with many conditional statements to avoid errors caused by undefined objects. However, with the introduction of Optional Chaining in JavaScript, you can simplify your code and avoid these unwanted errors.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Optional Chaining?
&lt;/h2&gt;

&lt;p&gt;Optional Chaining is a feature that was introduced in ECMAScript 2020 (ES2020) and is now widely supported by modern browsers. It allows you to access properties and methods of an object without the need for null checks or conditional statements. Instead, you can use the ?. operator to access the property or method, and if the object is null or undefined, the expression will evaluate to undefined without throwing an error.&lt;/p&gt;

&lt;h2&gt;
  
  
  Syntax of Optional Chaining
&lt;/h2&gt;

&lt;p&gt;The syntax for Optional Chaining is straightforward. You simply add a ?. operator between the object and the property or method you want to access. Here's an example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const user = {
  name: 'John',
  age: 30,
  address: {
    street: '123 Main St',
    city: 'Anytown',
    state: 'CA'
  }
};

const state = user.address?.state;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we use Optional Chaining to access the state property of the address object, even if address is undefined. If address is undefined, the state variable will be set to undefined as well, without throwing an error.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use Cases for Optional Chaining
&lt;/h2&gt;

&lt;p&gt;Optional Chaining can be used in a variety of situations where you need to access properties or methods of an object, but you're not sure if the object is defined. Some common use cases include:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Accessing properties of nested objects:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const user = {
  name: 'John',
  address: {
    street: '123 Main St',
    city: 'Anytown',
    state: 'CA'
  }
};

const state = user?.address?.state;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we use Optional Chaining to access the state property of the address object, even if address is undefined.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Accessing methods of an object:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const user = {
  name: 'John',
  getAddress: function() {
    return {
      street: '123 Main St',
      city: 'Anytown',
      state: 'CA'
    }
  }
};

const state = user?.getAddress()?.state;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we use Optional Chaining to access the state property of the object returned by the getAddress method, even if getAddress is undefined.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Checking for the existence of a property or method:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const user = {
  name: 'John',
  age: 30
};

const hasAddress = user?.address !== undefined;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we use Optional Chaining to check if the address property exists on the user object, without throwing an error if user is undefined.&lt;/p&gt;

&lt;p&gt;Optional Chaining is a powerful feature that simplifies your code and helps you avoid unwanted errors caused by undefined objects. It can be used in a variety of situations where you need to access properties or methods of an object, and it is now widely supported by modern browsers. If you're not already using Optional Chaining in your JavaScript code, it's definitely worth considering as a way to improve your code quality and reduce the risk of errors&lt;/p&gt;

</description>
      <category>discuss</category>
    </item>
    <item>
      <title>My Journey Creating an API to Check Terms and Conditions Using ChatGPT</title>
      <dc:creator>Laurentiu Raducu</dc:creator>
      <pubDate>Fri, 17 Feb 2023 15:01:53 +0000</pubDate>
      <link>https://forem.com/bitheap_tech/my-journey-creating-an-api-to-check-terms-and-conditions-using-chatgpt-4299</link>
      <guid>https://forem.com/bitheap_tech/my-journey-creating-an-api-to-check-terms-and-conditions-using-chatgpt-4299</guid>
      <description>&lt;p&gt;Hey there, fellow developers! Today, I want to talk about my latest project called &lt;a href="https://github.com/LaurentiuGabriel/terms-and-conditions-verifier-gpt"&gt;terms-and-conditions-verifier&lt;/a&gt;. The aim of this API is to check any terms and conditions sent by a client app for any irregularities or fishy stuff. To achieve this, I have integrated ChatGPT, which is an advanced language model that can understand natural language, into the API.&lt;/p&gt;

&lt;p&gt;To give you a brief idea of how the code works, let's take a look at the following file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import dotenv from "dotenv-safe";
dotenv.config();
import express from "express";
import bodyParser from "body-parser";
import cors from "cors";
import { ChatGPTAPIBrowser } from "chatgpt";
import { oraPromise } from "ora";
import config from "./config.js";

const app = express().use(cors()).use(bodyParser.json());

const gptApi = new ChatGPTAPIBrowser({
  email: process.env.OPENAI_EMAIL,
  password: process.env.OPENAI_PASSWORD,
});

await gptApi.initSession();

const Config = configure(config);

class Conversation {
  //...
}

const conversation = new Conversation();

app.post("/eula-summary", async (req, res) =&amp;gt; {
  //...
});

const EnsureAuth = new Promise((resolve, reject) =&amp;gt; {
  //...
});

async function start() {
  //...
}

function configure({ plugins, ...opts }) {
  //...
}

start();

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first few lines of code import necessary modules such as &lt;code&gt;dotenv&lt;/code&gt;, &lt;code&gt;express&lt;/code&gt;, &lt;code&gt;body-parser&lt;/code&gt;, &lt;code&gt;cors&lt;/code&gt;, &lt;code&gt;ChatGPTAPIBrowser&lt;/code&gt; and &lt;code&gt;oraPromise&lt;/code&gt;. &lt;code&gt;dotenv&lt;/code&gt; is used to read environment variables from a .env file, &lt;code&gt;express&lt;/code&gt; is used to create an instance of the express application, &lt;code&gt;body-parser&lt;/code&gt; is used to parse incoming request bodies, &lt;code&gt;cors&lt;/code&gt; is used to enable Cross-Origin Resource Sharing (CORS), &lt;code&gt;ChatGPTAPIBrowser&lt;/code&gt; is used to interact with the ChatGPT API via the browser, and &lt;code&gt;oraPromise&lt;/code&gt; is used to create loading spinners for various functions.&lt;/p&gt;

&lt;p&gt;After importing the modules, the code initializes the ChatGPT API by passing the credentials to the &lt;code&gt;ChatGPTAPIBrowser&lt;/code&gt; constructor. It then creates a new Conversation instance and configures the API by calling the configure function.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;configure&lt;/code&gt; function collects rules and parsers from all plugins and trains the ChatGPT model with all the rules. It then runs the ChatGPT response through all plugin parsers.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;start&lt;/code&gt; function connects to ChatGPT and trains the model with the rules collected from all plugins. It then starts the express application, and the &lt;code&gt;app.post&lt;/code&gt; method listens for incoming requests. Once a request is received, the API sends the terms and conditions to the Conversation instance for processing.&lt;/p&gt;

&lt;p&gt;This project can prove to be a powerful tool that can help you detect any irregularities or fishy stuff in terms and conditions. With the help of ChatGPT, you can easily process natural language and provide quick responses to your clients. I hope this post has given you a better understanding of the code behind the terms-and-conditions-verifier API. Happy coding!&lt;/p&gt;

</description>
      <category>chatgpt</category>
      <category>javascript</category>
      <category>programming</category>
      <category>license</category>
    </item>
  </channel>
</rss>
