<?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>DEV Community: Syed Nashet Ali</title>
    <description>The latest articles on DEV Community by Syed Nashet Ali (@nashetking).</description>
    <link>https://dev.to/nashetking</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%2F786436%2Fdb26bc99-5cd8-40e1-9da1-0ab43f7cfbd2.jpg</url>
      <title>DEV Community: Syed Nashet Ali</title>
      <link>https://dev.to/nashetking</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nashetking"/>
    <language>en</language>
    <item>
      <title>Top 10 Cloud Security Startups to Watch in 2024</title>
      <dc:creator>Syed Nashet Ali</dc:creator>
      <pubDate>Tue, 16 Jul 2024 20:00:05 +0000</pubDate>
      <link>https://dev.to/nashetking/top-10-cloud-security-startups-to-watch-in-2024-5964</link>
      <guid>https://dev.to/nashetking/top-10-cloud-security-startups-to-watch-in-2024-5964</guid>
      <description>&lt;p&gt;As cloud environments continue to evolve, several startups are making significant strides in providing innovative cloud security solutions. These startups are not only leveraging cutting-edge technologies but also addressing the specific challenges that organizations face. In this blog, we'll explore the top 10 cloud security startups of 2024, diving into their unique offerings, behind-the-scenes technology, case studies, and client responses.&lt;/p&gt;




&lt;h4&gt;
  
  
  1. Aqua Security
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Overview&lt;/strong&gt;: Aqua Security specializes in securing cloud-native environments. Their recent updates include the Kubernetes Bill of Materials (KBOM) and AI-Guided Remediation capabilities.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tech Behind the Scenes&lt;/strong&gt;: Aqua Security utilizes machine learning to analyze data from various sources, providing automated remediation steps. The KBOM tool dissects Kubernetes clusters to identify all components, enhancing security monitoring.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Case Study&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Client&lt;/strong&gt;: A leading e-commerce platform&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Challenge&lt;/strong&gt;: Securing a complex Kubernetes environment with multiple clusters.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Solution&lt;/strong&gt;: Implemented Aqua Security’s KBOM and AI-Guided Remediation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Results&lt;/strong&gt;: Reduced vulnerability remediation time by 40%, improved visibility, and compliance.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Client Response&lt;/strong&gt;: "Aqua Security has significantly streamlined our Kubernetes security processes. The automated remediation is a game-changer."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code Snippet&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Pod&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;secure-pod&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;containers&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;secure-container&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;secure-image:latest&lt;/span&gt;
    &lt;span class="na"&gt;securityContext&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;readOnlyRootFilesystem&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
      &lt;span class="na"&gt;runAsNonRoot&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;More Info&lt;/strong&gt;: &lt;a href="https://www.aquasec.com/" rel="noopener noreferrer"&gt;Aqua Security&lt;/a&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  2. Dazz
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Overview&lt;/strong&gt;: Dazz offers a platform focused on the prioritization and remediation of cloud vulnerabilities with its Unified Remediation Platform.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tech Behind the Scenes&lt;/strong&gt;: Dazz uses data correlation techniques to connect related security issues and trace them back to their root causes, enabling efficient remediation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Case Study&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Client&lt;/strong&gt;: A global financial services company&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Challenge&lt;/strong&gt;: High volume of security alerts with limited context.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Solution&lt;/strong&gt;: Adopted Dazz’s Unified Remediation Platform.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Results&lt;/strong&gt;: 50% reduction in false positives, quicker identification of critical vulnerabilities.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Client Response&lt;/strong&gt;: "Dazz has transformed our vulnerability management process, making it more efficient and focused."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code Snippet&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;dazz_sdk&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dazz_sdk&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;your_api_key&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;vulnerabilities&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_vulnerabilities&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;critical_vulns&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;v&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;vulnerabilities&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;v&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;severity&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Critical&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;vuln&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;critical_vulns&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;remediate_vulnerability&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;vuln&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;More Info&lt;/strong&gt;: &lt;a href="https://www.dazz.io/" rel="noopener noreferrer"&gt;Dazz&lt;/a&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  3. Orca Security
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Overview&lt;/strong&gt;: Orca Security provides AI-driven cloud asset search for fast visibility into cloud environments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tech Behind the Scenes&lt;/strong&gt;: Orca leverages large language models (LLMs) to create a question-and-answer functionality, enabling users to query their cloud assets and receive detailed responses.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Case Study&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Client&lt;/strong&gt;: A healthcare provider&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Challenge&lt;/strong&gt;: Lack of visibility into cloud assets and security posture.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Solution&lt;/strong&gt;: Deployed Orca Security’s AI-driven search functionality.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Results&lt;/strong&gt;: Achieved 100% visibility into cloud assets, improved incident response times.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Client Response&lt;/strong&gt;: "Orca Security has given us unprecedented visibility and control over our cloud environment."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code Snippet&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"query"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"List all EC2 instances with open security groups"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"results"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"instance_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"i-1234567890abcdef"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"security_group"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"sg-12345"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"open_ports"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;22&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;More Info&lt;/strong&gt;: &lt;a href="https://orca.security/" rel="noopener noreferrer"&gt;Orca Security&lt;/a&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  4. Cyble
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Overview&lt;/strong&gt;: Cyble uses AI to monitor the Darkweb, Deepweb, and Surface Web for cyber threats, providing real-time insights and threat intelligence.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tech Behind the Scenes&lt;/strong&gt;: Cyble's platform continuously scans and analyzes data from various sources, leveraging machine learning to identify potential threats and vulnerabilities.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Case Study&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Client&lt;/strong&gt;: A major retail chain&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Challenge&lt;/strong&gt;: Frequent data breaches and lack of threat intelligence.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Solution&lt;/strong&gt;: Implemented Cyble’s threat intelligence platform.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Results&lt;/strong&gt;: Early detection of potential breaches, improved security posture.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Client Response&lt;/strong&gt;: "Cyble’s threat intelligence capabilities have been instrumental in protecting our data."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code Snippet&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;cyble_sdk&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;cyble_sdk&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;your_api_key&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;threats&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_threats&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;threat&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;threats&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;threat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;risk_level&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;High&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;alert_security_team&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;threat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;More Info&lt;/strong&gt;: &lt;a href="https://cyble.com/" rel="noopener noreferrer"&gt;Cyble&lt;/a&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  5. Illumio
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Overview&lt;/strong&gt;: Illumio provides microsegmentation technology for zero-trust security, preventing the lateral movement of breaches within data centers and cloud environments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tech Behind the Scenes&lt;/strong&gt;: Illumio's platform uses dynamic policies and real-time traffic analysis to enforce security boundaries within and across cloud environments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Case Study&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Client&lt;/strong&gt;: A large manufacturing firm&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Challenge&lt;/strong&gt;: Preventing lateral movement of attacks within the network.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Solution&lt;/strong&gt;: Deployed Illumio’s microsegmentation solution.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Results&lt;/strong&gt;: 60% reduction in breach impact, enhanced network security.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Client Response&lt;/strong&gt;: "Illumio’s microsegmentation has fortified our internal security against breaches."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code Snippet&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;illumio.com/v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;SecurityPolicy&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;zero-trust-policy&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;rules&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;action&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Allow&lt;/span&gt;
    &lt;span class="na"&gt;source&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;app-tier&lt;/span&gt;
    &lt;span class="na"&gt;destination&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;db-tier&lt;/span&gt;
    &lt;span class="na"&gt;ports&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;5432&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;action&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Deny&lt;/span&gt;
    &lt;span class="na"&gt;source&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;app-tier&lt;/span&gt;
    &lt;span class="na"&gt;destination&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;any&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;More Info&lt;/strong&gt;: &lt;a href="https://www.illumio.com/" rel="noopener noreferrer"&gt;Illumio&lt;/a&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  6. Safebreach
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Overview&lt;/strong&gt;: Safebreach offers continuous security assessment through breach and attack simulations, identifying vulnerabilities before hackers do.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tech Behind the Scenes&lt;/strong&gt;: Safebreach’s platform simulates various attack vectors, providing detailed reports on security weaknesses and remediation steps.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Case Study&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Client&lt;/strong&gt;: A telecommunications company&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Challenge&lt;/strong&gt;: Identifying and mitigating security gaps.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Solution&lt;/strong&gt;: Utilized Safebreach’s simulation tools.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Results&lt;/strong&gt;: Identified critical vulnerabilities, improved overall security posture.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Client Response&lt;/strong&gt;: "Safebreach’s simulations have been crucial in proactively addressing our security weaknesses."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code Snippet&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;safebreach_sdk&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;safebreach_sdk&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;your_api_key&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;simulations&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run_simulations&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;sim&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;simulations&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;sim&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Failed&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;remediate_issue&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sim&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;More Info&lt;/strong&gt;: &lt;a href="https://safebreach.com/" rel="noopener noreferrer"&gt;Safebreach&lt;/a&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  7. Beyond Identity
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Overview&lt;/strong&gt;: Beyond Identity focuses on passwordless authentication, binding identities to devices to enhance security.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tech Behind the Scenes&lt;/strong&gt;: The platform uses cryptographic keys stored on users’ devices, eliminating the need for passwords and reducing the risk of credential-based attacks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Case Study&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Client&lt;/strong&gt;: A financial technology startup&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Challenge&lt;/strong&gt;: Preventing credential-based attacks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Solution&lt;/strong&gt;: Implemented Beyond Identity’s passwordless authentication.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Results&lt;/strong&gt;: Enhanced security, reduced phishing attacks by 70%.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Client Response&lt;/strong&gt;: "Beyond Identity has made our authentication process more secure and user-friendly."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code Snippet&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;beyondIdentity&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;beyond-identity-sdk&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;beyondIdentity&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;authenticateUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;user_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;device_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Authentication successful:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Authentication failed:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;More Info&lt;/strong&gt;: &lt;a href="https://www.beyondidentity.com/" rel="noopener noreferrer"&gt;Beyond Identity&lt;/a&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  8. Confluera
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Overview&lt;/strong&gt;: Confluera helps organizations identify, track, and manage sophisticated security threats through its advanced cybersecurity platform.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tech Behind the Scenes&lt;/strong&gt;: Confluera uses real-time tracking and correlation of security events, providing actionable insights for threat management.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Case Study&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Client&lt;/strong&gt;: A government agency&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Challenge&lt;/strong&gt;: Managing advanced persistent threats (APTs).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Solution&lt;/strong&gt;: Adopted Confluera’s cybersecurity platform.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Results&lt;/strong&gt;: Improved threat detection and response times, reduced APT impact.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Client Response&lt;/strong&gt;: "Confluera’s platform has enhanced our ability to detect and respond to sophisticated threats."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code Snippet&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;confluera_sdk&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;confluera_sdk&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;your_api_key&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;threats&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_advanced_threats&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;threat&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;threats&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;take_action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;threat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;More Info&lt;/strong&gt;: &lt;a href="https://www.confluera.com/" rel="noopener noreferrer"&gt;Confluera&lt;/a&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  9. Liongard
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Overview&lt;/strong&gt;: Liongard offers cybersecurity services for Managed Service Providers (MSPs), providing comprehensive visibility and protection for sensitive data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tech Behind the Scenes&lt;/strong&gt;: Liongard’s platform integrates with various IT systems to automate security monitoring and compliance reporting.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Case Study&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Client&lt;/strong&gt;: An MSP serving multiple small businesses&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Challenge&lt;/strong&gt;: Ensuring consistent security across diverse environments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Solution&lt;/strong&gt;: Implemented Liongard’s integrated security platform.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Results&lt;/strong&gt;: Improved compliance, reduced manual security management efforts by 50%.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Client Response&lt;/strong&gt;: "Liongard has simplified our security management, making it more efficient and reliable."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code Snippet&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;liongard.io/v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;SecurityIntegration&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;msp-security&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;rules&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;action&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Monitor&lt;/span&gt;
    &lt;span class="na"&gt;source&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;all&lt;/span&gt;
    &lt;span class="na"&gt;target&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;sensitive_data&lt;/span&gt;
    &lt;span class="na"&gt;frequency&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;daily&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;action&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Alert&lt;/span&gt;
    &lt;span class="na"&gt;source&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;any&lt;/span&gt;
    &lt;span class="na"&gt;condition&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;anomaly_detected&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;More Info&lt;/strong&gt;: &lt;a href="https://liongard.com/" rel="noopener noreferrer"&gt;Liongard&lt;/a&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  10. Valtix
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Overview&lt;/strong&gt;: Valtix offers a cloud-native network security platform designed to provide visibility, control, and protection across multi-cloud environments.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tech Behind the Scenes&lt;/strong&gt;: Valtix's platform uses a single-pass architecture to inspect and enforce security policies, integrating seamlessly with AWS, Azure, GCP, and Oracle Cloud.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Case Study&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Client&lt;/strong&gt;: A global technology company&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Challenge&lt;/strong&gt;: Securing multi-cloud environments with unified policies.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Solution&lt;/strong&gt;: Deployed Valtix’s network security platform.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Results&lt;/strong&gt;: Enhanced security visibility, streamlined policy management across clouds.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Client Response&lt;/strong&gt;: "Valtix has revolutionized our multi-cloud security strategy, making it more efficient and comprehensive."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code Snippet&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"policy"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"multi-cloud-policy"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Unified security policy for multi-cloud environments"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"rules"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Allow"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"source"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"internal_network"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"destination"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"cloud_resources"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"ports"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;443&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;80&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"action"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Deny"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"source"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"external_network"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nl"&gt;"destination"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"cloud_resources"&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;More Info&lt;/strong&gt;: &lt;a href="https://www.valtix.com/" rel="noopener noreferrer"&gt;Valtix&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;The landscape of cloud security is rapidly evolving, with startups like Aqua Security, Dazz, Orca Security, Cyble, Illumio, Safebreach, Beyond Identity, Confluera, Liongard, and Valtix leading the way. These companies are leveraging cutting-edge technologies such as AI, machine learning, and advanced analytics to provide innovative solutions that address the complex challenges of securing cloud environments.&lt;/p&gt;

&lt;p&gt;From automated remediation and threat intelligence to zero-trust security and breach simulations, these startups are setting new standards in cloud security. Their case studies demonstrate the tangible benefits of their solutions, highlighting significant improvements in security posture, compliance, and operational efficiency.&lt;/p&gt;

&lt;p&gt;As cloud adoption continues to grow, keeping an eye on these innovative startups can provide valuable insights into the future of cloud security. Whether you're an enterprise looking to enhance your security measures or an MSP seeking to streamline your security management, these startups offer solutions that can meet your needs.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Author Note&lt;/strong&gt;: For more in-depth articles on cloud security and the latest tech innovations, follow my profile:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Connect with me&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.linkedin.com/in/nashet-ali/" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://twitter.com/nashetali" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Stay secure and keep innovating!&lt;/p&gt;

</description>
      <category>cloudcomputing</category>
      <category>security</category>
      <category>programming</category>
      <category>startup</category>
    </item>
    <item>
      <title>Algorithmic Trading Architecture and Quants: A Deep Dive with Case Studies on BlackRock and Tower Research</title>
      <dc:creator>Syed Nashet Ali</dc:creator>
      <pubDate>Sat, 06 Jul 2024 21:26:22 +0000</pubDate>
      <link>https://dev.to/nashetking/algorithmic-trading-architecture-and-quants-a-deep-dive-with-case-studies-on-blackrock-and-tower-research-55ao</link>
      <guid>https://dev.to/nashetking/algorithmic-trading-architecture-and-quants-a-deep-dive-with-case-studies-on-blackrock-and-tower-research-55ao</guid>
      <description>&lt;p&gt;(&lt;a href="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t044ftmmhixpbqma1io7.png" rel="noopener noreferrer"&gt;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t044ftmmhixpbqma1io7.png&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;Algorithmic trading, or "algo trading," involves using computer programs and algorithms to trade securities. These algorithms execute pre-defined strategies at speeds and frequencies that a human trader cannot match. This article delves into the architecture of algorithmic trading systems, the role of quants, and explores case studies from industry giants BlackRock and Tower Research. We will also provide step-by-step implementation examples, code snippets, calculations, and real-world examples from the London Stock Exchange (LSE) and the Singapore Exchange (SGX) over the past 25 years.&lt;/p&gt;

&lt;h2&gt;
  
  
  Algorithmic Trading Architecture
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. &lt;strong&gt;Market Data Feed Handlers&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Algo trading systems begin with market data feed handlers, which receive real-time data from various exchanges. These handlers process, filter, and normalize the data for the subsequent components.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. &lt;strong&gt;Strategy Engine&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The strategy engine is the core of the algo trading system. It runs the trading algorithms and makes trading decisions based on the incoming data. Strategies can range from simple rules to complex mathematical models.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. &lt;strong&gt;Order Management System (OMS)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The OMS is responsible for managing and executing orders. It ensures that the orders are sent to the market, filled correctly, and that any necessary modifications or cancellations are handled.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. &lt;strong&gt;Risk Management&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Risk management systems monitor the trading activities in real-time to ensure compliance with predefined risk parameters. They can halt trading activities if the risk thresholds are breached.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. &lt;strong&gt;Execution Management System (EMS)&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The EMS optimizes the execution of orders. It determines the best possible way to execute a trade, taking into account factors like order size, market conditions, and transaction costs.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. &lt;strong&gt;Backtesting and Simulation&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Before deploying strategies, they are rigorously tested using historical data. This process, known as backtesting, helps in understanding the performance and potential pitfalls of the strategy.&lt;/p&gt;

&lt;h3&gt;
  
  
  7. &lt;strong&gt;Latency and Infrastructure&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Latency is a critical factor in algorithmic trading. High-frequency trading (HFT) firms invest heavily in low-latency infrastructure, including direct market access (DMA), co-location of servers, and high-speed communication networks.&lt;/p&gt;

&lt;h3&gt;
  
  
  8. &lt;strong&gt;Compliance and Reporting&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Algo trading systems must adhere to regulatory requirements. Compliance modules ensure that trading activities comply with legal standards, and reporting modules generate necessary reports for regulatory bodies.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Role of Quants
&lt;/h2&gt;

&lt;p&gt;Quantitative analysts, or quants, are the backbone of algorithmic trading. They use mathematical models, statistical techniques, and programming skills to develop trading strategies. Their work involves:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Data Analysis:&lt;/strong&gt; Sifting through vast amounts of historical and real-time data to identify patterns and trends.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Model Development:&lt;/strong&gt; Creating mathematical models to predict price movements and optimize trading strategies.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Strategy Implementation:&lt;/strong&gt; Coding the strategies into algorithms and integrating them with the trading system.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Risk Assessment:&lt;/strong&gt; Evaluating the risk associated with each strategy and ensuring it aligns with the firm’s risk appetite.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step-by-Step Implementation of an Algorithmic Trading Strategy
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Example Strategy: Mean Reversion
&lt;/h3&gt;

&lt;p&gt;Mean reversion is a popular trading strategy that assumes prices will revert to their historical mean. Here’s a step-by-step implementation with code snippets in Python.&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 1: Import Libraries
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;numpy&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;matplotlib.pyplot&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;plt&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;yfinance&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;yf&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step 2: Fetch Historical Data
&lt;/h4&gt;

&lt;p&gt;We use the &lt;code&gt;yfinance&lt;/code&gt; library to fetch historical stock data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;ticker&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;AAPL&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;start_date&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;2020-01-01&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;end_date&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;2023-01-01&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;yf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;download&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ticker&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;start_date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;end&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;end_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step 3: Calculate Moving Averages
&lt;/h4&gt;

&lt;p&gt;We calculate the short-term and long-term moving averages.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;short_window&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;40&lt;/span&gt;
&lt;span class="n"&gt;long_window&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;

&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;short_mavg&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Close&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;rolling&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;window&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;short_window&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;min_periods&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;mean&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;long_mavg&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Close&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;rolling&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;window&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;long_window&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;min_periods&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;mean&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step 4: Generate Trading Signals
&lt;/h4&gt;

&lt;p&gt;We generate buy and sell signals based on the moving averages.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;signal&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;
&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;signal&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="n"&gt;short_window&lt;/span&gt;&lt;span class="p"&gt;:]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;where&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;short_mavg&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="n"&gt;short_window&lt;/span&gt;&lt;span class="p"&gt;:]&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;long_mavg&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="n"&gt;short_window&lt;/span&gt;&lt;span class="p"&gt;:],&lt;/span&gt; &lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   
&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;positions&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;signal&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;diff&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step 5: Backtest the Strategy
&lt;/h4&gt;

&lt;p&gt;We backtest the strategy to evaluate its performance.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;initial_capital&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;100000.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;positions&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;fillna&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;positions&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;ticker&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;signal&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;   
&lt;span class="n"&gt;portfolio&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;positions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;multiply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Close&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;axis&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;pos_diff&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;positions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;diff&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="n"&gt;portfolio&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;holdings&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;positions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;multiply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Close&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;axis&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)).&lt;/span&gt;&lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;axis&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;portfolio&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;cash&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;initial_capital&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pos_diff&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;multiply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Close&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;axis&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)).&lt;/span&gt;&lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;axis&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;cumsum&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;   
&lt;span class="n"&gt;portfolio&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;total&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;portfolio&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;cash&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;portfolio&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;holdings&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;portfolio&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;returns&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;portfolio&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;total&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;pct_change&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step 6: Plot the Results
&lt;/h4&gt;

&lt;p&gt;We visualize the strategy's performance.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;fig&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;figure&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;ax1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;fig&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add_subplot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;111&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ylabel&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Portfolio value in $&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;portfolio&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;total&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;plot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ax&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;ax1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;lw&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;2.&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;signal&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;plot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ax&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;ax1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;lw&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;2.&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;ax1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;plot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;loc&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;positions&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
         &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;short_mavg&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;positions&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
         &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;^&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;markersize&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;m&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;ax1&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;plot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;loc&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;positions&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
         &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;short_mavg&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;positions&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
         &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;v&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;markersize&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;color&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;k&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;show&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Explanation and Conditions
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Buy Signal:&lt;/strong&gt; Generated when the short-term moving average crosses above the long-term moving average.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sell Signal:&lt;/strong&gt; Generated when the short-term moving average crosses below the long-term moving average.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Real-World Examples from LSE and SGX
&lt;/h2&gt;

&lt;h3&gt;
  
  
  London Stock Exchange (LSE)
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Example 1: Mean Reversion on LSE
&lt;/h4&gt;

&lt;p&gt;Let's consider a mean reversion strategy implemented on the FTSE 100 index.&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 1: Fetch Historical Data
&lt;/h4&gt;

&lt;p&gt;We fetch the historical data for the FTSE 100 index.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;ticker&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;^FTSE&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;start_date&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;2000-01-01&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;end_date&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;2023-01-01&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;yf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;download&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ticker&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;start_date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;end&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;end_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step 2-6: Similar to the steps outlined above for mean reversion strategy
&lt;/h4&gt;

&lt;p&gt;By applying the same steps to the FTSE 100 index data, we can observe how the strategy performs on the LSE. &lt;/p&gt;

&lt;h3&gt;
  
  
  Singapore Exchange (SGX)
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Example 2: Momentum Trading on SGX
&lt;/h4&gt;

&lt;p&gt;Momentum trading is another popular strategy. Let's implement a simple momentum strategy on the STI index.&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 1: Fetch Historical Data
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;ticker&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;^STI&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;start_date&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;2000-01-01&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;end_date&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;2023-01-01&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;
&lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;yf&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;download&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ticker&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;start_date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;end&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;end_date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step 2: Calculate Momentum
&lt;/h4&gt;

&lt;p&gt;We calculate the momentum as the percentage change in price over a certain period.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;momentum_window&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;
&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;momentum&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Close&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;pct_change&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;momentum_window&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step 3: Generate Trading Signals
&lt;/h4&gt;

&lt;p&gt;We generate buy and sell signals based on momentum.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;signal&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;
&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;signal&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;where&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;momentum&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;positions&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;signal&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;diff&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step 4-6: Similar to the steps outlined above for backtesting and plotting results
&lt;/h4&gt;

&lt;p&gt;By applying these steps, we can backtest and visualize the performance of a momentum trading strategy on the SGX.&lt;/p&gt;

&lt;h2&gt;
  
  
  Calculations and Analysis
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Example 1: LSE Mean Reversion Strategy Performance
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;CAGR (Compound Annual Growth Rate) Calculation:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;[ \text{CAGR} = \left( \frac{\text{Ending Value}}{\text{Beginning Value}} \right)^{\frac{1}{n}} - 1 ]&lt;/p&gt;

&lt;p&gt;Where ( n ) is the number of years.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;beginning_value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;portfolio&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;total&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;iloc&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;ending_value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;portfolio&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;total&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;iloc&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;years&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]).&lt;/span&gt;&lt;span class="n"&gt;days&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mf"&gt;365.25&lt;/span&gt;

&lt;span class="n"&gt;CAGR&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ending_value&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;beginning_value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;years&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;CAGR: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;CAGR&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Example 2: SGX Momentum Strategy Performance
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Sharpe Ratio Calculation:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;[ \text{Sharpe Ratio} = \frac{\text{Mean Portfolio Return} - \text{Risk-Free Rate}}{\text{Portfolio Standard Deviation}} ]&lt;/p&gt;

&lt;p&gt;Assuming a risk-free rate of 2%.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;risk_free_rate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.02&lt;/span&gt;
&lt;span class="n"&gt;mean_return&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;portfolio&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;returns&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;mean&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;std_return&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;portfolio&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;returns&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;std&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="n"&gt;sharpe_ratio&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mean_return&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;risk_free_rate&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;std_return&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Sharpe Ratio: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;sharpe_ratio&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;## Case Study: BlackRock
&lt;/span&gt;
&lt;span class="c1"&gt;### Overview
&lt;/span&gt;&lt;span class="n"&gt;BlackRock&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;world&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="n"&gt;largest&lt;/span&gt; &lt;span class="n"&gt;asset&lt;/span&gt; &lt;span class="n"&gt;manager&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;leverages&lt;/span&gt; &lt;span class="n"&gt;algorithmic&lt;/span&gt; &lt;span class="n"&gt;trading&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;manage&lt;/span&gt; &lt;span class="n"&gt;its&lt;/span&gt; &lt;span class="n"&gt;extensive&lt;/span&gt; &lt;span class="n"&gt;portfolio&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="n"&gt;The&lt;/span&gt; &lt;span class="n"&gt;firm&lt;/span&gt; &lt;span class="n"&gt;employs&lt;/span&gt; &lt;span class="n"&gt;sophisticated&lt;/span&gt; &lt;span class="n"&gt;algorithms&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;execute&lt;/span&gt; &lt;span class="n"&gt;trades&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;manage&lt;/span&gt; &lt;span class="n"&gt;risks&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;optimize&lt;/span&gt; &lt;span class="n"&gt;portfolio&lt;/span&gt; &lt;span class="n"&gt;performance&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;

&lt;span class="c1"&gt;### Trading Strategies
&lt;/span&gt;&lt;span class="n"&gt;BlackRock&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="n"&gt;algo&lt;/span&gt; &lt;span class="n"&gt;trading&lt;/span&gt; &lt;span class="n"&gt;strategies&lt;/span&gt; &lt;span class="n"&gt;include&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;

&lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;Index&lt;/span&gt; &lt;span class="n"&gt;Arbitrage&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="n"&gt;Exploiting&lt;/span&gt; &lt;span class="n"&gt;price&lt;/span&gt; &lt;span class="n"&gt;differences&lt;/span&gt; &lt;span class="n"&gt;between&lt;/span&gt; &lt;span class="n"&gt;index&lt;/span&gt; &lt;span class="n"&gt;futures&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;underlying&lt;/span&gt; &lt;span class="n"&gt;stocks&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;Mean&lt;/span&gt; &lt;span class="n"&gt;Reversion&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="n"&gt;Identifying&lt;/span&gt; &lt;span class="n"&gt;stocks&lt;/span&gt; &lt;span class="n"&gt;that&lt;/span&gt; &lt;span class="n"&gt;have&lt;/span&gt; &lt;span class="n"&gt;deviated&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;their&lt;/span&gt; &lt;span class="n"&gt;historical&lt;/span&gt; &lt;span class="n"&gt;price&lt;/span&gt; &lt;span class="n"&gt;patterns&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;betting&lt;/span&gt; &lt;span class="n"&gt;on&lt;/span&gt; &lt;span class="n"&gt;their&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;mean&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;Momentum&lt;/span&gt; &lt;span class="n"&gt;Trading&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="n"&gt;Capitalizing&lt;/span&gt; &lt;span class="n"&gt;on&lt;/span&gt; &lt;span class="n"&gt;stocks&lt;/span&gt; &lt;span class="n"&gt;that&lt;/span&gt; &lt;span class="n"&gt;show&lt;/span&gt; &lt;span class="n"&gt;strong&lt;/span&gt; &lt;span class="n"&gt;trends&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;particular&lt;/span&gt; &lt;span class="n"&gt;direction&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;

&lt;span class="c1"&gt;### Technology Stack
&lt;/span&gt;&lt;span class="n"&gt;BlackRock&lt;/span&gt; &lt;span class="n"&gt;uses&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;proprietary&lt;/span&gt; &lt;span class="n"&gt;trading&lt;/span&gt; &lt;span class="n"&gt;platform&lt;/span&gt; &lt;span class="n"&gt;called&lt;/span&gt; &lt;span class="n"&gt;Aladdin&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;which&lt;/span&gt; &lt;span class="n"&gt;integrates&lt;/span&gt; &lt;span class="n"&gt;risk&lt;/span&gt; &lt;span class="n"&gt;management&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;trading&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;portfolio&lt;/span&gt; &lt;span class="n"&gt;management&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="n"&gt;Aladdin&lt;/span&gt; &lt;span class="n"&gt;employs&lt;/span&gt; &lt;span class="n"&gt;advanced&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="n"&gt;analytics&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;machine&lt;/span&gt; &lt;span class="n"&gt;learning&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;cloud&lt;/span&gt; &lt;span class="n"&gt;computing&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;support&lt;/span&gt; &lt;span class="n"&gt;algo&lt;/span&gt; &lt;span class="n"&gt;trading&lt;/span&gt; &lt;span class="n"&gt;activities&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;

&lt;span class="c1"&gt;### Impact
&lt;/span&gt;&lt;span class="n"&gt;BlackRock&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="n"&gt;algorithmic&lt;/span&gt; &lt;span class="n"&gt;trading&lt;/span&gt; &lt;span class="n"&gt;has&lt;/span&gt; &lt;span class="n"&gt;significantly&lt;/span&gt; &lt;span class="n"&gt;enhanced&lt;/span&gt; &lt;span class="n"&gt;its&lt;/span&gt; &lt;span class="n"&gt;trading&lt;/span&gt; &lt;span class="n"&gt;efficiency&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;reduced&lt;/span&gt; &lt;span class="n"&gt;transaction&lt;/span&gt; &lt;span class="n"&gt;costs&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;improved&lt;/span&gt; &lt;span class="n"&gt;overall&lt;/span&gt; &lt;span class="n"&gt;portfolio&lt;/span&gt; &lt;span class="n"&gt;performance&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="n"&gt;The&lt;/span&gt; &lt;span class="n"&gt;firm&lt;/span&gt;&lt;span class="err"&gt;’&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="n"&gt;ability&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;execute&lt;/span&gt; &lt;span class="n"&gt;large&lt;/span&gt; &lt;span class="n"&gt;volumes&lt;/span&gt; &lt;span class="n"&gt;of&lt;/span&gt; &lt;span class="n"&gt;trades&lt;/span&gt; &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;minimal&lt;/span&gt; &lt;span class="n"&gt;market&lt;/span&gt; &lt;span class="n"&gt;impact&lt;/span&gt; &lt;span class="n"&gt;has&lt;/span&gt; &lt;span class="n"&gt;been&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;critical&lt;/span&gt; &lt;span class="n"&gt;factor&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;its&lt;/span&gt; &lt;span class="n"&gt;success&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;

&lt;span class="c1"&gt;### Real-World Example: Index Arbitrage on LSE
&lt;/span&gt;
&lt;span class="c1"&gt;#### Index Arbitrage Strategy:
&lt;/span&gt;&lt;span class="n"&gt;Assume&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;scenario&lt;/span&gt; &lt;span class="n"&gt;where&lt;/span&gt; &lt;span class="n"&gt;BlackRock&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="n"&gt;using&lt;/span&gt; &lt;span class="n"&gt;index&lt;/span&gt; &lt;span class="n"&gt;arbitrage&lt;/span&gt; &lt;span class="n"&gt;on&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;FTSE&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt; &lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="n"&gt;If&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;index&lt;/span&gt; &lt;span class="n"&gt;futures&lt;/span&gt; &lt;span class="n"&gt;price&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="n"&gt;trading&lt;/span&gt; &lt;span class="n"&gt;above&lt;/span&gt; &lt;span class="n"&gt;its&lt;/span&gt; &lt;span class="n"&gt;fair&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="n"&gt;compared&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;underlying&lt;/span&gt; &lt;span class="n"&gt;stocks&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;BlackRock&lt;/span&gt; &lt;span class="n"&gt;would&lt;/span&gt; &lt;span class="n"&gt;sell&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;futures&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;buy&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;underlying&lt;/span&gt; &lt;span class="n"&gt;stocks&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;

&lt;span class="c1"&gt;### Calculations:
&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;Fair&lt;/span&gt; &lt;span class="n"&gt;Value&lt;/span&gt; &lt;span class="n"&gt;of&lt;/span&gt; &lt;span class="n"&gt;Futures&lt;/span&gt;&lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; \&lt;span class="p"&gt;(&lt;/span&gt; \&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;Futures&lt;/span&gt; &lt;span class="n"&gt;Price&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; \&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;Spot&lt;/span&gt; &lt;span class="n"&gt;Price&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; \&lt;span class="nf"&gt;times &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; \&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;Risk&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Free&lt;/span&gt; &lt;span class="n"&gt;Rate&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; \&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;Dividend&lt;/span&gt; &lt;span class="n"&gt;Yield&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; \&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;Spot&lt;/span&gt; &lt;span class="n"&gt;Price&lt;/span&gt;&lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Current&lt;/span&gt; &lt;span class="n"&gt;price&lt;/span&gt; &lt;span class="n"&gt;of&lt;/span&gt; &lt;span class="n"&gt;the&lt;/span&gt; &lt;span class="n"&gt;underlying&lt;/span&gt; &lt;span class="n"&gt;index&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;Risk&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;Free&lt;/span&gt; &lt;span class="n"&gt;Rate&lt;/span&gt;&lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Assume&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;risk&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;free&lt;/span&gt; &lt;span class="n"&gt;rate&lt;/span&gt; &lt;span class="n"&gt;of&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;Dividend&lt;/span&gt; &lt;span class="n"&gt;Yield&lt;/span&gt;&lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Assume&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;dividend&lt;/span&gt; &lt;span class="k"&gt;yield&lt;/span&gt; &lt;span class="n"&gt;of&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="o"&gt;%&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;Time&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="nc"&gt;Maturity &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Assume&lt;/span&gt; &lt;span class="mf"&gt;0.5&lt;/span&gt; &lt;span class="n"&gt;years&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;

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

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
python&lt;br&gt;
spot_price = 7000  # Current spot price of FTSE 100&lt;br&gt;
risk_free_rate = 0.02&lt;br&gt;
dividend_yield = 0.03&lt;br&gt;
T = 0.5&lt;/p&gt;

&lt;p&gt;fair_value = spot_price * (1 + risk_free_rate - dividend_yield) ** T&lt;br&gt;
print(f"Fair Value of Futures: {fair_value:.2f}")&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
### Impact:
If the actual futures price is significantly higher than the fair value, BlackRock can capitalize on this discrepancy by executing the arbitrage strategy.

## Case Study: Tower Research

### Overview
Tower Research Capital, a leading HFT firm, is renowned for its low-latency trading strategies. The firm employs cutting-edge technology and sophisticated algorithms to trade across various asset classes.

### Trading Strategies
Tower Research’s strategies include:

- **Statistical Arbitrage:** Using statistical models to identify and exploit price discrepancies between related financial instruments.
- **Market Making:** Providing liquidity by continuously quoting buy and sell prices and profiting from the bid-ask spread.
- **Event-Driven Trading:** Trading based on news events, earnings announcements, and economic data releases.

### Technology Stack
Tower Research invests heavily in low-latency infrastructure. The firm uses custom-built hardware, co-located servers, and high-speed communication networks to achieve ultra-fast trade execution.

### Impact
Tower Research’s focus on low latency has enabled it to gain a competitive edge in the market. The firm’s ability to execute trades within microseconds has resulted in consistent profitability and significant market share in the HFT space.

### Real-World Example: Statistical Arbitrage on SGX

#### Statistical Arbitrage Strategy:
Assume a scenario where Tower Research is using statistical arbitrage to trade pairs of stocks on the SGX. If stock A and stock B are typically correlated but have diverged, Tower Research can buy the underperforming stock and short the outperforming stock, expecting them to revert to their mean correlation.

### Calculations:
- **Z-Score Calculation**: \( Z = \frac{\text{Price Spread} - \mu}{\sigma} \)
- **Price Spread**: Difference between the prices of stock A and stock B.
- **Mean (\(\mu\)) and Standard Deviation (\(\sigma\)) of Price Spread**: Calculated based on historical data.

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

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
python&lt;br&gt;
spread = data['stock_A'] - data['stock_B']&lt;br&gt;
mean_spread = spread.mean()&lt;br&gt;
std_spread = spread.std()&lt;br&gt;
z_score = (spread - mean_spread) / std_spread&lt;/p&gt;

&lt;p&gt;data['z_score'] = z_score&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
### Trading Signals:
- **Buy Signal**: If Z-Score &amp;lt; -1.0 (Buy stock A and short stock B).
- **Sell Signal**: If Z-Score &amp;gt; 1.0 (Sell stock A and buy stock B).

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

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
python&lt;br&gt;
data['signal'] = 0.0&lt;br&gt;
data['signal'][data['z_score'] &amp;lt; -1] = 1.0&lt;br&gt;
data['signal'][data['z_score'] &amp;gt; 1] = -1.0&lt;/p&gt;



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


### Impact:
By implementing statistical arbitrage, Tower Research can profit from temporary deviations in the prices of correlated stocks.

## Conclusion

Algorithmic trading and quants have revolutionized the financial markets, enabling firms to execute trades with speed, precision, and efficiency. The cases of BlackRock and Tower Research highlight the diverse applications and impact of algo trading in the industry. Real-world examples from the LSE and SGX illustrate how these strategies can be applied and the calculations involved. As technology continues to evolve, the role of quants and the sophistication of algorithmic trading systems are expected to grow, further transforming the landscape of financial markets.

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

&lt;/div&gt;

</description>
      <category>quant</category>
      <category>webdev</category>
      <category>coding</category>
      <category>software</category>
    </item>
    <item>
      <title>BharatGPT: The Next Generation AI Language Model</title>
      <dc:creator>Syed Nashet Ali</dc:creator>
      <pubDate>Sat, 15 Jun 2024 20:50:44 +0000</pubDate>
      <link>https://dev.to/nashetking/bharatgpt-the-next-generation-ai-language-model-296c</link>
      <guid>https://dev.to/nashetking/bharatgpt-the-next-generation-ai-language-model-296c</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8znb74u1pq2p79ldrd7i.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8znb74u1pq2p79ldrd7i.jpg" alt="BharatGpt" width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
BharatGPT represents a monumental stride in the field of natural language processing (NLP) and AI, tailored specifically to understand and generate text in multiple Indian languages with contextual accuracy and cultural relevance. This blog delves into the technical intricacies, working mechanisms, deployment strategies, hardware design, and the collaborative efforts behind BharatGPT, including key contributions from Jio and the Indian Institutes of Technology (IITs).&lt;/p&gt;
&lt;h2&gt;
  
  
  Technical Foundation
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Model Architecture
&lt;/h3&gt;

&lt;p&gt;BharatGPT is built upon the GPT-4 architecture, leveraging transformer models which utilize self-attention mechanisms to process and generate human-like text. The model comprises:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Encoder-Decoder Layers&lt;/strong&gt;: Multiple layers of encoders and decoders that process the input text, capturing intricate patterns and contextual information.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Attention Mechanisms&lt;/strong&gt;: Self-attention and cross-attention mechanisms that help the model focus on relevant parts of the input sequence, enhancing its understanding of context and relationships between words.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The architecture can be broken down into:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Embedding Layer&lt;/strong&gt;: Converts input tokens into dense vectors of fixed size.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Positional Encoding&lt;/strong&gt;: Adds positional information to the embeddings to help the model understand the order of tokens.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multi-Head Attention&lt;/strong&gt;: Computes attention scores across different heads, allowing the model to focus on various parts of the input.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Feedforward Neural Networks&lt;/strong&gt;: Processes the attention outputs, applying transformations to capture complex patterns.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Layer Normalization and Residual Connections&lt;/strong&gt;: Stabilizes and accelerates training.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;
  
  
  Multilingual Training
&lt;/h3&gt;

&lt;p&gt;The model is trained on a diverse corpus containing text in Hindi, Tamil, Bengali, Telugu, Marathi, and other Indian languages. This multilingual training involves:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Tokenization&lt;/strong&gt;: Utilizing a subword tokenization approach (Byte Pair Encoding or BPE) to handle the diverse scripts and linguistic structures.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pre-training&lt;/strong&gt;: Extensive pre-training on a vast dataset, including books, articles, social media content, and more, to capture linguistic nuances and cultural context.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fine-tuning&lt;/strong&gt;: Specific fine-tuning tasks to adapt the model for various applications such as translation, summarization, and question-answering.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Calculations and Parameters
&lt;/h3&gt;

&lt;p&gt;BharatGPT involves a significant number of parameters to ensure its robustness:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Number of Layers (L)&lt;/strong&gt;: 48 layers&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Embedding Dimension (d_model)&lt;/strong&gt;: 1600 dimensions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Number of Attention Heads (h)&lt;/strong&gt;: 20 heads&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Feedforward Dimension (d_ff)&lt;/strong&gt;: 6400 dimensions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Total Parameters&lt;/strong&gt;: Approximately 175 billion parameters&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The calculations for the self-attention mechanism are given by:&lt;/p&gt;

&lt;p&gt;[ \text{Attention}(Q, K, V) = \text{softmax}\left(\frac{QK^T}{\sqrt{d_k}}\right) V ]&lt;/p&gt;

&lt;p&gt;Where:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;( Q ) (Query), ( K ) (Key), and ( V ) (Value) are derived from the input embeddings.&lt;/li&gt;
&lt;li&gt;( d_k ) is the dimension of the key vectors.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The multi-head attention mechanism can be expressed as:&lt;/p&gt;

&lt;p&gt;[ \text{MultiHead}(Q, K, V) = \text{Concat}(\text{head}_1, \ldots, \text{head}_h)W^O ]&lt;/p&gt;

&lt;p&gt;Where each head is computed as:&lt;/p&gt;

&lt;p&gt;[ \text{head}_i = \text{Attention}(QW_i^Q, KW_i^K, VW_i^V) ]&lt;/p&gt;

&lt;p&gt;( W_i^Q ), ( W_i^K ), ( W_i^V ), and ( W^O ) are learned weight matrices.&lt;/p&gt;
&lt;h2&gt;
  
  
  Working Mechanisms
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Text Generation
&lt;/h3&gt;

&lt;p&gt;The core of BharatGPT's functionality lies in its ability to generate coherent and contextually relevant text. This involves:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Input Processing&lt;/strong&gt;: The input text is tokenized and passed through the encoder layers, where self-attention mechanisms help in understanding the context.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Contextual Embeddings&lt;/strong&gt;: The model generates contextual embeddings for each token, capturing its meaning in relation to surrounding words.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Decoding&lt;/strong&gt;: Using these embeddings, the decoder generates the output sequence, one token at a time, while maintaining contextual coherence.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;
  
  
  Conversational AI
&lt;/h3&gt;

&lt;p&gt;BharatGPT excels in conversational AI, making it suitable for chatbots and virtual assistants. It handles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Dialogue Management&lt;/strong&gt;: Maintaining context across turns in a conversation, ensuring relevant and consistent responses.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Intent Recognition&lt;/strong&gt;: Identifying user intents and providing appropriate responses or actions.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Behind the Scenes
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Model Deployment
&lt;/h3&gt;

&lt;p&gt;Deploying BharatGPT involves several critical steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Infrastructure Setup&lt;/strong&gt;: Utilizing cloud platforms like AWS, Azure, or GCP to provide scalable computing resources.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Containerization&lt;/strong&gt;: Using Docker to create portable and consistent environments for the model.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Orchestration&lt;/strong&gt;: Employing Kubernetes for automating deployment, scaling, and managing containerized applications.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;
  
  
  Hardware Design
&lt;/h3&gt;

&lt;p&gt;BharatGPT's deployment demands high-performance hardware to ensure efficient processing and quick response times:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GPUs&lt;/strong&gt;: Leveraging NVIDIA A100 GPUs for their parallel processing capabilities, essential for handling the large-scale computations involved in running transformer models.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TPUs&lt;/strong&gt;: Google’s Tensor Processing Units (TPUs) are also used for accelerating machine learning workloads, providing an alternative to GPUs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Custom Hardware&lt;/strong&gt;: Exploring custom ASICs (Application-Specific Integrated Circuits) tailored for specific NLP tasks to further enhance performance.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Architecture Diagram
&lt;/h3&gt;

&lt;p&gt;Below is a simplified architecture diagram for BharatGPT:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                          +----------------------+
                          |   Input Tokenizer    |
                          +----------+-----------+
                                     |
                                     v
                          +----------------------+
                          |    Embedding Layer   |
                          +----------+-----------+
                                     |
                                     v
                          +----------------------+
                          |  Positional Encoding |
                          +----------+-----------+
                                     |
                                     v
              +----------------------+---------------------+
              | Multi-Head Self-Attention (Multi-Layers)  |
              +----------------------+---------------------+
                                     |
                                     v
              +----------------------+---------------------+
              | Feedforward Neural Networks (Multi-Layers) |
              +----------------------+---------------------+
                                     |
                                     v
                          +----------------------+
                          |   Output Decoder     |
                          +----------+-----------+
                                     |
                                     v
                          +----------------------+
                          |    Output Tokens     |
                          +----------------------+
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  API Integration
&lt;/h2&gt;

&lt;p&gt;To facilitate easy integration into various applications, BharatGPT offers robust APIs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;RESTful APIs&lt;/strong&gt;: Providing endpoints for text generation, language translation, summarization, and more.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GraphQL APIs&lt;/strong&gt;: Allowing more flexible and efficient queries, suitable for complex applications.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SDKs&lt;/strong&gt;: Software Development Kits (SDKs) for popular programming languages like Python, JavaScript, and Java to simplify integration.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Collaborative Efforts
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Development Team
&lt;/h3&gt;

&lt;p&gt;BharatGPT is the result of a collaborative effort involving:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Data Scientists and NLP Researchers&lt;/strong&gt;: Leading the research and development of the model, fine-tuning algorithms, and ensuring linguistic diversity.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Software Engineers&lt;/strong&gt;: Handling the implementation, optimization, and deployment of the model.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Linguists and Cultural Experts&lt;/strong&gt;: Providing insights into linguistic nuances and cultural contexts to enhance the model's relevance and accuracy.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Jio's Contribution
&lt;/h3&gt;

&lt;p&gt;Reliance Jio, one of India's largest telecommunications companies, played a crucial role in the development and deployment of BharatGPT:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Data Infrastructure&lt;/strong&gt;: Jio provided robust data infrastructure and cloud services, ensuring scalable and reliable computing resources for training and deploying the model.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Connectivity&lt;/strong&gt;: Leveraging Jio's extensive network to enable widespread access to BharatGPT, particularly in rural and underserved areas.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Research Collaboration&lt;/strong&gt;: Partnering with academic institutions and providing funding and resources for cutting-edge research in NLP and AI.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  IITs' Involvement
&lt;/h3&gt;

&lt;p&gt;The Indian Institutes of Technology (IITs) were instrumental in the research and development of BharatGPT:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Expertise&lt;/strong&gt;: Leading researchers and professors from IITs contributed their expertise in machine learning, NLP, and data science.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Data Curation&lt;/strong&gt;: Collaborating on the collection and curation of diverse linguistic datasets, ensuring comprehensive coverage of Indian languages.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Algorithm Development&lt;/strong&gt;: Developing and refining algorithms to enhance the model's performance and accuracy, especially for complex linguistic structures unique to Indian languages.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;BharatGPT stands as a testament to the advancements in AI and NLP, tailored specifically for the rich and diverse linguistic landscape of India. With cutting-edge technology, robust deployment strategies, and a dedicated team of experts, BharatGPT is poised to revolutionize how AI interacts with and understands Indian languages. Whether it's for conversational AI, content generation, or language translation, BharatGPT offers unparalleled capabilities, making it an invaluable tool in the digital transformation of India.&lt;/p&gt;

&lt;p&gt;The collaboration between industry leaders like Jio and academic powerhouses like the IITs underscores the importance of synergy in technological innovation. Together, they have not only created a powerful AI model but also paved the way for future advancements that will continue to drive India's technological progress.&lt;/p&gt;

</description>
      <category>llm</category>
      <category>webdev</category>
      <category>ai</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Adani One Super App: System Design Unlocked</title>
      <dc:creator>Syed Nashet Ali</dc:creator>
      <pubDate>Thu, 06 Jun 2024 13:15:21 +0000</pubDate>
      <link>https://dev.to/nashetking/adani-one-super-app-system-design-unlocked-4mel</link>
      <guid>https://dev.to/nashetking/adani-one-super-app-system-design-unlocked-4mel</guid>
      <description>&lt;p&gt;&lt;a href="https://g.co/kgs/TBFNgE3" rel="noopener noreferrer"&gt;Adani One Super App&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The digital age demands convenience and efficiency, and super apps are becoming the cornerstone of this transformation. Adani One is envisioned to be a super app that integrates multiple services, from e-commerce and travel bookings to utilities and customer support, into a single platform. In this blog, we'll unlock the system design of the Adani One super app, focusing on architecture, scalability, and security.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding Super Apps
&lt;/h2&gt;

&lt;p&gt;A super app is a platform that offers a wide range of services under one roof. Instead of switching between different apps for various needs, users can access everything from payments and travel bookings to customer support and social interactions in one place.&lt;/p&gt;

&lt;h2&gt;
  
  
  System Design Overview
&lt;/h2&gt;

&lt;p&gt;Designing a super app involves multiple layers of complexity, including user management, service integration, real-time notifications, and security. Let’s dive into the details.&lt;/p&gt;

&lt;h3&gt;
  
  
  Architecture
&lt;/h3&gt;

&lt;p&gt;The architecture of the Adani One super app is based on a microservices approach, ensuring modularity, scalability, and maintainability.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Microservices Architecture:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Authentication Service:&lt;/strong&gt; Handles user registration, login, and token management.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Payment Service:&lt;/strong&gt; Manages transactions, payment gateways, and wallet functionalities.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Service Discovery Service:&lt;/strong&gt; Provides listings for various services like flights, hotels, etc.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Booking Service:&lt;/strong&gt; Manages reservations and bookings.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Notification Service:&lt;/strong&gt; Sends real-time notifications.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Search Service:&lt;/strong&gt; Handles user search queries.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Customer Support Service:&lt;/strong&gt; Manages chat and support interactions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;User Profile Service:&lt;/strong&gt; Manages user data and preferences.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Review and Rating Service:&lt;/strong&gt; Handles user reviews and ratings.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;API Gateway:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Serves as a single entry point for all client requests, routing them to the appropriate microservices. It also provides functionalities like rate limiting, caching, and logging.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Database Layer:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Relational Databases:&lt;/strong&gt; For transactional data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;NoSQL Databases:&lt;/strong&gt; For flexible data storage.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;In-Memory Databases:&lt;/strong&gt; For caching and session management.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Messaging and Event Streaming:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Message Broker:&lt;/strong&gt; For asynchronous communication between microservices.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Event Streaming:&lt;/strong&gt; For real-time data processing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Data Analytics and Reporting:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Data Warehouse:&lt;/strong&gt; For storing and querying large datasets.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ETL Pipeline:&lt;/strong&gt; For data extraction, transformation, and loading.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Analytics Tools:&lt;/strong&gt; For generating reports and dashboards.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  High-Level Architecture Diagram
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fexample.com%2Farchitecture-diagram.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fexample.com%2Farchitecture-diagram.png" alt="Adani One Super App Architecture"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Scalability
&lt;/h2&gt;

&lt;p&gt;Scalability is crucial for handling millions of users and ensuring smooth performance. Here’s how we achieve it:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Horizontal Scaling:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Deploy each microservice independently, allowing specific components to scale based on demand.&lt;/li&gt;
&lt;li&gt;Use Kubernetes to manage containerized microservices, enabling automatic scaling.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Load Balancing:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Implement load balancing at the API gateway and service levels to distribute traffic evenly.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Auto-scaling:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use Kubernetes Horizontal Pod Autoscaler (HPA) and cloud provider auto-scaling features to adjust resources based on demand.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Caching:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use in-memory databases like Redis for caching frequently accessed data.&lt;/li&gt;
&lt;li&gt;Employ a CDN for caching static assets closer to users.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Event-Driven Architecture:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use message brokers like RabbitMQ for decoupling services and handling asynchronous communication.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Database Replication:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Implement master-slave replication and multi-region deployment for high availability and disaster recovery.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Detailed Scalability Calculations
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Example Scenario: Handling Peak Traffic&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Assume the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Average user makes 5 requests per session.&lt;/li&gt;
&lt;li&gt;Peak traffic: 1 million users per hour.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Calculations:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Total requests per hour: (1,000,000 \text{ users/hour} \times 5 \text{ requests/user} = 5,000,000 \text{ requests/hour})&lt;/li&gt;
&lt;li&gt;Requests per second (RPS): (\frac{5,000,000}{3600} \approx 1389 \text{ RPS})&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To handle this load:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Deploy API Gateway instances capable of handling 500 RPS each: ( \frac{1389}{500} \approx 3 \text{ instances} )&lt;/li&gt;
&lt;li&gt;Scale microservices similarly based on their respective load profiles.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Kubernetes Configuration for Auto-Scaling:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here's a sample configuration for setting up Horizontal Pod Autoscaling in Kubernetes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;autoscaling/v1&lt;/span&gt;
&lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;HorizontalPodAutoscaler&lt;/span&gt;
&lt;span class="na"&gt;metadata&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;my-microservice-hpa&lt;/span&gt;
  &lt;span class="na"&gt;namespace&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;my-namespace&lt;/span&gt;
&lt;span class="na"&gt;spec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;scaleTargetRef&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;apiVersion&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;apps/v1&lt;/span&gt;
    &lt;span class="na"&gt;kind&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Deployment&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;my-microservice&lt;/span&gt;
  &lt;span class="na"&gt;minReplicas&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt;
  &lt;span class="na"&gt;maxReplicas&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10&lt;/span&gt;
  &lt;span class="na"&gt;targetCPUUtilizationPercentage&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;80&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This configuration ensures that the deployment named &lt;code&gt;my-microservice&lt;/code&gt; scales between 2 and 10 replicas based on CPU utilization.&lt;/p&gt;

&lt;h2&gt;
  
  
  Security
&lt;/h2&gt;

&lt;p&gt;Security is paramount for protecting user data and maintaining trust. Here’s how we ensure robust security:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Authentication and Authorization:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use OAuth 2.0 and OpenID Connect for secure authentication.&lt;/li&gt;
&lt;li&gt;Implement JWT for secure, stateless token management.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Data Encryption:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Encrypt data in transit using TLS/SSL.&lt;/li&gt;
&lt;li&gt;Encrypt data at rest in databases and storage.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Access Control:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Implement RBAC to manage permissions based on user roles.&lt;/li&gt;
&lt;li&gt;Use ABAC for fine-grained access control.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;API Security:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enforce rate limiting, IP whitelisting/blacklisting, and request validation at the API gateway.&lt;/li&gt;
&lt;li&gt;Validate and sanitize inputs to prevent injection attacks.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Monitoring and Logging:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Maintain comprehensive audit logs for critical operations.&lt;/li&gt;
&lt;li&gt;Use SIEM tools for security monitoring and threat detection.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Compliance:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Ensure compliance with GDPR, CCPA, and other data protection regulations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Incident Response:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Develop an incident response plan for quick mitigation of security incidents.&lt;/li&gt;
&lt;li&gt;Implement regular backups and disaster recovery plans.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Code Snippets for Security
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;JWT Authentication Middleware in Node.js:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;jwt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;jsonwebtoken&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;authenticateToken&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;next&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;token&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;header&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Authorization&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt; &lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;token&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sendStatus&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;401&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="nx"&gt;jwt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;verify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;token&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ACCESS_TOKEN_SECRET&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sendStatus&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;403&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nf"&gt;next&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;authenticateToken&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Encryption in Transit (TLS/SSL) Configuration for Nginx:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight nginx"&gt;&lt;code&gt;&lt;span class="k"&gt;server&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kn"&gt;listen&lt;/span&gt; &lt;span class="mi"&gt;443&lt;/span&gt; &lt;span class="s"&gt;ssl&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kn"&gt;server_name&lt;/span&gt; &lt;span class="s"&gt;example.com&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="kn"&gt;ssl_certificate&lt;/span&gt; &lt;span class="n"&gt;/etc/nginx/ssl/nginx.crt&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kn"&gt;ssl_certificate_key&lt;/span&gt; &lt;span class="n"&gt;/etc/nginx/ssl/nginx.key&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="kn"&gt;ssl_protocols&lt;/span&gt; &lt;span class="s"&gt;TLSv1.2&lt;/span&gt; &lt;span class="s"&gt;TLSv1.3&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kn"&gt;ssl_ciphers&lt;/span&gt; &lt;span class="s"&gt;HIGH:!aNULL:!MD5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="kn"&gt;location&lt;/span&gt; &lt;span class="n"&gt;/&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kn"&gt;proxy_pass&lt;/span&gt; &lt;span class="s"&gt;http://localhost:3000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kn"&gt;proxy_set_header&lt;/span&gt; &lt;span class="s"&gt;Host&lt;/span&gt; &lt;span class="nv"&gt;$host&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kn"&gt;proxy_set_header&lt;/span&gt; &lt;span class="s"&gt;X-Real-IP&lt;/span&gt; &lt;span class="nv"&gt;$remote_addr&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kn"&gt;proxy_set_header&lt;/span&gt; &lt;span class="s"&gt;X-Forwarded-For&lt;/span&gt; &lt;span class="nv"&gt;$proxy_add_x_forwarded_for&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="kn"&gt;proxy_set_header&lt;/span&gt; &lt;span class="s"&gt;X-Forwarded-Proto&lt;/span&gt; &lt;span class="nv"&gt;$scheme&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The Adani One super app is designed to be a robust, scalable, and secure platform, offering a seamless experience to users while integrating a multitude of services. By leveraging a microservices architecture, horizontal scaling, and stringent security measures, the app is well-equipped to handle high traffic and protect user data.&lt;/p&gt;

&lt;p&gt;Building a super app is a complex but rewarding endeavor, requiring meticulous planning and execution. With the right design and architecture, Adani One is poised to become a cornerstone of digital convenience.&lt;/p&gt;

&lt;p&gt;Feel free to share your thoughts and feedback in the comments. Let's discuss and unlock the potential of super apps together!&lt;/p&gt;




&lt;p&gt;This enhanced blog post includes more details, code snippets, and calculations to provide a comprehensive guide to designing the Adani One super app.&lt;/p&gt;

</description>
      <category>restapi</category>
      <category>api</category>
      <category>systemdesign</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Azure Cloud &amp; Container Security Best Practices</title>
      <dc:creator>Syed Nashet Ali</dc:creator>
      <pubDate>Sun, 26 Nov 2023 05:35:43 +0000</pubDate>
      <link>https://dev.to/nashetking/azure-cloud-container-security-best-practices-10o5</link>
      <guid>https://dev.to/nashetking/azure-cloud-container-security-best-practices-10o5</guid>
      <description>&lt;p&gt;With a total market share that hovers north of 20 percent, the Microsoft Azure cloud has grown into a top contender in the public cloud computing market in recent years. At the same time, Azure cloud security has become a top contender for more and more businesses.&lt;/p&gt;

&lt;p&gt;Although Azure security boils down to the same practices and principles as security on any major public cloud platform in most ways, there are some important distinctions and nuances to know about when devising an Azure security strategy. Keep reading for an overview of these details as we unpack the fundamentals of Azure cloud security, followed by a discussion of Azure security best practices.&lt;/p&gt;

&lt;p&gt;Azure’s Shared Responsibility Model&lt;br&gt;
Like all public clouds, Azure uses a shared responsibility model to define which security tasks fall to customers and which ones Azure handles. Understanding shared responsibility concepts in Azure is the first step in building an Azure cloud security strategy that allows you to manage the security responsibilities Azure doesn’t oversee within your cloud environments.&lt;/p&gt;

&lt;p&gt;Azure spells out the details of its shared responsibility model here, but they can be summarized as follows:&lt;/p&gt;

&lt;p&gt;Azure assumes most security responsibilities for SaaS offerings, with the exception of customer-created data or applications customers deploy on a SaaS service.&lt;br&gt;
Customers share responsibility with Azure for securing workloads deployed on Azure PaaS services. In this context, Azure secures the underlying physical infrastructure, but most responsibilities related to networking and Identity and Access Management (IAM) fall to customers.&lt;br&gt;
On Azure IaaS services, customers handle most security tasks. The exception is the underlying physical infrastructure, which Azure secures.&lt;br&gt;
If customers integrate on-premises infrastructure, applications, or data with Azure via one of Azure’s hybrid cloud frameworks (such as Azure Stack or Azure Arc), customers bear full responsibility for securing on-premises resources.&lt;br&gt;
If you’re familiar with cloud shared responsibility models in general, all the above should be unsurprising. Azure’s shared responsibility architecture is very consistent with the models embraced by other major public cloud providers. &lt;/p&gt;

&lt;p&gt;Sysdig&lt;br&gt;
Search Cloud Native...&lt;br&gt;
OVERVIEW&lt;br&gt;
Azure Cloud &amp;amp; Container Security Best Practices&lt;br&gt;
SHARE:&lt;/p&gt;

&lt;p&gt;CONTENT&lt;/p&gt;

&lt;p&gt;With a total market share that hovers north of 20 percent, the Microsoft Azure cloud has grown into a top contender in the public cloud computing market in recent years. At the same time, Azure cloud security has become a top contender for more and more businesses.&lt;/p&gt;

&lt;p&gt;Although Azure security boils down to the same practices and principles as security on any major public cloud platform in most ways, there are some important distinctions and nuances to know about when devising an Azure security strategy. Keep reading for an overview of these details as we unpack the fundamentals of Azure cloud security, followed by a discussion of Azure security best practices.&lt;/p&gt;

&lt;p&gt;Azure’s Shared Responsibility Model&lt;br&gt;
Like all public clouds, Azure uses a shared responsibility model to define which security tasks fall to customers and which ones Azure handles. Understanding shared responsibility concepts in Azure is the first step in building an Azure cloud security strategy that allows you to manage the security responsibilities Azure doesn’t oversee within your cloud environments.&lt;/p&gt;

&lt;p&gt;Azure spells out the details of its shared responsibility model here, but they can be summarized as follows:&lt;/p&gt;

&lt;p&gt;Azure assumes most security responsibilities for SaaS offerings, with the exception of customer-created data or applications customers deploy on a SaaS service.&lt;br&gt;
Customers share responsibility with Azure for securing workloads deployed on Azure PaaS services. In this context, Azure secures the underlying physical infrastructure, but most responsibilities related to networking and Identity and Access Management (IAM) fall to customers.&lt;br&gt;
On Azure IaaS services, customers handle most security tasks. The exception is the underlying physical infrastructure, which Azure secures.&lt;br&gt;
If customers integrate on-premises infrastructure, applications, or data with Azure via one of Azure’s hybrid cloud frameworks (such as Azure Stack or Azure Arc), customers bear full responsibility for securing on-premises resources.&lt;br&gt;
If you’re familiar with cloud shared responsibility models in general, all the above should be unsurprising. Azure’s shared responsibility architecture is very consistent with the models embraced by other major public cloud providers. &lt;/p&gt;

&lt;p&gt;Azure Cloud Security Best Practices&lt;br&gt;
Once you’ve identified the security responsibilities that fall to you based on which types of Azure cloud services you consume, you can plan an Azure security strategy that allows you to meet your security obligations.&lt;/p&gt;

&lt;p&gt;Standard Cloud Security Best Practices&lt;br&gt;
Many of the best practices you’ll want to follow in this respect are standard fare for securing any major public cloud environment. They include:&lt;/p&gt;

&lt;p&gt;Use IAM: Identity and Access Management, or IAM, is a fundamental tool for securing workloads in any public cloud. If you use Azure, be sure to make full use of its IAM framework to manage access to your cloud resources based on the principle of least privilege. As we discuss below, Azure IAM works a little differently from other cloud IAMs because it is based on Active Directory, but you can nonetheless achieve the same granular access control configurations on Azure that you could enforce on any major public cloud. For example, this Azure IAM role example creates a role that can monitor and restart virtual machines:&lt;br&gt;
{&lt;br&gt;
  "Name": "Virtual Machine Operator",&lt;br&gt;
  "Id": "88888888-8888-8888-8888-888888888888",&lt;br&gt;
  "IsCustom": true,&lt;br&gt;
  "Description": "Can monitor and restart virtual machines.",&lt;br&gt;
  "Actions": [&lt;br&gt;
    "Microsoft.Storage/&lt;em&gt;/read",&lt;br&gt;
    "Microsoft.Network/&lt;/em&gt;/read",&lt;br&gt;
    "Microsoft.Compute/&lt;em&gt;/read",&lt;br&gt;
    "Microsoft.Compute/virtualMachines/start/action",&lt;br&gt;
    "Microsoft.Compute/virtualMachines/restart/action",&lt;br&gt;
    "Microsoft.Authorization/&lt;/em&gt;/read",&lt;br&gt;
    "Microsoft.ResourceHealth/availabilityStatuses/read",&lt;br&gt;
    "Microsoft.Resources/subscriptions/resourceGroups/read",&lt;br&gt;
    "Microsoft.Insights/alertRules/&lt;em&gt;",&lt;br&gt;
    "Microsoft.Insights/diagnosticSettings/&lt;/em&gt;",&lt;br&gt;
    "Microsoft.Support/*"&lt;br&gt;
  ],&lt;br&gt;
  "NotActions": [],&lt;br&gt;
  "DataActions": [],&lt;br&gt;
  "NotDataActions": [],&lt;br&gt;
  "AssignableScopes": [&lt;br&gt;
    "/subscriptions/{subscriptionId1}",&lt;br&gt;
    "/subscriptions/{subscriptionId2}",&lt;br&gt;
    "/providers/Microsoft.Management/managementGroups/{groupId1}"&lt;br&gt;
  ]&lt;br&gt;
}&lt;br&gt;
Code language: JSON / JSON with Comments (json)&lt;br&gt;
Isolate cloud networks: Where possible, use Azure virtual networks and private clouds to isolate your cloud environments at the network level. These services aren’t available for every type of Azure workload, but most IaaS- and PaaS- based workloads (and some SaaS-based workloads as well) can be isolated in private networks or virtual private clouds.&lt;br&gt;
Use cloud tags: Like most other clouds, Azure lets you label and organize resources using tags. Although cloud resources that lack tags are not necessarily insecure, tags are beneficial from a security perspective because they make it easier to keep track of which cloud resources you have running and where. In turn, they help ensure that you don’t overlook some workloads when configuring access controls, auditing your cloud environment, and so on.&lt;br&gt;
Secure Azure data: In addition to using Azure IAM to manage access to data that you store in Azure Blob Storage or other storage services within Azure, you should encrypt your cloud data as well as the transport layers that you use to access data. Azure also offers a storage account “lock” feature, which is useful for preventing unauthorized tampering with cloud data.&lt;/p&gt;

&lt;p&gt;Don’t miss our fireside chat with our CEO Suresh Vasudevan!   Learn More&lt;br&gt;
When Seconds Count: Expanding Real-Time Capabilities Across CNAPP  Learn More&lt;br&gt;
Sysdig&lt;br&gt;
Search Cloud Native...&lt;br&gt;
OVERVIEW&lt;br&gt;
Azure Cloud &amp;amp; Container Security Best Practices&lt;br&gt;
SHARE:&lt;/p&gt;

&lt;p&gt;CONTENT&lt;/p&gt;

&lt;p&gt;With a total market share that hovers north of 20 percent, the Microsoft Azure cloud has grown into a top contender in the public cloud computing market in recent years. At the same time, Azure cloud security has become a top contender for more and more businesses.&lt;/p&gt;

&lt;p&gt;Although Azure security boils down to the same practices and principles as security on any major public cloud platform in most ways, there are some important distinctions and nuances to know about when devising an Azure security strategy. Keep reading for an overview of these details as we unpack the fundamentals of Azure cloud security, followed by a discussion of Azure security best practices.&lt;/p&gt;

&lt;p&gt;Azure’s Shared Responsibility Model&lt;br&gt;
Like all public clouds, Azure uses a shared responsibility model to define which security tasks fall to customers and which ones Azure handles. Understanding shared responsibility concepts in Azure is the first step in building an Azure cloud security strategy that allows you to manage the security responsibilities Azure doesn’t oversee within your cloud environments.&lt;/p&gt;

&lt;p&gt;Azure spells out the details of its shared responsibility model here, but they can be summarized as follows:&lt;/p&gt;

&lt;p&gt;Azure assumes most security responsibilities for SaaS offerings, with the exception of customer-created data or applications customers deploy on a SaaS service.&lt;br&gt;
Customers share responsibility with Azure for securing workloads deployed on Azure PaaS services. In this context, Azure secures the underlying physical infrastructure, but most responsibilities related to networking and Identity and Access Management (IAM) fall to customers.&lt;br&gt;
On Azure IaaS services, customers handle most security tasks. The exception is the underlying physical infrastructure, which Azure secures.&lt;br&gt;
If customers integrate on-premises infrastructure, applications, or data with Azure via one of Azure’s hybrid cloud frameworks (such as Azure Stack or Azure Arc), customers bear full responsibility for securing on-premises resources.&lt;br&gt;
If you’re familiar with cloud shared responsibility models in general, all the above should be unsurprising. Azure’s shared responsibility architecture is very consistent with the models embraced by other major public cloud providers. &lt;/p&gt;

&lt;p&gt;Azure Cloud Security Best Practices&lt;br&gt;
Once you’ve identified the security responsibilities that fall to you based on which types of Azure cloud services you consume, you can plan an Azure security strategy that allows you to meet your security obligations.&lt;/p&gt;

&lt;p&gt;Standard Cloud Security Best Practices&lt;br&gt;
Many of the best practices you’ll want to follow in this respect are standard fare for securing any major public cloud environment. They include:&lt;/p&gt;

&lt;p&gt;Use IAM: Identity and Access Management, or IAM, is a fundamental tool for securing workloads in any public cloud. If you use Azure, be sure to make full use of its IAM framework to manage access to your cloud resources based on the principle of least privilege. As we discuss below, Azure IAM works a little differently from other cloud IAMs because it is based on Active Directory, but you can nonetheless achieve the same granular access control configurations on Azure that you could enforce on any major public cloud. For example, this Azure IAM role example creates a role that can monitor and restart virtual machines:&lt;br&gt;
{&lt;br&gt;
  "Name": "Virtual Machine Operator",&lt;br&gt;
  "Id": "88888888-8888-8888-8888-888888888888",&lt;br&gt;
  "IsCustom": true,&lt;br&gt;
  "Description": "Can monitor and restart virtual machines.",&lt;br&gt;
  "Actions": [&lt;br&gt;
    "Microsoft.Storage/&lt;em&gt;/read",&lt;br&gt;
    "Microsoft.Network/&lt;/em&gt;/read",&lt;br&gt;
    "Microsoft.Compute/&lt;em&gt;/read",&lt;br&gt;
    "Microsoft.Compute/virtualMachines/start/action",&lt;br&gt;
    "Microsoft.Compute/virtualMachines/restart/action",&lt;br&gt;
    "Microsoft.Authorization/&lt;/em&gt;/read",&lt;br&gt;
    "Microsoft.ResourceHealth/availabilityStatuses/read",&lt;br&gt;
    "Microsoft.Resources/subscriptions/resourceGroups/read",&lt;br&gt;
    "Microsoft.Insights/alertRules/&lt;em&gt;",&lt;br&gt;
    "Microsoft.Insights/diagnosticSettings/&lt;/em&gt;",&lt;br&gt;
    "Microsoft.Support/*"&lt;br&gt;
  ],&lt;br&gt;
  "NotActions": [],&lt;br&gt;
  "DataActions": [],&lt;br&gt;
  "NotDataActions": [],&lt;br&gt;
  "AssignableScopes": [&lt;br&gt;
    "/subscriptions/{subscriptionId1}",&lt;br&gt;
    "/subscriptions/{subscriptionId2}",&lt;br&gt;
    "/providers/Microsoft.Management/managementGroups/{groupId1}"&lt;br&gt;
  ]&lt;br&gt;
}&lt;br&gt;
Code language: JSON / JSON with Comments (json)&lt;br&gt;
Isolate cloud networks: Where possible, use Azure virtual networks and private clouds to isolate your cloud environments at the network level. These services aren’t available for every type of Azure workload, but most IaaS- and PaaS- based workloads (and some SaaS-based workloads as well) can be isolated in private networks or virtual private clouds.&lt;br&gt;
Use cloud tags: Like most other clouds, Azure lets you label and organize resources using tags. Although cloud resources that lack tags are not necessarily insecure, tags are beneficial from a security perspective because they make it easier to keep track of which cloud resources you have running and where. In turn, they help ensure that you don’t overlook some workloads when configuring access controls, auditing your cloud environment, and so on.&lt;br&gt;
Secure Azure data: In addition to using Azure IAM to manage access to data that you store in Azure Blob Storage or other storage services within Azure, you should encrypt your cloud data as well as the transport layers that you use to access data. Azure also offers a storage account “lock” feature, which is useful for preventing unauthorized tampering with cloud data.&lt;br&gt;
Special Security Considerations for Azure&lt;br&gt;
Beyond generic cloud security best practices, there are some considerations specific to Azure that you should factor into your Azure cloud security strategy:&lt;/p&gt;

&lt;p&gt;Understand Azure IAM: As we mentioned above, Azure’s IAM system is unique among the major public clouds because it is based on Microsoft Active Directory. You can configure and enforce very effective access policies using Azure IAM, but the policies are written and managed differently than those of clouds like AWS. If you haven’t worked with Active Directory previously, you’ll want to spend some time educating yourself about Azure Active Directory and its role in Azure cloud IAM.&lt;br&gt;
Use hybrid cloud services wisely: Azure has invested significantly in its hybrid cloud offerings in recent years with the introduction of Azure Stack and Azure Arc, both of which allow customers to manage on-premises or colocated infrastructure through Azure. As noted above, Azure expects customers to manage most security risks on private infrastructure, so it’s important not to assume that just because Azure is managing your private infrastructure, it’s also securing it.&lt;br&gt;
Azure security tools: Azure provides some cloud-specific security tools to help users secure and audit workloads. The two most important are Azure Security Center and Azure Defender (which is technically part of Azure Security Center, but operates as a distinct service). These services are useful for configuring and managing alerts related to security events and risks on both Azure itself and hybrid cloud environments that include Azure. Although you’ll typically want to use external security tools as well to manage risks that Azure’s native services can’t handle, you should familiarize yourself with the basic security services that Azure provides natively.&lt;br&gt;
Azure Container Security Best Practices&lt;br&gt;
Because container services have become one of the most important product offerings within Azure, it’s worth saying a few words about how to manage container security on Azure.&lt;/p&gt;

&lt;p&gt;This is a complex topic because Azure provides several container services. The most notable include:&lt;/p&gt;

&lt;p&gt;Azure Kubernetes Services (AKS), a managed Kubernetes service.&lt;br&gt;
Azure Container Instances, a managed container service that doesn’t require users to work with Kubernetes or another orchestration service.&lt;br&gt;
Azure Red Hat OpenShift, a managed OpenShift service. (OpenShift is based on Kubernetes, but is not identical to it.)&lt;br&gt;
Azure Web App for Containers, which lets users deploy containers quickly without having to manage orchestration or infrastructure themselves.&lt;br&gt;
Securing containers on Azure depends in large part on which of these services you choose to use. But in general, best practices for Azure container security include:&lt;/p&gt;

&lt;p&gt;Scan container images, because Azure won’t automatically detect vulnerabilities or malware within your images for you.&lt;br&gt;
Manage access to container registries, whether you use Azure’s native container registry service or a third-party registry.&lt;br&gt;
If your container environment includes Kubernetes, use Kubernetes audit logs, RBAC, and security contexts to help secure the environment. This is important even if you use a managed Kubernetes service like AKS. On AKS, Azure mostly secures only the cluster infrastructure; responsibility for securing Kubernetes itself and containers deployed in it, falls to the customer.&lt;br&gt;
Audit your container and Kubernetes configuration data, deployments, and other files to catch misconfigurations that could cause a weak security posture.&lt;/p&gt;

&lt;p&gt;Building Strong Azure Cloud Security Posture&lt;br&gt;
As one of the world’s largest cloud computing platforms, Azure offers dozens of cloud services that can be deployed as part of single-cloud, multi-cloud, or hybrid cloud models. All of this complexity means that there is no simple formula for securing Azure cloud environments.&lt;/p&gt;

&lt;p&gt;However, by identifying the security risks that you need to manage based on the Azure services you consume, then deploying tools that can harden those services against attack and detect breaches when they do occur, you’ll set yourself up for the strongest possible Azure cloud security posture.&lt;/p&gt;

&lt;p&gt;Follow for more such Content!!!!&lt;/p&gt;

&lt;p&gt;Nashet Ali - Senior Software Development Engineer - LTI - Larsen &amp;amp; Toubro Infotech &lt;a href="https://in.linkedin.com/in/nashet-ali-464a65115"&gt;https://in.linkedin.com/in/nashet-ali-464a65115&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;(&lt;a class="mentioned-user" href="https://dev.to/nashetking"&gt;@nashetking&lt;/a&gt;) / X &lt;a href="https://twitter.com/NashetKing"&gt;https://twitter.com/NashetKing&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>cloudsecurity</category>
      <category>azure</category>
      <category>cybersecurity</category>
    </item>
    <item>
      <title>Azure ChatGPT</title>
      <dc:creator>Syed Nashet Ali</dc:creator>
      <pubDate>Sat, 25 Nov 2023 14:36:12 +0000</pubDate>
      <link>https://dev.to/nashetking/azure-chatgpt-595f</link>
      <guid>https://dev.to/nashetking/azure-chatgpt-595f</guid>
      <description>&lt;p&gt;Azure ChatGPT&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpdbnv0x395csjvy342oq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpdbnv0x395csjvy342oq.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Microsoft recently unveiled Azure ChatGPT, a cutting-edge chatbot built upon OpenAI’s framework. Notably, the code for Azure ChatGPT is open-sourced under the MIT Licence, offering developers transparency and adaptability. One of its standout features is its commitment to user privacy; the system is designed to be fully isolated from data managed by OpenAI, ensuring a secure user experience.&lt;/p&gt;

&lt;p&gt;Moreover, organizations are given an unparalleled level of control, as the network traffic can be confined exclusively to their own network. This ensures a higher degree of security and adaptability. Further sweetening the deal, Azure ChatGPT is plug-n-play, which means that users can seamlessly incorporate their internal data sources or employ plug-ins for effortless integration with their internal services. This blend of privacy, control, and ease of use positions Azure ChatGPT as a remarkable tool for businesses and developers alike.&lt;/p&gt;

&lt;p&gt;Prerequisites&lt;br&gt;
Azure OpenAI: To deploy and run ChatGPT on Azure, you’ll need an Azure subscription with access to the Azure OpenAI service. Request access here. Once you have access, follow the instructions in this link to deploy the gpt-35-turbo or gpt-4 models.&lt;br&gt;
Setup GitHub or Azure AD for Authentication: The add an identity provider section below shows how to configure authentication providers.💡Note: You can configure the authentication provider to your identity solution using NextAuth providers&lt;br&gt;
Introduction&lt;br&gt;
Azure ChatGPT is built with the following technologies.&lt;/p&gt;

&lt;p&gt;Node.js 18: an open-source, cross-platform JavaScript runtime environment.&lt;/p&gt;

&lt;p&gt;Next.js 13: enables you to create full-stack web applications by extending the latest React features&lt;/p&gt;

&lt;p&gt;NextAuth.js: configurable authentication framework for Next.js 13&lt;/p&gt;

&lt;p&gt;LangChain JS: AI orchestration layer to build intelligent apps&lt;/p&gt;

&lt;p&gt;Tailwind CSS: is a utility-first CSS framework that provides a series of predefined classes that can be used to style each element by mixing and matching&lt;/p&gt;

&lt;p&gt;shadcn/ui: re-usable components built using Radix UI and Tailwind CSS.&lt;/p&gt;

&lt;p&gt;Azure Cosmos DB: fully managed platform-as-a-service (PaaS) NoSQL database to store chat history&lt;/p&gt;

&lt;p&gt;Azure App Service: fully managed platform-as-a-service (PaaS) for hosting web applications, REST APIs, and mobile back ends.&lt;/p&gt;

&lt;p&gt;Provision Azure resources&lt;br&gt;
Click on the Deploy to Azure button and configure your settings in the Azure Portal as described in the Environment variables section.&lt;/p&gt;

&lt;p&gt;⚠️ Note: This will only create azure resources. Follow the deploy to Azure section to build and deploy Azure ChatGPT.&lt;/p&gt;

&lt;p&gt;Deploy to Azure&lt;br&gt;
Run from your local machine&lt;br&gt;
Clone this repository locally or fork to your Github account. Run all of the the steps below from the “src” directory:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/microsoft/azurechatgpt/tree/main" rel="noopener noreferrer"&gt;https://github.com/microsoft/azurechatgpt/tree/main&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Make sure you deploy an instance of Cosmos DB in your Azure Subscription&lt;br&gt;
Create a new file named .env.local to store the environment variables add the following variables.&lt;br&gt;
change the active directory to be src&lt;br&gt;
Install npm packages by running npm install&lt;br&gt;
Start the project by running npm run dev&lt;br&gt;
You should now be prompted to login with your chosen OAuth provider. Once successfully logged in, you can start creating new conversations.&lt;br&gt;
Please note:&lt;/p&gt;

&lt;p&gt;Do not use double-quotes and do not delete any of the variables.&lt;br&gt;
Make sure that NEXTAUTH_URL=&lt;a href="http://localhost:3000" rel="noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt; has no comments in the same line.&lt;/p&gt;

&lt;h1&gt;
  
  
  Azure OpenAI configuration
&lt;/h1&gt;

&lt;p&gt;AZURE_OPENAI_API_KEY=&lt;br&gt;
AZURE_OPENAI_API_INSTANCE_NAME=&lt;br&gt;
AZURE_OPENAI_API_DEPLOYMENT_NAME=&lt;br&gt;
AZURE_OPENAI_API_VERSION=&lt;/p&gt;

&lt;h1&gt;
  
  
  GitHub OAuth app configuration
&lt;/h1&gt;

&lt;p&gt;AUTH_GITHUB_ID=&lt;br&gt;
AUTH_GITHUB_SECRET=&lt;/p&gt;

&lt;h1&gt;
  
  
  Azure AD OAuth app configuration
&lt;/h1&gt;

&lt;p&gt;AZURE_AD_CLIENT_ID=&lt;br&gt;
AZURE_AD_CLIENT_SECRET=&lt;br&gt;
AZURE_AD_TENANT_ID=&lt;/p&gt;

&lt;h1&gt;
  
  
  When deploying to production,
&lt;/h1&gt;

&lt;h1&gt;
  
  
  set the NEXTAUTH_URL environment variable to the canonical URL of your site.
&lt;/h1&gt;

&lt;h1&gt;
  
  
  More information: &lt;a href="https://next-auth.js.org/configuration/options" rel="noopener noreferrer"&gt;https://next-auth.js.org/configuration/options&lt;/a&gt;
&lt;/h1&gt;

&lt;p&gt;NEXTAUTH_SECRET=&lt;br&gt;
NEXTAUTH_URL=&lt;a href="http://localhost:3000" rel="noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;AZURE_COSMOSDB_URI=&lt;br&gt;
AZURE_COSMOSDB_KEY=&lt;/p&gt;

&lt;p&gt;Deploy to Azure – GitHub Actions&lt;br&gt;
The following steps describes how Azure ChatGPT can be deployed to Azure App service using GitHub Actions.&lt;/p&gt;

&lt;p&gt;Fork the repository&lt;br&gt;
Fork this repository to your own organisation so that you can execute GitHub Actions against your own Azure Subscription.&lt;/p&gt;

&lt;p&gt;Configure secrets in your GitHub repository&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;AZURE_CREDENTIALS
The GitHub workflow requires a secret named AZURE_CREDENTIALS to authenticate with Azure. The secret contains the credentials for a service principal with the Contributor role on the resource group containing the container app and container registry.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Create a service principal with the Contributor role on the resource group that contains the Azure App Service.az ad sp create-for-rbac --name  --role contributor --scopes /subscriptions//resourceGroups/ --sdk-auth --output json&lt;br&gt;
Copy the JSON output from the command.&lt;br&gt;
In the GitHub repository, navigate to Settings &amp;gt; Secrets &amp;gt; Actions and select New repository secret.&lt;br&gt;
Enter AZURE_CREDENTIALS as the name and paste the contents of the JSON output as the value.&lt;br&gt;
Select Add secret.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;AZURE_APP_SERVICE_NAME
Under the same repository secrets add a new variable AZURE_APP_SERVICE_NAME to deploy to your Azure Web app. The value of this secret is the name of your Azure Web app e.g. my-web-app-name from the domain &lt;a href="https://my-web-app-name.azurewebsites.net/" rel="noopener noreferrer"&gt;https://my-web-app-name.azurewebsites.net/&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Run GitHub Actions&lt;br&gt;
Once the secrets are configured, the GitHub Actions will be triggered for every code push to the repository. Alternatively, you can manually run the workflow by clicking on the “Run Workflow” button in the Actions tab in GitHub.&lt;/p&gt;

&lt;p&gt;Add an identity provider&lt;br&gt;
Once the deployment is complete, you will need to add an identity provider to authenticate your app.&lt;/p&gt;

&lt;p&gt;⚠️ Note: Only one of the identity provider is required below.&lt;/p&gt;

&lt;p&gt;GitHub Authentication provider&lt;br&gt;
We’ll create two GitHub apps: one for testing locally and another for production.&lt;/p&gt;

&lt;p&gt;🟡 Development app setup&lt;br&gt;
Navigate to GitHub OAuth Apps setup &lt;a href="https://github.com/settings/developers" rel="noopener noreferrer"&gt;https://github.com/settings/developers&lt;/a&gt;&lt;br&gt;
Create a New OAuth App &lt;a href="https://github.com/settings/applications/new" rel="noopener noreferrer"&gt;https://github.com/settings/applications/new&lt;/a&gt;&lt;br&gt;
Fill in the following details&lt;br&gt;
Application name: Azure ChatGPT DEV Environment&lt;br&gt;
Homepage URL: &lt;a href="http://localhost:3000" rel="noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt;&lt;br&gt;
Authorization callback URL: &lt;a href="http://localhost:3000/api/auth/callback/github" rel="noopener noreferrer"&gt;http://localhost:3000/api/auth/callback/github&lt;/a&gt;&lt;br&gt;
🟢 Production app setup&lt;br&gt;
Navigate to GitHub OAuth Apps setup &lt;a href="https://github.com/settings/developers" rel="noopener noreferrer"&gt;https://github.com/settings/developers&lt;/a&gt;&lt;br&gt;
Create a New OAuth App &lt;a href="https://github.com/settings/applications/new" rel="noopener noreferrer"&gt;https://github.com/settings/applications/new&lt;/a&gt;&lt;br&gt;
Fill in the following details&lt;br&gt;
Application name: Azure ChatGPT Production&lt;br&gt;
Homepage URL: &lt;a href="https://YOUR-WEBSITE-NAME.azurewebsites.net" rel="noopener noreferrer"&gt;https://YOUR-WEBSITE-NAME.azurewebsites.net&lt;/a&gt;&lt;br&gt;
Authorization callback URL: &lt;a href="https://YOUR-WEBSITE-NAME.azurewebsites.net/api/auth/callback/github" rel="noopener noreferrer"&gt;https://YOUR-WEBSITE-NAME.azurewebsites.net/api/auth/callback/github&lt;/a&gt;&lt;br&gt;
⚠️ After completing app setup, ensure your environment variables locally and on Azure App Service are up to date.&lt;/p&gt;

&lt;p&gt;# GitHub OAuth app configuration&lt;br&gt;
   AUTH_GITHUB_ID=&lt;br&gt;
   AUTH_GITHUB_SECRET=&lt;br&gt;
Azure AD Authentication provider&lt;br&gt;
🟡 Development app setup&lt;br&gt;
Navigate to Azure AD Apps setup&lt;br&gt;
Create a New Registration&lt;br&gt;
Fill in the following details&lt;br&gt;
Application name: Azure ChatGPT DEV Environment&lt;br&gt;
Supported account types: Accounts in this organizational directory only&lt;br&gt;
Redirect URI Platform: Web&lt;br&gt;
Redirect URI: &lt;a href="http://localhost:3000/api/auth/callback/azure-ad" rel="noopener noreferrer"&gt;http://localhost:3000/api/auth/callback/azure-ad&lt;/a&gt;&lt;br&gt;
🟢 Production app setup&lt;br&gt;
Navigate to Azure AD Apps setup &lt;br&gt;
Create a New Registration&lt;br&gt;
Fill in the following details&lt;br&gt;
Application name: Azure ChatGPT Production&lt;br&gt;
Supported account types: Accounts in this organizational directory only&lt;br&gt;
Redirect URI Platform: Web&lt;br&gt;
Redirect URI: &lt;a href="https://YOUR-WEBSITE-NAME.azurewebsites.net/api/auth/callback/azure-ad" rel="noopener noreferrer"&gt;https://YOUR-WEBSITE-NAME.azurewebsites.net/api/auth/callback/azure-ad&lt;/a&gt;&lt;br&gt;
After completing app setup, ensure your environment variables locally and on Azure App Service are up to date.&lt;/p&gt;

&lt;h1&gt;
  
  
  Azure AD OAuth app configuration
&lt;/h1&gt;

&lt;p&gt;AZURE_AD_CLIENT_ID=&lt;br&gt;
AZURE_AD_CLIENT_SECRET=&lt;br&gt;
AZURE_AD_TENANT_ID=&lt;br&gt;
Chatting with your file&lt;br&gt;
Users can utilise this functionality to upload their PDF files through the portal and engage in chat discussions related to the content of those files.&lt;/p&gt;

&lt;p&gt;Chat with your data utilises the following Azure Services:&lt;/p&gt;

&lt;p&gt;Azure Document Intelligence for extracting information from documents.&lt;br&gt;
Azure Cognitive Search for indexing and retrieving information.&lt;br&gt;
Azure OpenAI Embeddings for embed content extracted from files&lt;br&gt;
Azure OpenAI Embeddings&lt;br&gt;
We use Azure OpenAI Embeddings to convert text to vectors and index it in Azure Cognitive Search.&lt;/p&gt;

&lt;p&gt;update the OpenAI environment variables with the following:&lt;/p&gt;

&lt;p&gt;AZURE_OPENAI_API_EMBEDDINGS_DEPLOYMENT_NAME=&lt;br&gt;
When deploying to Azure, ensure to update the Azure App service app settings with AZURE_OPENAI_API_EMBEDDINGS_DEPLOYMENT_NAME&lt;/p&gt;

&lt;p&gt;Setup Azure Cognitive Search index and Document Intelligence&lt;br&gt;
Create Azure Cognitive Search using the following link&lt;br&gt;
Create an index on Azure Cognitive Search with the following schema. You can use the Azure portal to create the following indexes&lt;br&gt;
{&lt;br&gt;
      "name": "azure-chatgpt",&lt;br&gt;
      "fields": [&lt;br&gt;
        {&lt;br&gt;
          "name": "id",&lt;br&gt;
          "type": "Edm.String",&lt;br&gt;
          "key": true,&lt;br&gt;
          "filterable": true&lt;br&gt;
        },&lt;br&gt;
        {&lt;br&gt;
          "name": "user",&lt;br&gt;
          "type": "Edm.String",&lt;br&gt;
          "searchable": true,&lt;br&gt;
          "filterable": true&lt;br&gt;
        },&lt;br&gt;
        {&lt;br&gt;
          "name": "chatThreadId",&lt;br&gt;
          "type": "Edm.String",&lt;br&gt;
          "searchable": true,&lt;br&gt;
          "filterable": true&lt;br&gt;
        },&lt;br&gt;
         {&lt;br&gt;
          "name": "pageContent",&lt;br&gt;
          "searchable": true,&lt;br&gt;
          "type": "Edm.String"&lt;br&gt;
        },&lt;br&gt;
         {&lt;br&gt;
          "name": "metadata",&lt;br&gt;
          "type": "Edm.String"&lt;br&gt;
        },&lt;br&gt;
        {&lt;br&gt;
          "name": "embedding",&lt;br&gt;
          "type": "Collection(Edm.Single)",&lt;br&gt;
          "searchable": true,&lt;br&gt;
          "filterable": false,&lt;br&gt;
          "sortable": false,&lt;br&gt;
          "facetable": false,&lt;br&gt;
          "retrievable": true,&lt;br&gt;
          "analyzer": "",&lt;br&gt;
          "dimensions": 1536,&lt;br&gt;
          "vectorSearchConfiguration": "vectorConfig"&lt;br&gt;
        }&lt;br&gt;
      ],&lt;br&gt;
        "vectorSearch": {&lt;br&gt;
            "algorithmConfigurations": [&lt;br&gt;
                {&lt;br&gt;
                    "name": "vectorConfig",&lt;br&gt;
                    "kind": "hnsw"&lt;br&gt;
                }&lt;br&gt;
            ]&lt;br&gt;
        }&lt;br&gt;
    }&lt;br&gt;
After the index has been created, proceed to modify the env.local file with the appropriate Azure Cognitive Search environment variables.&lt;/p&gt;

&lt;h1&gt;
  
  
  Azure cognitive search is used for chat over your data
&lt;/h1&gt;

&lt;p&gt;AZURE_SEARCH_API_KEY=&lt;br&gt;
AZURE_SEARCH_NAME=&lt;br&gt;
AZURE_SEARCH_INDEX_NAME=&lt;br&gt;
AZURE_SEARCH_API_VERSION="2023-07-01-Preview"&lt;br&gt;
Create an instance of Azure Form Recognizer (also known as Azure Document Intelligence) using the following link. Please be aware that this resource might be called Form recognizer in Azure Portal.&lt;br&gt;
After the Form Recognizer (Document Intelligence) resource has been created, proceed to modify the env.local file with appropriate environment variables. You can find values for these variables in your Form Recognizer resource (Resource Management blade &amp;gt; Keys and Endpoint). Please make sure that you don’t copy the endpoint from there, but only replace the region in the example below. For example, if your Form Recognizer resource is located in East US Azure region, your AZURE_DOCUMENT_INTELLIGENCE_ENDPOINT variable would be &lt;a href="https://eastus.api.cognitive.microsoft.com/.Please" rel="noopener noreferrer"&gt;https://eastus.api.cognitive.microsoft.com/.Please&lt;/a&gt; note that the file is only preserved for each chat thread:&lt;/p&gt;

&lt;h1&gt;
  
  
  Azure AI Document Intelligence to extract content from your data
&lt;/h1&gt;

&lt;p&gt;AZURE_DOCUMENT_INTELLIGENCE_ENDPOINT="&lt;a href="https://REGION.api.cognitive.microsoft.com/" rel="noopener noreferrer"&gt;https://REGION.api.cognitive.microsoft.com/&lt;/a&gt;"&lt;br&gt;
AZURE_DOCUMENT_INTELLIGENCE_KEY=&lt;br&gt;
At this point, you should be able to start new chat sessions with the File option.&lt;/p&gt;

&lt;p&gt;Once the File chat option is selected, click the Choose File button to select your document and then click the Upload button to upload your file. Please note that the Form Recognizer service supports PDF (text or scanned), JPG and PNG input documents.&lt;br&gt;
Once you receive a notification about a successful file upload, you should be able to start chatting with chatting with a chatbot.&lt;br&gt;
Things to consider:&lt;br&gt;
Central place maintain uploaded files (e.g a storage account with blob storage)&lt;br&gt;
A way to delete indexed documents on Azure Cognitive Search if the chat thread is deleted&lt;br&gt;
Environment variables&lt;br&gt;
Below are the required environment variables, to be added to the Azure Portal or in the .env.local file.&lt;/p&gt;

&lt;p&gt;App Setting Value   Note&lt;br&gt;
AZURE_OPENAI_API_KEY        API keys of your Azure OpenAI resource&lt;br&gt;
AZURE_OPENAI_API_INSTANCE_NAME      the name of your Azure OpenAI resource&lt;br&gt;
AZURE_OPENAI_API_DEPLOYMENT_NAME        The name of your model deployment&lt;br&gt;
AZURE_OPENAI_API_VERSION    2023-03-15-preview  API version when using gpt chat&lt;br&gt;
AUTH_GITHUB_ID      Client ID of your GitHub OAuth application&lt;br&gt;
AUTH_GITHUB_SECRET      Client Secret of your GitHub OAuth application&lt;br&gt;
NEXTAUTH_SECRET     Used to encrypt the NextAuth.js JWT, and to hash email verification tokens. This set by default as part of the deployment template&lt;br&gt;
NEXTAUTH_URL        Current webs hosting domain name with HTTP or HTTPS. This set by default as part of the deployment template&lt;br&gt;
AZURE_COSMOSDB_URI      URL of the Azure CosmosDB&lt;br&gt;
AZURE_COSMOSDB_KEY      API Key for Azure Cosmos DB&lt;br&gt;
AZURE_AD_CLIENT_ID      The client id specific to the application&lt;br&gt;
AZURE_AD_CLIENT_SECRET      The client secret specific to the application&lt;br&gt;
AZURE_AD_TENANT_ID      The organisation Tenant ID&lt;br&gt;
Azure Cognitive Search is optional for Azure ChatGPT. This is only required for chat over file feature.&lt;br&gt;&lt;br&gt;
AZURE_SEARCH_API_KEY        API Key of Azure Cognitive search&lt;br&gt;
AZURE_SEARCH_NAME   &lt;a href="https://AZURE_SEARCH_NAME.search.windows.net" rel="noopener noreferrer"&gt;https://AZURE_SEARCH_NAME.search.windows.net&lt;/a&gt;    The deployment name of your Azure Cognitive Search&lt;br&gt;
AZURE_SEARCH_INDEX_NAME     The index name with vector search enabled&lt;br&gt;
AZURE_SEARCH_API_VERSION    2023-07-01-Preview  API version which supports vector search 2023-07-01-Preview&lt;br&gt;
AZURE_DOCUMENT_INTELLIGENCE_ENDPOINT    &lt;a href="https://REGION.api.cognitive.microsoft.com/" rel="noopener noreferrer"&gt;https://REGION.api.cognitive.microsoft.com/&lt;/a&gt; Endpoint url of the Azure document intelligence. The REGION is specific to your Azure resource location&lt;br&gt;
AZURE_DOCUMENT_INTELLIGENCE_KEY     API keys of your Azure Document intelligence resource&lt;br&gt;
Azure ChatGPT Environment variables&lt;br&gt;
Posted&lt;/p&gt;

&lt;p&gt;Follow me for more such content!!!!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tu7yl3ekdcwlxyff8awh.png" rel="noopener noreferrer"&gt;Image description&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Nashet Ali - Senior Software Development Engineer - LTI - Larsen &amp;amp; Toubro Infotech &lt;a href="https://in.linkedin.com/in/nashet-ali-464a65115" rel="noopener noreferrer"&gt;https://in.linkedin.com/in/nashet-ali-464a65115&lt;/a&gt;&lt;br&gt;
Cloudify with Nashet&lt;br&gt;
 Nashet Ali (&lt;a class="mentioned-user" href="https://dev.to/nashetking"&gt;@nashetking&lt;/a&gt;) / X &lt;a href="https://twitter.com/NashetKing" rel="noopener noreferrer"&gt;https://twitter.com/NashetKing&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>cloud</category>
      <category>ai</category>
    </item>
    <item>
      <title>Contributing to AI Shopping Cart - App Template for Java, Azure OpenAI and Azure Spring Apps</title>
      <dc:creator>Syed Nashet Ali</dc:creator>
      <pubDate>Fri, 11 Aug 2023 12:56:51 +0000</pubDate>
      <link>https://dev.to/nashetking/contributing-to-ai-shopping-cart-app-template-for-java-azure-openai-and-azure-spring-apps-51mi</link>
      <guid>https://dev.to/nashetking/contributing-to-ai-shopping-cart-app-template-for-java-azure-openai-and-azure-spring-apps-51mi</guid>
      <description>&lt;p&gt;&lt;u&gt;This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit &lt;a href="https://cla.opensource.microsoft.com" rel="noopener noreferrer"&gt;https://cla.opensource.microsoft.com&lt;/a&gt;.&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;AI Shopping Cart is a sample application that supercharges your shopping experience with the power of AI. It leverages Azure OpenAI and Azure Spring Apps to build a recommendation engine that is not only scalable, resilient, and secure, but also personalized to your needs. Taking advantage of Azure OpenAI, the application performs nutrition analysis on the items in your cart and generates the top 3 recipes using those ingredients. With Azure Developer CLI (azd), you’re just a few commands away from having this fully functional sample application up and running in Azure. Let's get started!&lt;/p&gt;

&lt;p&gt;This sample application take inspiration on this original work: &lt;a href="https://github.com/lopezleandro03/ai-assisted-groceries-cart" rel="noopener noreferrer"&gt;https://github.com/lopezleandro03/ai-assisted-groceries-cart&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Refer to the App Templates repository Readme for more samples that are compatible with azd.&lt;/p&gt;

&lt;p&gt;AI Shopping Cart&lt;/p&gt;

&lt;p&gt;Pre-requisites&lt;br&gt;
Install the Azure Developer CLI&lt;br&gt;
An Azure account with an active subscription. Create one for free.&lt;br&gt;
OpenJDK 17&lt;br&gt;
Node.js 20.5.0+&lt;br&gt;
Docker&lt;br&gt;
Azure OpenAI with gpt-4 or gpt-35-turbo [Note]&lt;br&gt;
Review the architecture diagram and the resources you'll deploy and the Azure OpenAI section.&lt;br&gt;
Quickstart&lt;br&gt;
To learn how to get started with any template, follow this quickstart. For this template Azure-Samples/app-templates-java-openai-springapps, you need to execute a few additional steps as described below.&lt;/p&gt;

&lt;p&gt;This quickstart will show you how to authenticate on Azure, enable Spring Apps alpha feature for azd, initialize using a template, set the environment variables for Azure OpenAI, provision the infrastructure, and deploy the code to Azure:&lt;/p&gt;
&lt;h1&gt;
  
  
  Log in to azd if you haven't already
&lt;/h1&gt;

&lt;p&gt;azd auth login&lt;/p&gt;
&lt;h1&gt;
  
  
  Enable Azure Spring Apps alpha feature for azd
&lt;/h1&gt;

&lt;p&gt;azd config set alpha.springapp on&lt;/p&gt;
&lt;h1&gt;
  
  
  First-time project setup. Initialize a project in the current directory using this template
&lt;/h1&gt;

&lt;p&gt;azd init --template Azure-Samples/app-templates-java-openai-springapps&lt;/p&gt;
&lt;h1&gt;
  
  
  Set the environment variables for Azure OpenAI
&lt;/h1&gt;

&lt;p&gt;azd env set azureOpenAiApiKey  &lt;br&gt;
azd env set azureOpenAiEndpoint &lt;br&gt;
azd env set azureOpenAiDeploymentId &lt;/p&gt;
&lt;h1&gt;
  
  
  To use GPT-3.5 Turbo model set this environment variable to false
&lt;/h1&gt;

&lt;p&gt;azd env set isAzureOpenAiGpt4Model true&lt;/p&gt;
&lt;h1&gt;
  
  
  Provision and deploy to Azure
&lt;/h1&gt;

&lt;p&gt;azd up&lt;br&gt;
Notes&lt;/p&gt;

&lt;p&gt;Replace the placeholders with the values from your Azure OpenAI resource.&lt;br&gt;
If you are using gpt-35-turbo model, you need to set isAzureOpenAiGpt4Model to false before provisioning the resource and deploying the sample application to Azure:&lt;br&gt;
azd env set isAzureOpenAiGpt4Model false&lt;br&gt;
At the end of the deployment, you will see the URL of the front-end. Open the URL in a browser to see the application in action.&lt;/p&gt;

&lt;p&gt;Application Architecture&lt;br&gt;
This sample application uses the following Azure resources:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3rvnejnwwoadritq77mg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3rvnejnwwoadritq77mg.png" alt="Application Architecture Diagram "&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Azure Container Apps (Environment) to host the frontend as a Container App and Azure Spring Apps Standard comsumption and dedicated plan&lt;br&gt;
Azure Spring Apps to host the AI Shopping Cart Service as a Spring App&lt;br&gt;
Azure Container Registry to host the Docker image for the frontend&lt;br&gt;
Azure Database for PostgreSQL (Flexible Server) to store the data for the AI Shopping Cart Service&lt;br&gt;
Azure Monitor for monitoring and logging&lt;br&gt;
Azure OpenAI to perform nutrition analysis and generate top 3 recipes. It is not deployed with the sample app[Note].&lt;br&gt;
Here's a high level architecture diagram that illustrates these components. Excepted Azure OpenAI, all the other resources are provisioned in a single resource group that is created when you create your resources using azd up.&lt;/p&gt;

&lt;p&gt;Architecture diagram&lt;/p&gt;

&lt;p&gt;This template provisions resources to an Azure subscription that you will select upon provisioning them. Please refer to the Pricing calculator for Microsoft Azure and, if needed, update the included Azure resource definitions found in infra/main.bicep to suit your needs.&lt;/p&gt;

&lt;p&gt;Azure OpenAI&lt;br&gt;
This sample application uses Azure OpenAI. It is not part of the automated deployment process. You will need to create an Azure OpenAI resource and configure the application to use it. Please follow the instructions in the Azure OpenAI documentation to get access to Azure OpenAI. Do not forget to read the overview of the Responsible AI practices for Azure OpenAI models before you start using Azure OpenAI and request access.&lt;/p&gt;

&lt;p&gt;The current version of the sample app requires a publicly accessible Azure OpenAI resource (i.e. Allow access from all networks). This sample is not intended to be used in production. To know more about networking and security for Azure OpenAI, please refer to the Azure OpenAI documentation.&lt;/p&gt;

&lt;p&gt;This sample app was developed to be used with gpt-4 model. It also supports gpt-35-turbo. To use gpt-35-turbo, you need to set isAzureOpenAiGpt4Model to false (cf. Quickstart). By default, this parameter/environment variable is set to true. To complete the setup of the application, you need to set the following information from the Azure OpenAI resource:&lt;/p&gt;

&lt;p&gt;azureOpenAiApiKey - Azure OpenAI API key&lt;br&gt;
azureOpenAiEndpoint - Azure OpenAI endpoint&lt;br&gt;
azureOpenAiDeploymentId - Azure OpenAI deployment ID of gpt-4 or gpt-3.5-turbo model&lt;br&gt;
The API key and the endpoint can be found in the Azure Portal. You can follow these instructions: Retrieve key and enpoint. The deployment id corresponds to the deployment name in this guide.&lt;/p&gt;

&lt;p&gt;Prompt engineering is important to get the best results from Azure OpenAI. Text prompts are how users interact with GPT models. As with all generative large language model (LLM), GPT models try to produce the next series of words that are the most likely to follow the previous text. It is a bit like asking to the AI model: What is the first thing that comes to mind when I say ?&lt;/p&gt;

&lt;p&gt;With the Chat Completion API, there are distinct sections of the prompt that are sent to the API associated with a specific role: system, user and assitant. The system message is included at the begining of the prompt and is used to provides the initial instructions to the model: description of the assitant, personality traits, instructions/rules it will follow, etc.&lt;/p&gt;

&lt;p&gt;AI Shopping Cart Service is using Azure OpenAI client library for Java. This libary is part of of Azure SDK for Java. It is implemented as a chat completion. In the service, we have 2 system messages in SystemMessageConstants.java: one for AI Nutrition Analysis and one to generate top 3 recipes. The system message is followed by a user message: The basket is: . The assistant message is the response from the model. The service is using the ShoppingCartAiRecommendations to interact with Azure OpenAI. In this class you will find the code that is responsible for generating the prompt and calling the Azure OpenAI API: getChatCompletion. To know more about temperature and topP used in this class, please refer to the documentation.&lt;/p&gt;

&lt;p&gt;For gpt-35-turbo model, more context is added to the user message. This additional context is added at the end of the user message. It provides more information on the format of the JSON that OpenAI model needs to return and ask the model tor return only the JSON without additional text. This additional context is available in UserMessageConstants.java.&lt;/p&gt;

&lt;p&gt;Pre-requisites ⤴️&lt;br&gt;
Application Architecture ⤴️&lt;br&gt;
Application Code&lt;br&gt;
This template is structured to follow the Azure Developer CLI template convetions. You can learn more about azd architecture in the official documentation.&lt;/p&gt;

&lt;p&gt;Next Steps&lt;br&gt;
At this point, you have a complete application deployed on Azure.&lt;/p&gt;

&lt;p&gt;Enterprise Scenarios&lt;br&gt;
For enterprise needs, looking for polyglot applications deployment, Tanzu components support and SLA assurance, we recommend to use Azure Spring Apps Enterprise. Check the Azure Spring Apps landing zone accelerator that provides architectural guidance designed to streamline the production ready infrastructure provisioning and deployment of Spring Boot and Spring Cloud applications to Azure Spring Apps. As the workload owner, use architectural guidance provided in landing zone accelerator to achieve your target technical state with confidence.&lt;/p&gt;

&lt;p&gt;Azure Developer CLI&lt;br&gt;
You have deployed the sample application using Azure Developer CLI, however there is much more that the Azure Developer CLI can do. These next steps will introduce you to additional commands that will make creating applications on Azure much easier. Using the Azure Developer CLI, you can setup your pipelines, monitor your application, test and debug locally.&lt;/p&gt;

&lt;p&gt;azd down - to delete all the Azure resources created with this template&lt;/p&gt;

&lt;p&gt;azd pipeline config - to configure a CI/CD pipeline (using GitHub Actions or Azure DevOps) to deploy your application whenever code is pushed to the main branch.&lt;/p&gt;

&lt;p&gt;Several environment variables / secrets need to be set for Azure OpenAI resource:&lt;br&gt;
AZURE_OPENAI_API_KEY: API key for Azure OpenAI resource&lt;br&gt;
For GitHub workflows, you should use GitHub Secrets&lt;br&gt;
For Azure DevOps pipelines, you check 'Keep this value secret' when creating the variable&lt;br&gt;
AZURE_OPENAI_ENDPOINT: Endpoint for Azure OpenAI resource&lt;br&gt;
AZURE_OPENAI_DEPLOYMENT_ID: Deployment ID/name for Azure OpenAI resource&lt;br&gt;
IS_AZURE_OPENAI_GPT4_MODEL: Set to true if you are using GPT-4 model and to false if you are using GPT-3.5 Turbo model&lt;br&gt;
azd monitor - to monitor the application and quickly navigate to the various Application Insights dashboards (e.g. overview, live metrics, logs)&lt;/p&gt;

&lt;p&gt;Run and Debug Locally - using Visual Studio Code and the Azure Developer CLI extension&lt;/p&gt;

&lt;p&gt;Additional azd commands&lt;br&gt;
The Azure Developer CLI includes many other commands to help with your Azure development experience. You can view these commands at the terminal by running azd help. You can also view the full list of commands on our Azure Developer CLI command page.&lt;/p&gt;

&lt;p&gt;Resources&lt;br&gt;
These are additional resources that you can use to learn more about the sample application and its underlying technologies.&lt;/p&gt;

&lt;p&gt;Start from zero and scale to zero – Azure Spring Apps consumption plan&lt;br&gt;
Azure Spring Apps Consumption - Networking and Security&lt;br&gt;
&lt;a href="https://learn.microsoft.com/en-us/azure/ai-services/openai/encrypt-data-at-rest" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/azure/ai-services/openai/encrypt-data-at-rest&lt;/a&gt;&lt;br&gt;
&lt;a href="https://learn.microsoft.com/en-us/azure/ai-services/openai/encrypt-data-at-rest" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/azure/ai-services/openai/encrypt-data-at-rest&lt;/a&gt;&lt;br&gt;
How to configure Azure OpenAI Service with managed identities&lt;br&gt;
Data Collection&lt;br&gt;
The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft's privacy statement. Our privacy statement is located at &lt;a href="https://go.microsoft.com/fwlink/?LinkId=521839" rel="noopener noreferrer"&gt;https://go.microsoft.com/fwlink/?LinkId=521839&lt;/a&gt;. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.&lt;/p&gt;

&lt;p&gt;Telemetry Configuration&lt;br&gt;
Telemetry collection is on by default.&lt;/p&gt;

&lt;p&gt;To opt-out, set the variable enableTelemetry to false in infra/main.parameters.json or in bicep template infra/main.bicep. It can be set using the following command when the provisionning is done with Azure Developer CLI:&lt;/p&gt;

&lt;p&gt;azd env set enableTelemetry false&lt;br&gt;
Trademarks&lt;br&gt;
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark &amp;amp; Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.&lt;/p&gt;

&lt;p&gt;When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.&lt;/p&gt;

&lt;p&gt;This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact &lt;a href="mailto:opencode@microsoft.com"&gt;opencode@microsoft.com&lt;/a&gt; with any additional questions or comments.&lt;/p&gt;

&lt;p&gt;Code of Conduct&lt;br&gt;
Issues and Bugs&lt;br&gt;
Feature Requests&lt;br&gt;
Submission Guidelines&lt;br&gt;
Code of Conduct&lt;br&gt;
Help us keep this project open and inclusive. Please read and follow our Code of Conduct.&lt;/p&gt;

&lt;p&gt;Found an Issue?&lt;br&gt;
If you find a bug in the source code or a mistake in the documentation, you can help us by submitting an issue to the GitHub Repository. Even better, you can submit a Pull Request with a fix.&lt;/p&gt;

&lt;p&gt;Want a Feature?&lt;br&gt;
You can request a new feature by submitting an issue to the GitHub Repository. If you would like to implement a new feature, please submit an issue with a proposal for your work first, to be sure that we can use it.&lt;/p&gt;

&lt;p&gt;Small Features can be crafted and directly submitted as a Pull Request.&lt;br&gt;
Submission Guidelines&lt;br&gt;
Submitting an Issue&lt;br&gt;
Before you submit an issue, search the archive, maybe your question was already answered.&lt;/p&gt;

&lt;p&gt;If your issue appears to be a bug, and hasn't been reported, open a new issue. Help us to maximize the effort we can spend fixing issues and adding new features, by not reporting duplicate issues. Providing the following information will increase the chances of your issue being dealt with quickly:&lt;/p&gt;

&lt;p&gt;Overview of the Issue - if an error is being thrown a non-minified stack trace helps&lt;br&gt;
Version - what version is affected (e.g. 0.1.2)&lt;br&gt;
Motivation for or Use Case - explain what are you trying to do and why the current behavior is a bug for you&lt;br&gt;
Browsers and Operating System - is this a problem with all browsers?&lt;br&gt;
Reproduce the Error - provide a live example or a unambiguous set of steps&lt;br&gt;
Related Issues - has a similar issue been reported before?&lt;br&gt;
Suggest a Fix - if you can't fix the bug yourself, perhaps you can point to what might be causing the problem (line of code or commit)&lt;br&gt;
You can file new issues by providing the above information at the corresponding repository's issues link: &lt;a href="https://github.com/Azure-Samples/app-templates-java-openai-springapps/issues/new" rel="noopener noreferrer"&gt;https://github.com/Azure-Samples/app-templates-java-openai-springapps/issues/new&lt;/a&gt;].&lt;/p&gt;

&lt;p&gt;Submitting a Pull Request (PR)&lt;br&gt;
Before you submit your Pull Request (PR) consider the following guidelines:&lt;/p&gt;

&lt;p&gt;Search the repository (&lt;a href="https://github.com/Azure-Samples/app-templates-java-openai-springapps/pulls" rel="noopener noreferrer"&gt;https://github.com/Azure-Samples/app-templates-java-openai-springapps/pulls&lt;/a&gt;) for an open or closed PR that relates to your submission. You don't want to duplicate effort.&lt;/p&gt;

&lt;p&gt;Make your changes in a new git fork:&lt;/p&gt;

&lt;p&gt;Commit your changes using a descriptive commit message&lt;/p&gt;



&lt;p&gt;page_type: sample&lt;br&gt;
languages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;azdeveloper&lt;/li&gt;
&lt;li&gt;java&lt;/li&gt;
&lt;li&gt;typescript&lt;/li&gt;
&lt;li&gt;bicep&lt;/li&gt;
&lt;li&gt;html
products:&lt;/li&gt;
&lt;li&gt;azure&lt;/li&gt;
&lt;li&gt;azure-container-apps&lt;/li&gt;
&lt;li&gt;azure-spring-apps&lt;/li&gt;
&lt;li&gt;azure-container-registry&lt;/li&gt;
&lt;li&gt;azure-monitor&lt;/li&gt;
&lt;li&gt;ms-build-openjdk&lt;/li&gt;
&lt;li&gt;ai-services&lt;/li&gt;
&lt;li&gt;azure-openai&lt;/li&gt;
&lt;li&gt;azure-database-postgresql
urlFragment: app-templates-java-openai-springapps
name: AI Shopping Cart - App Template for Java, Azure OpenAI and Azure Spring Apps
description: "AI Shopping Cart Sample Application with Azure OpenAI and Azure Spring Apps"
---&lt;/li&gt;
&lt;/ul&gt;
&lt;h1&gt;
  
  
  AI Shopping Cart - App Template for Java, Azure OpenAI and Azure Spring Apps
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://codespaces.new/Azure-Samples/app-templates-java-openai-springapps" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimg.shields.io%2Fbadge%2FGithub_Codespaces-Open-black%3Fstyle%3Dfor-the-badge%26logo%3Dgithub" alt="Open in GitHub Codespaces"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/Azure-Samples/app-templates-java-openai-springapps" rel="noopener noreferrer"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fimg.shields.io%2Fbadge%2FDev_Containers-Open-blue%3Fstyle%3Dfor-the-badge%26logo%3Dvisualstudiocode" alt="Open in Remote - Dev Containers"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;AI Shopping Cart is a sample application that supercharges your shopping experience with the power of AI. It leverages Azure OpenAI and Azure Spring Apps to build a recommendation engine that is not only scalable, resilient, and secure, but also personalized to your needs. Taking advantage of Azure OpenAI, the application performs nutrition analysis on the items in your cart and generates the top 3 recipes using those ingredients. With Azure Developer CLI (azd), you’re just a few commands away from having this fully functional sample application up and running in Azure. Let's get started!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This sample application take inspiration on this original work: &lt;a href="https://github.com/lopezleandro03/ai-assisted-groceries-cart" rel="noopener noreferrer"&gt;https://github.com/lopezleandro03/ai-assisted-groceries-cart&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Refer to the &lt;a href="https://github.com/microsoft/App-Templates" rel="noopener noreferrer"&gt;App Templates&lt;/a&gt; repository Readme for more samples that are compatible with &lt;a href="https://github.com/Azure/azure-dev/" rel="noopener noreferrer"&gt;&lt;code&gt;azd&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/.%2Fassets%2Fai-shopping-cart.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/.%2Fassets%2Fai-shopping-cart.png" alt="AI Shopping Cart"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Pre-requisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/install-azd" rel="noopener noreferrer"&gt;Install the Azure Developer CLI&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;An Azure account with an active subscription. &lt;a href="https://azure.microsoft.com/free" rel="noopener noreferrer"&gt;Create one for free&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.microsoft.com/en-us/java/openjdk/install" rel="noopener noreferrer"&gt;OpenJDK 17&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://nodejs.org/en/download/" rel="noopener noreferrer"&gt;Node.js 20.5.0+&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.docker.com/get-docker/" rel="noopener noreferrer"&gt;Docker&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://learn.microsoft.com/en-us/azure/ai-services/openai/overview#how-do-i-get-access-to-azure-openai" rel="noopener noreferrer"&gt;Azure OpenAI with &lt;code&gt;gpt-4&lt;/code&gt; or &lt;code&gt;gpt-35-turbo&lt;/code&gt;&lt;/a&gt; &lt;sup&gt;[Note]&lt;/sup&gt;
&lt;/li&gt;
&lt;li&gt;Review the architecture diagram and the resources you'll deploy and the Azure OpenAI section.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Quickstart
&lt;/h2&gt;

&lt;p&gt;To learn how to get started with any template, follow &lt;a href="https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/get-started?tabs=localinstall&amp;amp;pivots=programming-language-java" rel="noopener noreferrer"&gt;this quickstart&lt;/a&gt;. For this template &lt;code&gt;Azure-Samples/app-templates-java-openai-springapps&lt;/code&gt;, you need to execute a few additional steps as described below.&lt;/p&gt;

&lt;p&gt;This quickstart will show you how to authenticate on Azure, enable Spring Apps &lt;a href="https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/feature-versioning#alpha-features" rel="noopener noreferrer"&gt;alpha feature&lt;/a&gt; for azd, initialize using a template, set the &lt;a href="https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/manage-environment-variables" rel="noopener noreferrer"&gt;environment variables&lt;/a&gt; for Azure OpenAI, provision the infrastructure, and deploy the code to Azure:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Log in to azd if you haven't already&lt;/span&gt;
azd auth login

&lt;span class="c"&gt;# Enable Azure Spring Apps alpha feature for azd&lt;/span&gt;
azd config &lt;span class="nb"&gt;set &lt;/span&gt;alpha.springapp on

&lt;span class="c"&gt;# First-time project setup. Initialize a project in the current directory using this template&lt;/span&gt;
azd init &lt;span class="nt"&gt;--template&lt;/span&gt; Azure-Samples/app-templates-java-openai-springapps

&lt;span class="c"&gt;# Set the environment variables for Azure OpenAI&lt;/span&gt;
azd &lt;span class="nb"&gt;env set &lt;/span&gt;azureOpenAiApiKey &amp;lt;replace-with-Azure-OpenAi-API-key&amp;gt; 
azd &lt;span class="nb"&gt;env set &lt;/span&gt;azureOpenAiEndpoint &amp;lt;replace-with-Azure-OpenAi-endpoint&amp;gt;
azd &lt;span class="nb"&gt;env set &lt;/span&gt;azureOpenAiDeploymentId &amp;lt;replace-with-Azure-OpenAi-deployment-id/name&amp;gt;

&lt;span class="c"&gt;# To use GPT-3.5 Turbo model set this environment variable to false&lt;/span&gt;
azd &lt;span class="nb"&gt;env set &lt;/span&gt;isAzureOpenAiGpt4Model &lt;span class="nb"&gt;true&lt;/span&gt;

&lt;span class="c"&gt;# Provision and deploy to Azure&lt;/span&gt;
azd up
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Notes&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Replace the placeholders with the values from your Azure OpenAI resource.&lt;/li&gt;
&lt;li&gt;If you are using &lt;code&gt;gpt-35-turbo&lt;/code&gt; model, you need to set &lt;code&gt;isAzureOpenAiGpt4Model&lt;/code&gt; to &lt;code&gt;false&lt;/code&gt; before provisioning the resource and deploying the sample application to Azure:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;br&gt;
     &lt;code&gt;bash&lt;br&gt;
    azd env set isAzureOpenAiGpt4Model false&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;At the end of the deployment, you will see the URL of the front-end. Open the URL in a browser to see the application in action.&lt;/p&gt;

&lt;h2&gt;
  
  
  Application Architecture
&lt;/h2&gt;

&lt;p&gt;This sample application uses the following Azure resources:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://learn.microsoft.com/en-us/azure/container-apps/" rel="noopener noreferrer"&gt;Azure Container Apps (Environment)&lt;/a&gt; to host the frontend as a Container App and Azure Spring Apps &lt;a href="https://learn.microsoft.com/en-us/azure/spring-apps/overview#standard-consumption-and-dedicated-plan" rel="noopener noreferrer"&gt;Standard comsumption and dedicated plan&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://learn.microsoft.com/azure/spring-apps/" rel="noopener noreferrer"&gt;Azure Spring Apps&lt;/a&gt; to host the AI Shopping Cart Service as a Spring App&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://learn.microsoft.com/azure/container-registry/" rel="noopener noreferrer"&gt;Azure Container Registry&lt;/a&gt; to host the Docker image for the frontend&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://learn.microsoft.com/azure/postgresql/" rel="noopener noreferrer"&gt;Azure Database for PostgreSQL (Flexible Server)&lt;/a&gt; to store the data for the AI Shopping Cart Service&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://learn.microsoft.com/en-us/azure/azure-monitor/" rel="noopener noreferrer"&gt;Azure Monitor&lt;/a&gt; for monitoring and logging&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://learn.microsoft.com/en-us/azure/ai-services/openai/" rel="noopener noreferrer"&gt;Azure OpenAI&lt;/a&gt; to perform nutrition analysis and generate top 3 recipes. It is not deployed with the sample app&lt;sup&gt;[Note]&lt;/sup&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here's a high level architecture diagram that illustrates these components. Excepted Azure OpenAI, all the other resources are provisioned in a single &lt;a href="https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/manage-resource-groups-portal" rel="noopener noreferrer"&gt;resource group&lt;/a&gt; that is created when you create your resources using &lt;code&gt;azd up&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/.%2Fassets%2Farchitecture-diagram.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/.%2Fassets%2Farchitecture-diagram.png" alt="Architecture diagram"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This template provisions resources to an Azure subscription that you will select upon provisioning them. Please refer to the &lt;a href="https://azure.microsoft.com/pricing/calculator/" rel="noopener noreferrer"&gt;Pricing calculator for Microsoft Azure&lt;/a&gt; and, if needed, update the included Azure resource definitions found in &lt;code&gt;infra/main.bicep&lt;/code&gt; to suit your needs.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Azure OpenAI
&lt;/h2&gt;

&lt;p&gt;This sample application uses Azure OpenAI. It is not part of the automated deployment process. You will need to create an Azure OpenAI resource and configure the application to use it. Please follow the instructions in the &lt;a href="https://learn.microsoft.com/en-us/azure/ai-services/openai/overview#how-do-i-get-access-to-azure-openai" rel="noopener noreferrer"&gt;Azure OpenAI documentation&lt;/a&gt; to get access to Azure OpenAI. Do not forget to read the &lt;a href="https://learn.microsoft.com/en-us/legal/cognitive-services/openai/overview?context=%2Fazure%2Fai-services%2Fopenai%2Fcontext%2Fcontext" rel="noopener noreferrer"&gt;overview of the Responsible AI practices for Azure OpenAI models&lt;/a&gt; before you start using Azure OpenAI and request access.&lt;/p&gt;

&lt;p&gt;The current version of the sample app requires a publicly accessible Azure OpenAI resource (i.e. Allow access from all networks). This sample is not intended to be used in production. To know more about networking and security for Azure OpenAI, please refer to the Azure OpenAI documentation.&lt;/p&gt;

&lt;p&gt;This sample app was developed to be used with &lt;code&gt;gpt-4&lt;/code&gt; model. It also supports &lt;code&gt;gpt-35-turbo&lt;/code&gt;. To use &lt;code&gt;gpt-35-turbo&lt;/code&gt;, you need to set &lt;code&gt;isAzureOpenAiGpt4Model&lt;/code&gt; to &lt;code&gt;false&lt;/code&gt; (cf. Quickstart). By default, this parameter/environment variable is set to &lt;code&gt;true&lt;/code&gt;. To complete the setup of the application, you need to set the following information from the Azure OpenAI resource:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;azureOpenAiApiKey&lt;/code&gt; - Azure OpenAI API key&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;azureOpenAiEndpoint&lt;/code&gt; - Azure OpenAI endpoint&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;azureOpenAiDeploymentId&lt;/code&gt; - Azure OpenAI deployment ID of &lt;code&gt;gpt-4&lt;/code&gt; or &lt;code&gt;gpt-3.5-turbo&lt;/code&gt; model&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The API key and the endpoint can be found in the Azure Portal. You can follow these instructions: &lt;a href="https://learn.microsoft.com/en-us/azure/ai-services/openai/quickstart?tabs=command-line&amp;amp;pivots=programming-language-java#retrieve-key-and-endpoint" rel="noopener noreferrer"&gt;Retrieve key and enpoint&lt;/a&gt;. The deployment id corresponds to the &lt;code&gt;deployment name&lt;/code&gt; in &lt;a href="https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/create-resource?pivots=web-portal#deploy-a-model" rel="noopener noreferrer"&gt;this guide&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/prompt-engineering" rel="noopener noreferrer"&gt;Prompt engineering&lt;/a&gt; is important to get the best results from Azure OpenAI. Text prompts are how users interact with GPT models. As with all generative large language model (LLM), GPT models try to produce the next series of words that are the most likely to follow the previous text. It is a bit like asking to the AI model: What is the first thing that comes to mind when I say &lt;code&gt;&amp;lt;prompt&amp;gt;&lt;/code&gt;?&lt;/p&gt;

&lt;p&gt;With the &lt;a href="https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/chatgpt?pivots=programming-language-chat-completions" rel="noopener noreferrer"&gt;Chat Completion API&lt;/a&gt;, there are distinct sections of the prompt that are sent to the API associated with a specific role: system, user and assitant. The system message is included at the begining of the prompt and is used to provides the initial instructions to the model: description of the assitant, personality traits, instructions/rules it will follow, etc.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;AI Shopping Cart Service&lt;/code&gt; is using &lt;a href="https://learn.microsoft.com/en-us/java/api/overview/azure/ai-openai-readme" rel="noopener noreferrer"&gt;Azure OpenAI client library for Java&lt;/a&gt;. This libary is part of of &lt;a href="https://learn.microsoft.com/en-us/azure/developer/java/sdk/" rel="noopener noreferrer"&gt;Azure SDK for Java&lt;/a&gt;. It is implemented as a &lt;a href="https://learn.microsoft.com/en-us/java/api/overview/azure/ai-openai-readme?view=azure-java-preview#chat-completions" rel="noopener noreferrer"&gt;chat completion&lt;/a&gt;. In the service, we have 2 system messages in &lt;a href="//src/ai-shopping-cart-service/src/main/java/com/microsoft/azure/samples/aishoppingcartservice/openai/SystemMessageConstants.java"&gt;SystemMessageConstants.java&lt;/a&gt;: one for AI Nutrition Analysis and one to generate top 3 recipes. The system message is followed by a user message: &lt;code&gt;The basket is: &amp;lt;list of items in the basket separated by a comma&amp;gt;&lt;/code&gt;. The assistant message is the response from the model. The service is using the &lt;a href="//src/ai-shopping-cart-service/src/main/java/com/microsoft/azure/samples/aishoppingcartservice/openai/ShoppingCartAiRecommendations.java"&gt;ShoppingCartAiRecommendations&lt;/a&gt; to interact with Azure OpenAI. In this class you will find the code that is responsible for generating the prompt and calling the Azure OpenAI API: &lt;code&gt;getChatCompletion&lt;/code&gt;. To know more about temperature and topP used in this class, please refer to &lt;a href="https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/advanced-prompt-engineering?pivots=programming-language-chat-completions#temperature-and-top_p-parameters" rel="noopener noreferrer"&gt;the documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For &lt;code&gt;gpt-35-turbo&lt;/code&gt; model, more context is added to the user message. This additional context is added at the end of the user message. It provides more information on the format of the JSON that OpenAI model needs to return and ask the model tor return only the JSON without additional text. This additional context is available in &lt;a href="//src/ai-shopping-cart-service/src/main/java/com/microsoft/azure/samples/aishoppingcartservice/openai/UserMessageConstants.java"&gt;UserMessageConstants.java&lt;/a&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
Pre-requisites ⤴️&lt;/li&gt;
&lt;li&gt;
Application Architecture ⤴️&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Application Code
&lt;/h2&gt;

&lt;p&gt;This template is structured to follow the &lt;a href="https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/make-azd-compatible?pivots=azd-create#azd-conventions" rel="noopener noreferrer"&gt;Azure Developer CLI template convetions&lt;/a&gt;. You can learn more about &lt;code&gt;azd&lt;/code&gt; architecture in &lt;a href="https://learn.microsoft.com/azure/developer/azure-developer-cli/make-azd-compatible?pivots=azd-create#understand-the-azd-architecture" rel="noopener noreferrer"&gt;the official documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;[Code](https://github.com/Azure-Samples/app-templates-java-openai-springapps.git)&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Next Steps
&lt;/h2&gt;

&lt;p&gt;At this point, you have a complete application deployed on Azure. &lt;/p&gt;

&lt;h3&gt;
  
  
  Enterprise Scenarios
&lt;/h3&gt;

&lt;p&gt;For enterprise needs, looking for polyglot applications deployment, Tanzu components support and SLA assurance, we recommend to use &lt;a href="https://learn.microsoft.com/en-us/azure/spring-apps/overview#enterprise-plan" rel="noopener noreferrer"&gt;Azure Spring Apps Enterprise&lt;/a&gt;. Check the &lt;a href="https://github.com/Azure/azure-spring-apps-landing-zone-accelerator" rel="noopener noreferrer"&gt;Azure Spring Apps landing zone accelerator&lt;/a&gt; that provides architectural guidance designed to streamline the production ready infrastructure provisioning and deployment of Spring Boot and Spring Cloud applications to Azure Spring Apps. As the workload owner, use &lt;a href="https://learn.microsoft.com/en-us/azure/cloud-adoption-framework/scenarios/app-platform/spring-apps/landing-zone-accelerator" rel="noopener noreferrer"&gt;architectural guidance&lt;/a&gt; provided in landing zone accelerator to achieve your target technical state with confidence.&lt;/p&gt;

&lt;h3&gt;
  
  
  Azure Developer CLI
&lt;/h3&gt;

&lt;p&gt;You have deployed the sample application using Azure Developer CLI, however there is much more that the Azure Developer CLI can do. These next steps will introduce you to additional commands that will make creating applications on Azure much easier. Using the Azure Developer CLI, you can setup your pipelines, monitor your application, test and debug locally.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://learn.microsoft.com/azure/developer/azure-developer-cli/reference#azd-down" rel="noopener noreferrer"&gt;&lt;code&gt;azd down&lt;/code&gt;&lt;/a&gt; - to delete all the Azure resources created with this template &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href="https://learn.microsoft.com/azure/developer/azure-developer-cli/configure-devops-pipeline?tabs=GitHub" rel="noopener noreferrer"&gt;&lt;code&gt;azd pipeline config&lt;/code&gt;&lt;/a&gt; - to configure a CI/CD pipeline (using GitHub Actions or Azure DevOps) to deploy your application whenever code is pushed to the main branch.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Several environment variables / secrets need to be set for Azure OpenAI resource:&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;AZURE_OPENAI_API_KEY&lt;/code&gt;: API key for Azure OpenAI resource

&lt;ul&gt;
&lt;li&gt;For GitHub workflows, you should use &lt;a href="https://docs.github.com/en/actions/reference/encrypted-secrets" rel="noopener noreferrer"&gt;GitHub Secrets&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;For Azure DevOps pipelines, you check 'Keep this value secret' when creating the variable&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;
&lt;code&gt;AZURE_OPENAI_ENDPOINT&lt;/code&gt;: Endpoint for Azure OpenAI resource&lt;/li&gt;

&lt;li&gt;
&lt;code&gt;AZURE_OPENAI_DEPLOYMENT_ID&lt;/code&gt;: Deployment ID/name for Azure OpenAI resource&lt;/li&gt;

&lt;li&gt;
&lt;code&gt;IS_AZURE_OPENAI_GPT4_MODEL&lt;/code&gt;: Set to &lt;code&gt;true&lt;/code&gt; if you are using GPT-4 model and to &lt;code&gt;false&lt;/code&gt; if you are using GPT-3.5 Turbo model&lt;/li&gt;

&lt;/ul&gt;

&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;a href="https://learn.microsoft.com/azure/developer/azure-developer-cli/monitor-your-app" rel="noopener noreferrer"&gt;&lt;code&gt;azd monitor&lt;/code&gt;&lt;/a&gt; - to monitor the application and quickly navigate to the various Application Insights dashboards (e.g. overview, live metrics, logs)&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;a href="https://learn.microsoft.com/azure/developer/azure-developer-cli/debug?pivots=ide-vs-code" rel="noopener noreferrer"&gt;Run and Debug Locally&lt;/a&gt; - using Visual Studio Code and the Azure Developer CLI extension&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  Additional &lt;code&gt;azd&lt;/code&gt; commands
&lt;/h3&gt;

&lt;p&gt;The Azure Developer CLI includes many other commands to help with your Azure development experience. You can view these commands at the terminal by running &lt;code&gt;azd help&lt;/code&gt;. You can also view the full list of commands on our &lt;a href="https://aka.ms/azure-dev/ref" rel="noopener noreferrer"&gt;Azure Developer CLI command&lt;/a&gt; page.&lt;/p&gt;

&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;p&gt;These are additional resources that you can use to learn more about the sample application and its underlying technologies.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://techcommunity.microsoft.com/t5/apps-on-azure-blog/start-from-zero-and-scale-to-zero-azure-spring-apps-consumption/ba-p/3774825" rel="noopener noreferrer"&gt;Start from zero and scale to zero – Azure Spring Apps consumption plan&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Azure Spring Apps Consumption - Networking and Security
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://learn.microsoft.com/en-us/azure/ai-services/cognitive-services-virtual-networks?context=%2Fazure%2Fai-services%2Fopenai%2Fcontext%2Fcontext&amp;amp;tabs=portal" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/azure/ai-services/openai/encrypt-data-at-rest&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.microsoft.com/en-us/azure/ai-services/openai/encrypt-data-at-rest" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/azure/ai-services/openai/encrypt-data-at-rest&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/managed-identity" rel="noopener noreferrer"&gt;How to configure Azure OpenAI Service with managed identities&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Data Collection
&lt;/h2&gt;

&lt;p&gt;The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft's privacy statement. Our privacy statement is located at &lt;a href="https://go.microsoft.com/fwlink/?LinkId=521839" rel="noopener noreferrer"&gt;https://go.microsoft.com/fwlink/?LinkId=521839&lt;/a&gt;. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.&lt;/p&gt;

&lt;h2&gt;
  
  
  Telemetry Configuration
&lt;/h2&gt;

&lt;p&gt;Telemetry collection is on by default.&lt;/p&gt;

&lt;p&gt;To opt-out, set the variable enableTelemetry to false in &lt;code&gt;infra/main.parameters.json&lt;/code&gt; or in bicep template &lt;code&gt;infra/main.bicep&lt;/code&gt;. It can be set using the following command when the provisioning is done with Azure Developer CLI:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;azd &lt;span class="nb"&gt;env set &lt;/span&gt;enableTelemetry &lt;span class="nb"&gt;false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Push your fork to GitHub:&lt;/p&gt;

&lt;p&gt;In GitHub, create a pull request&lt;/p&gt;

&lt;p&gt;If we suggest changes then:&lt;/p&gt;

&lt;p&gt;Make the required updates.&lt;/p&gt;

&lt;p&gt;Rebase your fork and force push to your GitHub repository (this will update your Pull Request):&lt;/p&gt;

&lt;p&gt;git rebase main -i&lt;br&gt;
git push -f&lt;br&gt;
That's it! Happy Contributing !!&lt;/p&gt;

&lt;p&gt;For More such content and Open Source Project Tutorial Guide, Please follow, share and like.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.linkedin.com/in/nashet-ali-464a65115/" rel="noopener noreferrer"&gt;https://www.linkedin.com/in/nashet-ali-464a65115/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>opensource</category>
      <category>openapi</category>
      <category>azure</category>
    </item>
    <item>
      <title>Open Source LLM: Llama 2</title>
      <dc:creator>Syed Nashet Ali</dc:creator>
      <pubDate>Tue, 08 Aug 2023 13:51:51 +0000</pubDate>
      <link>https://dev.to/nashetking/open-source-llm-llama-2-4icc</link>
      <guid>https://dev.to/nashetking/open-source-llm-llama-2-4icc</guid>
      <description>&lt;p&gt;In this Blog, I will give you a description about Llama 2 from Meta' s prospective and also the steps on how you can contribute to Meta's Model:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Llama 2&lt;/strong&gt;&lt;br&gt;
Meta has unlocked the power of large language models. Meta's latest version of Llama is now accessible to individuals, creators, researchers and businesses of all sizes so that they can experiment, innovate and scale their ideas responsibly.&lt;/p&gt;

&lt;p&gt;This release includes model weights and starting code for pretrained and fine-tuned Llama language models — ranging from 7B to 70B parameters.&lt;/p&gt;

&lt;p&gt;This repository is intended as a minimal example to load Llama 2 models and run inference. For more detailed examples leveraging HuggingFace, see llama-recipes.&lt;/p&gt;

&lt;p&gt;Updates post-launch&lt;br&gt;
See UPDATES.md.&lt;/p&gt;

&lt;p&gt;Download&lt;br&gt;
⚠️ 7/18: We're aware of people encountering a number of download issues today. Anyone still encountering issues should remove all local files, re-clone the repository, and request a new download link. It's critical to do all of these in case you have local corrupt files. When you receive the email, copy only the link text - it should begin with &lt;a href="https://download.llamameta.net"&gt;https://download.llamameta.net&lt;/a&gt; and not with &lt;a href="https://l.facebook.com"&gt;https://l.facebook.com&lt;/a&gt;, which will give errors.&lt;/p&gt;

&lt;p&gt;In order to download the model weights and tokenizer, please visit the Meta AI website and accept our License.&lt;/p&gt;

&lt;p&gt;Once your request is approved, you will receive a signed URL over email. Then run the download.sh script, passing the URL provided when prompted to start the download. Make sure that you copy the URL text itself, do not use the 'Copy link address' option when you right click the URL. If the copied URL text starts with: &lt;a href="https://download.llamameta.net"&gt;https://download.llamameta.net&lt;/a&gt;, you copied it correctly. If the copied URL text starts with: &lt;a href="https://l.facebook.com"&gt;https://l.facebook.com&lt;/a&gt;, you copied it the wrong way.&lt;/p&gt;

&lt;p&gt;Pre-requisites: make sure you have wget and md5sum installed. Then to run the script: ./download.sh.&lt;/p&gt;

&lt;p&gt;Keep in mind that the links expire after 24 hours and a certain amount of downloads. If you start seeing errors such as 403: Forbidden, you can always re-request a link.&lt;/p&gt;

&lt;p&gt;Access on Hugging Face&lt;br&gt;
We are also providing downloads on Hugging Face. You must first request a download from the Meta AI website using the same email address as your Hugging Face account. After doing so, you can request access to any of the models on Hugging Face and within 1-2 days your account will be granted access to all versions.&lt;/p&gt;

&lt;p&gt;Setup&lt;br&gt;
In a conda env with PyTorch / CUDA available, clone the repo and run in the top-level directory:&lt;/p&gt;

&lt;p&gt;pip install -e .&lt;br&gt;
Inference&lt;br&gt;
Different models require different model-parallel (MP) values:&lt;/p&gt;

&lt;p&gt;Model   MP&lt;br&gt;
7B  1&lt;br&gt;
13B 2&lt;br&gt;
70B 8&lt;br&gt;
All models support sequence length up to 4096 tokens, but we pre-allocate the cache according to max_seq_len and max_batch_size values. So set those according to your hardware.&lt;/p&gt;

&lt;p&gt;Pretrained Models&lt;br&gt;
These models are not finetuned for chat or Q&amp;amp;A. They should be prompted so that the expected answer is the natural continuation of the prompt.&lt;/p&gt;

&lt;p&gt;See example_text_completion.py for some examples. To illustrate, see command below to run it with the llama-2-7b model (nproc_per_node needs to be set to the MP value):&lt;/p&gt;

&lt;p&gt;torchrun --nproc_per_node 1 example_text_completion.py \&lt;br&gt;
    --ckpt_dir llama-2-7b/ \&lt;br&gt;
    --tokenizer_path tokenizer.model \&lt;br&gt;
    --max_seq_len 128 --max_batch_size 4&lt;br&gt;
Fine-tuned Chat Models&lt;br&gt;
The fine-tuned models were trained for dialogue applications. To get the expected features and performance for them, a specific formatting defined in chat_completion needs to be followed, including the INST and &amp;lt;&amp;gt; tags, BOS and EOS tokens, and the whitespaces and breaklines in between (we recommend calling strip() on inputs to avoid double-spaces).&lt;/p&gt;

&lt;p&gt;You can also deploy additional classifiers for filtering out inputs and outputs that are deemed unsafe. See the llama-recipes repo for an example of how to add a safety checker to the inputs and outputs of your inference code.&lt;/p&gt;

&lt;p&gt;Examples using llama-2-7b-chat:&lt;/p&gt;

&lt;p&gt;torchrun --nproc_per_node 1 example_chat_completion.py \&lt;br&gt;
    --ckpt_dir llama-2-7b-chat/ \&lt;br&gt;
    --tokenizer_path tokenizer.model \&lt;br&gt;
    --max_seq_len 512 --max_batch_size 4&lt;br&gt;
Llama 2 is a new technology that carries potential risks with use. Testing conducted to date has not — and could not — cover all scenarios. In order to help developers address these risks, we have created the Responsible Use Guide. More details can be found in our research paper as well.&lt;/p&gt;

&lt;p&gt;Issues&lt;br&gt;
Please report any software “bug,” or other problems with the models through one of the following means:&lt;/p&gt;

&lt;p&gt;Reporting issues with the model: github.com/facebookresearch/llama&lt;br&gt;
Reporting risky content generated by the model: developers.facebook.com/llama_output_feedback&lt;br&gt;
Reporting bugs and security concerns: facebook.com/whitehat/info&lt;br&gt;
Model Card&lt;br&gt;
See MODEL_CARD.md.&lt;/p&gt;

&lt;p&gt;License&lt;br&gt;
Our model and weights are licensed for both researchers and commercial entities, upholding the principles of openness. Our mission is to empower individuals, and industry through this opportunity, while fostering an environment of discovery and ethical AI advancements.&lt;/p&gt;

&lt;p&gt;See the LICENSE file, as well as our accompanying Acceptable Use Policy&lt;/p&gt;

&lt;p&gt;References&lt;br&gt;
Research Paper&lt;br&gt;
Llama 2 technical overview&lt;br&gt;
Open Innovation AI Research Community&lt;br&gt;
Original LLaMA&lt;br&gt;
The repo for the original llama release is in the llama_v1 branch.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Contributing to Llama&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We want to make contributing to this project as easy and transparent as possible.&lt;/p&gt;

&lt;p&gt;Pull Requests&lt;br&gt;
We actively welcome your pull requests.&lt;/p&gt;

&lt;p&gt;Fork the repo and create your branch from main.&lt;br&gt;
If you've added code that should be tested, add tests.&lt;br&gt;
If you've changed APIs, update the documentation.&lt;br&gt;
Ensure the test suite passes.&lt;br&gt;
Make sure your code lints.&lt;br&gt;
If you haven't already, complete the Contributor License Agreement ("CLA").&lt;br&gt;
Contributor License Agreement ("CLA")&lt;br&gt;
In order to accept your pull request, we need you to submit a CLA. You only need to do this once to work on any of Meta's open source projects.&lt;/p&gt;

&lt;p&gt;Complete your CLA here: &lt;a href="https://code.facebook.com/cla"&gt;https://code.facebook.com/cla&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Issues&lt;br&gt;
We use GitHub issues to track public bugs. Please ensure your description is clear and has sufficient instructions to be able to reproduce the issue.&lt;/p&gt;

&lt;p&gt;Meta has a bounty program for the safe disclosure of security bugs. In those cases, please go through the process outlined on that page and do not file a public issue.&lt;/p&gt;

&lt;p&gt;License&lt;br&gt;
By contributing to Llama, you agree that your contributions will be licensed under the LICENSE file in the root directory of this source tree.&lt;/p&gt;

&lt;p&gt;Please to like, share and follow for more such Content!!!&lt;br&gt;
&lt;a href="https://www.youtube.com/@Cloudify_with_Nashet/featured"&gt;https://www.youtube.com/@Cloudify_with_Nashet/featured&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.linkedin.com/in/nashet-ali-464a65115/"&gt;https://www.linkedin.com/in/nashet-ali-464a65115/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://twitter.com/NashetKing"&gt;https://twitter.com/NashetKing&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Sa3Jdr1Y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/Llama2.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Sa3Jdr1Y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/Llama2.jpg" alt="Open Source LLM" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>llm</category>
      <category>opensource</category>
      <category>ai</category>
    </item>
    <item>
      <title>New Azure for Operators solutions and services built for the future of telecommunications</title>
      <dc:creator>Syed Nashet Ali</dc:creator>
      <pubDate>Thu, 02 Mar 2023 21:02:38 +0000</pubDate>
      <link>https://dev.to/nashetking/new-azure-for-operators-solutions-and-services-built-for-the-future-of-telecommunications-25dm</link>
      <guid>https://dev.to/nashetking/new-azure-for-operators-solutions-and-services-built-for-the-future-of-telecommunications-25dm</guid>
      <description>&lt;p&gt;After years of laying the foundation for the rollout of 5G and network cloudification, we are now seeing tremendous possibilities for how consumers and organizations will interact with technology for work, play, and connecting with communities. Around the world and across industries, 5G, augmented and virtual reality, AI, IoT, and edge computing are creating opportunities for rapid digital transformation. This is compelling operators to move away from legacy systems to accelerate network transformation and begin monetizing their investments in 5G and edge technologies.&lt;/p&gt;

&lt;p&gt;Imagine the benefits to communities and organizations that have access to improved bandwidth, reliability, and reduced latency, while leveraging the rich capabilities of cloud-to-edge technology without compromise to security, critical services, or key workloads.&lt;/p&gt;

&lt;p&gt;With the most complete offerings for the telecommunications industry, Microsoft is the ideal cloud provider to help operators with their digital transformation journey and enable them to deliver these innovative services to their consumer, enterprise, and public sector customers.&lt;/p&gt;

&lt;p&gt;Azure for Operators&lt;br&gt;
With Azure for Operators, we’re empowering operators to unlock the power of 5G by bringing cloud and edge closer together to modernize their networks so that they can streamline and optimize their business operations and deliver new services faster with greater reach and lower cost. With solutions that run on-premises, at the edge, or in the cloud but are always managed and secured by Azure, Microsoft meets you where you are, offering flexibility to transform on your terms and timelines. We are committed to partnering with you, not competing against you. Your consumer, enterprise, and government customers will benefit from a cloud platform with industry-leading security and governance built-in, and with an unmatched partner and developer ecosystem to maximize the value of the cloud at the edge. We’re applying Microsoft technology and developer ecosystem capabilities to offer the next-generation Azure for Operators portfolio—carrier-grade hybrid cloud platform, voice core, mobile core, and multi-access edge compute.&lt;/p&gt;

&lt;p&gt;Introducing the new Azure for Operators solutions and services&lt;br&gt;
In September 2020, we unveiled the Azure for Operators initiative to help operators evolve their own networks, and for partners to assist enterprises to maximize their industry 4.0 opportunities. In June of 2021, we introduced a new category, Azure private multi-access edge compute (MEC), which empowers operators and system integrators to unlock the enterprise 5G opportunity. Today, we’re announcing the next wave of Azure for Operators solutions and services.&lt;/p&gt;

&lt;p&gt;New Azure for Operators solutions and services&lt;/p&gt;

&lt;p&gt;The hybrid cloud platform built for the future of telecommunications&lt;br&gt;
Operators are continually looking toward digital transformation to improve competitiveness, deliver new services, and yield positive financial results through both innovation and growth. We believe telecom digital transformation starts with the modernization of network core systems and operations.&lt;/p&gt;

&lt;p&gt;In June 2021, Microsoft acquired the AT&amp;amp;T Network Cloud 2.7 Software technology, an industry-first collaboration. The AT&amp;amp;T Network Cloud supports AT&amp;amp;T's 5G core and FirstNet today, representing seven years of experience developing on-premises cloud for network workloads. We’ve taken the acquisition of this technology, moved the engineering and program organization from AT&amp;amp;T’s Network Cloud organization into Azure for Operators, and directly integrated the intellectual property into a new Azure offering. We continue to make significant enhancements to the acquired technology itself, including security across AT&amp;amp;T’s entire Network Cloud deployment.&lt;/p&gt;

&lt;p&gt;Today we are announcing the next-generation hybrid cloud platform for operators—Azure Operator Distributed Services—which combines the enhanced version of the acquired AT&amp;amp;T technology with the best of Azure, including our industry-leading security, monitoring, analytics, AI, machine learning, and so much more.&lt;/p&gt;

&lt;p&gt;Built from the ground up and proven to run network-intensive workloads and mission-critical applications, Azure Operator Distributed Services meets the security, resiliency, observability, manageability, and performance needs required by operators to achieve meaningful results from digital transformation. It will enable operators to run all their workloads (such as core, RAN, mobile and voice core, OSS, and BSS) on a single carrier-grade hybrid platform. With Azure Operator Distributed Services, business operations can be streamlined, providing operators with simplified management, policy, and automation delivered through unified cloud management using Azure Services, Azure Arc management, Azure Security, and platform as a service with Azure. Azure Operator Distributed Services provides the flexibility and scalability to support customer deployments at the edge of the cloud, the edge of the network, or the enterprise edge. Now, operators can effectively create new services to monetize their network, all while gaining robust network and customer insights that are necessary to facilitate proactive decision-making, critical action, and the creation of real value.&lt;/p&gt;

&lt;p&gt;With Azure Operator Distributed Services, we are delivering a carrier-grade hybrid cloud service to the market and AT&amp;amp;T where it can run at AT&amp;amp;T on-premises or on Azure public cloud. Azure Operator Distributed Services is designed to support the AT&amp;amp;T mobile core network that today spans more than 60 containerized network functions (CNFs) and virtual network functions (VNFs) from 15 different vendors, which currently are deployed and running on the AT&amp;amp;T Network Cloud platform. AT&amp;amp;T will continue to select and manage VNFs and CNFs and their configurations to deliver mobility services to AT&amp;amp;T customers. AT&amp;amp;T and Microsoft are closely collaborating on the deployment of Azure Operator Distributed Services with initial testing stages planned for later this year.&lt;/p&gt;

&lt;p&gt;“AT&amp;amp;T's 5G network is built on an agile, future-ready mobile core that's designed to boost innovation, resiliency, and security for our customers. Our 5G mobility core is fully cloud-based, integrating Network Functions from multiple vendors that today are hosted on Network Cloud infrastructure based on a cloud software stack that Microsoft acquired from AT&amp;amp;T last year. We are pleased with Microsoft’s plan to evolve Network Cloud and integrate it with Azure technologies to create hybrid telco-grade Azure Operator Distributed Services. This will enable AT&amp;amp;T and other operators to host Network Functions on clouds spanning telco premises and public cloud and will help us realize the many benefits of the cloud-native approach and Azure innovation including additional speed, resiliency, security, cost, and operational improvements.“—Andre Fuetsch, Executive Vice President and CTO Network Services, AT&amp;amp;T&lt;/p&gt;

&lt;p&gt;We designed the Azure Operator Distributed Services for use by all operators while maintaining security and without losing differentiation. In terms of security and privacy, we want to make clear that operators using Azure Operator Distributed Services continue to hold access to their customer data, Microsoft cannot access or see it. With this product, we want to enable operators to deliver new services faster and more flexibly across Azure public cloud and on-premises with common tooling and services, reducing time-to-market with a cloud-native approach. True to our mission of empowering everyone to achieve more, we are collaborating with the broader partner ecosystem, including Ericsson and Nokia, to build on our next-gen hybrid cloud platform for operators.&lt;/p&gt;

&lt;p&gt;“Combined with cloud capabilities, 5G has the potential to accelerate the digital transformation of virtually any sector of industry or society. The combination of Azure Operator Distributed Services and Ericsson’s market-leading cloud-native network functions and orchestration suite promise significant benefits for customers. Microsoft and Ericsson are jointly exploring enterprise 5G use cases in conjunction with leading operators.”—Jan Karlsson, Senior Vice President and Head of Business Area Digital Services, Ericsson&lt;/p&gt;

&lt;p&gt;“Open collaboration is key to the development of new and innovative high value 5G use cases that will equip our customers with the tools they need for digital transformation. This is part of Nokia’s continued commitment to leading an open mobile future, making it simple for our customers to take advantage of the 5G world, helping to drive it forward. We are enthusiastic to work closely with Microsoft to integrate our Cloud RAN technology with Microsoft Azure, offer Microsoft Azure IoT Edge Services allowing industries to realize new capabilities at the edge, and bring Nokia’s new SaaS-based NetGuard Cybersecurity Dome as well as other Cloud and Network Services software to Azure.”—Chris D. Jones, Vice President Strategic Partnerships, Strategy and Technology, Nokia&lt;br&gt;
Azure Private 5G Core in 5G.MIL solutions will enable high performance in a small footprint and the ability to support, secure, and scale interconnection between 5G wireless and military networks. “Lockheed Martin’s strategic collaboration with Microsoft unlocks new capabilities that will provide a decisive edge for military personnel across all domains,” said Dan Rice, Vice President of 5G.MIL® Programs at Lockheed Martin. “Leveraging Microsoft’s expertise in cloud computing and distributed system orchestration, we are accelerating the scale and speed of critical military communications, which will be necessary in increasingly contested environments.”&lt;br&gt;
HARMAN Digital Transformation Solutions (DTS) has employed Azure private MEC to successfully advance digital transformation at one of the largest airports in the United States. The solution improved operational efficiencies for the airport’s manual cargo handling process. "Advances in technologies like 5G yield significant opportunity to accelerate innovation across nearly every industry—from transportation and healthcare to manufacturing and education,” said David Owens, Senior Vice President and General Manager, Digital Transformation Solutions, HARMAN. “HARMAN's deep knowledge and experience in the communications domain and Azure private MEC offers a comprehensive solution to enterprises planning to deploy private networks and cloud computing applications. We are glad to join hands with Microsoft in re-shaping the future by elevating experiences for our customers and end consumers."&lt;br&gt;
"Northrop Grumman’s advanced battle management technologies allow military forces to effectively communicate and securely share mission-critical data across all domains. With the integration of the Azure private MEC platform, we are leveraging Microsoft’s commercial-edge computing capabilities to inform tactical mobile ad hoc networks for the U.S. Navy’s Information Warfare Research Project.”—Tom Pieronek, Chief Technology Officer, Aeronautics Systems, Northrop Grumman&lt;br&gt;
"As a pioneer in digital transformation, Fujitsu is committed to helping enterprises and telcos accelerate adoption of 5G. Our market-leading O-RAN solutions and managed services offerings, combined with the power of Microsoft’s Azure private MEC offering, will play an important role in delivering 5G solutions to market, enabling rich customer experiences at the convergence of 5G, digital, and the edge.”—Shingo Mizuno, Corporate Executive Officer, Fujitsu Limited&lt;br&gt;
"We are entering a new era of enterprise digital transformation that will be fueled by private networks, edge computing, secure access service edge, and amplification of industry-specific applications. Along with Microsoft, we are making it easy for enterprises to order, provision, and consume full suite of infrastructure capabilities and applications—the cloud way"—Manish Mangal, Global Head of 5G and Network Services, Tech Mahindra&lt;/p&gt;

&lt;p&gt;transformation journeys through adopting advanced technologies such as autonomous robots, vehicles, and drones, as well as Metaverse applications, into their enterprise operations through a single unified platform.”—Bill Chang, CEO, Group Enterprise, Singtel&lt;/p&gt;

&lt;p&gt;Telstra announced customer trials of Australia’s first 5G-enabled edge compute solution for enterprises (Branch Offload) through a collaboration with Microsoft and Ericsson that will use technologies including Telstra’s 5G and fixed connectivity, Azure Stack Edge, Secure Edge, SD-WAN and service orchestration, and will be delivered as a managed service by Telstra Purple. Nikos Katinakis, Telstra’s Group Executive for Networks and IT said, “Telstra’s collaboration with our major strategic partners, Microsoft and Ericsson, continues to enable us to break new ground, leveraging new technologies and our smarter network to standardize solutions and that will help Australian businesses adapt for the digital future.”&lt;/p&gt;

&lt;p&gt;“Technical trials demonstrated how Azure public MEC and AT&amp;amp;T’s 5G mobile network-enabled Summit Tech’s Odience 360 8K live streaming platform with built-in e-commerce to bring immersive and interactive experiences to use cases such as shopping, live concerts, sports stadiums, and eSports. MEC video processing yielded up to 80 percent bandwidth reduction, imperceptible motion-to-photon delay, and impressive glass-to-glass low latency for true two-way interactivity. Check out the demo video to learn more."—Doug Makishima, Chief Sales, and Marketing Officer (CSMO), Summit Tech&lt;/p&gt;

&lt;p&gt;"As the requirements of modern applications continue to evolve, Couchbase is collaborating with Microsoft and Azure public MEC to bring the cloud and the edge closer together for customers. Azure public MEC and Couchbase’s modern database enables developers to build next-gen edge use cases."—Matt McDonough, SVP Business Development and Strategy, Couchbase&lt;/p&gt;

&lt;p&gt;Watch this ISV testimonial to hear from Citrix, Spirent, Game Cloud, VMware, and Fortinet about how they are working with Microsoft to build and deliver public MEC solutions.&lt;/p&gt;

</description>
      <category>watercooler</category>
    </item>
    <item>
      <title>AWS is powering the continued advancement of Autonomous Vehicle (AV) development.</title>
      <dc:creator>Syed Nashet Ali</dc:creator>
      <pubDate>Mon, 19 Dec 2022 17:53:10 +0000</pubDate>
      <link>https://dev.to/nashetking/aws-is-powering-the-continued-advancement-of-autonomous-vehicle-av-development-2c8d</link>
      <guid>https://dev.to/nashetking/aws-is-powering-the-continued-advancement-of-autonomous-vehicle-av-development-2c8d</guid>
      <description>&lt;p&gt;Developing and deploying Advanced Driver-Assistance Systems (ADAS) and AV Systems requires a development platform with highly scalable compute, storage, networking, as well analytics and deep learning frameworks. This platform requires capabilities that allow for the collection, ingestion, storage, processing and analytics, labeling and annotation, map development, algorithm and model development, simulations, verification and validation, and workspace management functions (inclusive of MLOps and DevOps). Leading automotive customers turn to AWS as their ADAS/AV development platform for our breadth and depth of managed services, solutions, experience, and partner community to deliver the architecture and technology required for to develop safe, reliable, and cost-optimized autonomous and ADAS systems.&lt;br&gt;
Benefits&lt;br&gt;
Unmatched compute storage and network scale&lt;br&gt;
AWS solves petabyte-scale data processing, storage, and management needs by delivering thousands of cores of compute for development and validation.&lt;br&gt;
Accelerate time to market&lt;br&gt;
Building on AWS helps customers optimize their software engineering to be more agile, reducing development and validation costs and supporting a faster time to market.&lt;br&gt;
Multiple ways to control cost&lt;br&gt;
AWS has the most classes of storage of any cloud resulting in increased cost efficiency because data can be configured and paid for based on the frequency of access, durability, and availability requirements.&lt;/p&gt;

&lt;p&gt;Thanks &amp;amp; Regards,&lt;br&gt;
Nashet Ali.&lt;br&gt;
Cloud Expert.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>aws</category>
      <category>selfdrivingca</category>
      <category>cloudnative</category>
    </item>
    <item>
      <title>Serverless Computing - AWS Lambda - Amazon Web Services</title>
      <dc:creator>Syed Nashet Ali</dc:creator>
      <pubDate>Fri, 19 Aug 2022 17:58:42 +0000</pubDate>
      <link>https://dev.to/nashetking/serverless-computing-aws-lambda-amazon-web-services-3ofm</link>
      <guid>https://dev.to/nashetking/serverless-computing-aws-lambda-amazon-web-services-3ofm</guid>
      <description>&lt;p&gt;What is Serverless?&lt;br&gt;
Serverless is a term that generally refers to serverless applications. Serverless applications are ones that don’t need any server provision and do not require to manage servers.&lt;/p&gt;

&lt;p&gt;What is AWS Lambda?&lt;br&gt;
AWS Lambda is an event-driven, serverless computing platform provided by Amazon as a part of Amazon Web Services. Therefore you don’t need to worry about which AWS resources to launch, or how will you manage them. Instead, you need to put the code on Lambda, and it runs.&lt;/p&gt;

&lt;p&gt;In AWS Lambda the code is executed based on the response of events in AWS services such as add/delete files in S3 bucket, HTTP request from Amazon API gateway, etc. However, Amazon Lambda can only be used to execute background tasks.&lt;/p&gt;

&lt;p&gt;AWS Lambda function helps you to focus on your core product and business logic instead of managing operating system (OS) access control, OS patching, right-sizing, provisioning, scaling, etc.&lt;/p&gt;

&lt;p&gt;In this AWS Lambda tutorial for beginners, you will learn:&lt;/p&gt;

&lt;p&gt;How does AWS Lambda work?&lt;br&gt;
Events that Trigger AWS Lambda&lt;br&gt;
AWS Lambda Concepts&lt;br&gt;
AWS Lambda VS AWS EC2&lt;br&gt;
AWS Lambda VS AWS Elastic Beanstalk&lt;br&gt;
Use Cases of AWS Lambda&lt;br&gt;
Best practices of Lambda function&lt;br&gt;
When not to use AWS Lambda&lt;br&gt;
Advantages of using AWS Lambda&lt;br&gt;
Limitations of AWS Lambda&lt;br&gt;
How does AWS Lambda work?&lt;br&gt;
The following AWS Lambda example with block diagram explains the working of AWS Lambda in a few easy steps:&lt;br&gt;
Step 1: First upload your AWS Lambda code in any language supported by AWS Lambda. Java, Python, Go, and C# are some of the languages that are supported by AWS Lambda function.&lt;/p&gt;

&lt;p&gt;Step 2: These are some AWS services which allow you to trigger AWS Lambda.&lt;/p&gt;

&lt;p&gt;Step 3: AWS Lambda helps you to upload code and the event details on which it should be triggered.&lt;/p&gt;

&lt;p&gt;Step 4: Executes AWS Lambda Code when it is triggered by AWS services:&lt;/p&gt;

&lt;p&gt;Step 5: AWS charges only when the AWS lambda code executes, and not otherwise.&lt;/p&gt;

&lt;p&gt;This will happen in the following scenarios:&lt;/p&gt;

&lt;p&gt;Upload files in an S3 bucket&lt;br&gt;
When HTTP get/post endpoint URL is hit&lt;br&gt;
For adding/modifying and deleting Dynamo DB tables&lt;br&gt;
In the process of data streams collection&lt;br&gt;
Push notification&lt;br&gt;
Hosting of website&lt;br&gt;
Email sending&lt;br&gt;
Note: You should remember that you will charge for AWS services only when the AWS Lambda code executes, else you don’t need to pay anything.&lt;br&gt;
Events that Trigger AWS Lambda&lt;br&gt;
Here, are Events which will be triggered when you use AWS Lambda.&lt;/p&gt;

&lt;p&gt;Insert, updating and deleting data Dynamo DB table&lt;br&gt;
To include push notifications in SNS&lt;br&gt;
To search for log history in CloudTrail&lt;br&gt;
Entry into an S3 object&lt;br&gt;
DynamoDB can trigger AWS Lambda whenever there is data added, modified, and deleted in the table.&lt;br&gt;
Helps you to schedule the event to carry out the task at regular time pattern.&lt;br&gt;
Modifications to objects in S3 buckets&lt;br&gt;
Notifications sent from Amazon SNS.&lt;br&gt;
AWS Lambda can be used to process the CloudTrail logs&lt;br&gt;
API Gateway allows you to trigger AWS Lambda on GET/POST methods.&lt;br&gt;
AWS Lambda Concepts&lt;br&gt;
Function:&lt;/p&gt;

&lt;p&gt;A function is a program or a script which runs in AWS Lambda. Lambda passes invocation events into your function, which processes an event and returns its response.&lt;/p&gt;

&lt;p&gt;Runtimes:&lt;/p&gt;

&lt;p&gt;Runtime allows functions in various languages which runs on the same base execution environment. This helps you to configure your function in runtime. It also matches your selected programming language.&lt;/p&gt;

&lt;p&gt;Event source:&lt;/p&gt;

&lt;p&gt;An event source is an AWS service, such as Amazon SNS, or a custom service. This triggers function helps you to executes its logic.&lt;/p&gt;

&lt;p&gt;Lambda Layers:&lt;/p&gt;

&lt;p&gt;Lambda layers are an important distribution mechanism for libraries, custom runtimes, and other important function dependencies. This AWS component also helps you to manage your development function code separately from the unchanging code and resources that it uses.&lt;/p&gt;

&lt;p&gt;Log streams:&lt;/p&gt;

&lt;p&gt;Log stream allows you to annotate your function code with custom logging statements which helps you to analyse the execution flow and performance of your AWS Lambda functions.&lt;/p&gt;

&lt;p&gt;How to use AWS Lambda&lt;br&gt;
Now, we will learn how to use AWS Lambda with AWS Lambda example:&lt;/p&gt;

&lt;p&gt;Step 1) Step 1) Open AWS Lambda URL&lt;br&gt;
Goto &lt;a href="https://aws.amazon.com/lambda/"&gt;https://aws.amazon.com/lambda/&lt;/a&gt; and Get Started&lt;/p&gt;

&lt;p&gt;Get Started with AWS Lambda&lt;br&gt;
Step 2) Create an account&lt;br&gt;
Next, Create an account or sign in with your existing account&lt;/p&gt;

&lt;p&gt;Step 3) Edit the code &amp;amp; Click Run,&lt;br&gt;
In the next Lambda page,&lt;/p&gt;

&lt;p&gt;Edit the code&lt;br&gt;
Click Run&lt;br&gt;
AWS Lambda Run Code&lt;br&gt;
Step 4) Check output&lt;br&gt;
You will see output&lt;/p&gt;

&lt;p&gt;AWS Lambda Output&lt;/p&gt;

&lt;p&gt;AWS Lambda VS AWS EC2&lt;br&gt;
Here, are some major differences between AWS Lambda and EC2.&lt;/p&gt;

&lt;p&gt;Parameters  AWS Lambda  AWS EC2&lt;br&gt;
Definition  AWS Lambda is a Platform as a Service (PaaS). It helps you to run and execute your backend code.    AWS EC2 Is an Infrastructure as a Service (laaS). It provides virtualized computing resources.&lt;br&gt;
Flexibility Does not offers any flexibility to log in to compute instances. It allows you to choose a customized operating system or language runtime.  Offers the flexibility to select the variety of instances, customoperating systems, security patches, and network, etc.&lt;br&gt;
Installation process    You need to select your environment where you want to runthe code and push the code into AWS Lambda.    For the first time in EC2, you have to choose the OS and install all the software required and then push your code in EC2.&lt;br&gt;
Environment restrictions    It is restricted to fewlanguages.   No environment restrictions.&lt;br&gt;
AWS Lambda VS AWS Elastic Beanstalk&lt;br&gt;
Here, are some major differences between AWS Lambda and Elastic Beanstalk.&lt;/p&gt;

&lt;p&gt;Parameters  AWS Elastic Beanstalk   AWS Lambda&lt;br&gt;
Main task   Deploy and manage the apps on AWS Cloud without worrying about the infrastructure which runs those applications.    AWS Lambda is used for running and executing your Back-end code. You can’t use it to deploy an application.&lt;br&gt;
Selection of AWS resources  It gives you a Freedom to select AWS resources; For example, you can choose EC2 instance which is optimal according to your application.    You can’t select the AWS resources, like a type of EC2 instance, Lambda offers resources based on your workload.&lt;br&gt;
Type of system  It is a stateful system.    It is a stateless system.&lt;br&gt;
Use Cases of AWS Lambda&lt;br&gt;
AWS Lambda used for a wide range of applications like:&lt;/p&gt;

&lt;p&gt;Helps you for ETL process&lt;br&gt;
Allows you to perform real-time file processing and real-time stream processing&lt;br&gt;
Use for creating web applications&lt;br&gt;
Use in Amazon products like Alexa Chatbots and Amazon Echo/Alexa&lt;br&gt;
Data processing (real-time streaming analytics)&lt;br&gt;
Automated Backups of everyday tasks&lt;br&gt;
Scalable back ends (mobile apps, loT devices)&lt;br&gt;
Helps you to execute server-side backend logic&lt;br&gt;
Allows you to filter and Transform data&lt;br&gt;
Best practices of Lambda function&lt;br&gt;
Here are some best practices of AWS Lambda functions:&lt;/p&gt;

&lt;p&gt;Use the right “timeout.”&lt;br&gt;
Utilize the functions of local storage which is 500MB in size in the /temp folder&lt;br&gt;
Minimizing the use of start-up code which is not directly related to processing the current event.&lt;br&gt;
You should use built-in CloudWatch monitoring of your Lambda functions to view and optimize request latencies.&lt;br&gt;
When not to use AWS Lambda&lt;br&gt;
Following are the situation where Lambda is surely not an ideal option:&lt;/p&gt;

&lt;p&gt;It is not appropriate to use AWS Lambda software packages or applications which rely on calling underlying Windows RPCs&lt;br&gt;
If is used for custom software applications with licensing agreements like MS-Office document processing, Oracle databases, etc.&lt;br&gt;
AWS Lambda should not be used for custom hardware process such as GPU acceleration, hardware affinity.&lt;br&gt;
Advantages of using AWS Lambda&lt;br&gt;
Here, are pros/benefits of using AWS lambda:&lt;/p&gt;

&lt;p&gt;AWS Lambda is a highly flexible tool to use&lt;br&gt;
It helps you to grant access to resources, including VPCs&lt;br&gt;
Author directly with WYSIWYG editor in console.&lt;br&gt;
You can use it as a plugin for Eclipse and Visual Studio.&lt;br&gt;
As it is serverless architecture, you don’t need to worry about managing or provisioning servers.&lt;br&gt;
You do not need to set up any Virtual Machine.&lt;br&gt;
Helps developers to run and execute the code’s response to events without building any infrastructure.&lt;br&gt;
You just need to for the compute time taken, only when your code runs.&lt;br&gt;
You can monitor your code performance in real time through CloudWatch.&lt;br&gt;
It allows you to run your code without provisioning or to manage any other server&lt;br&gt;
Helps you to execute the code only when needed&lt;br&gt;
You can scale it automatically to handle a few requests per day and even support more than thousands of requests per second.&lt;br&gt;
AWS Lambda can be configured with the help of external event timers to perform scheduled tasks.&lt;br&gt;
Lambda function in AWS should be configured with external event and timers so; it can be used for scheduling.&lt;br&gt;
Lambda functions are stateless so that it can be scaled quickly.&lt;br&gt;
AWS Lambda is fast so it will execute your code within milliseconds.&lt;br&gt;
Limitations of AWS Lambda&lt;br&gt;
Here are the cons/disadvantages of using AWS Lambda:&lt;/p&gt;

&lt;p&gt;AWS Lambda tool is not suitable for small projects.&lt;br&gt;
AWS Lambda entirely relies on AWS for the infrastructure, so you can’t install any additional software if your code demands it.&lt;br&gt;
Concurrent execution is limited to 100&lt;br&gt;
AWS Lambda completely depended on AWS for the infrastructure; you cannot install anything additional software if your code demands it.&lt;br&gt;
Its memory volume can vary between 128 to 1536 MB.&lt;br&gt;
Event request should not exceed 128 KB.&lt;br&gt;
Lambda functions help you to write their logs only in CloudWatch. This is the only tool that allows you to monitor or troubleshoot your functions.&lt;br&gt;
Its code execution timeout is just 5 minutes.&lt;br&gt;
Summary&lt;br&gt;
Serverless is a term that generally refers to serverless applications.&lt;br&gt;
AWS Lambda is one such serverless compute service. Therefore, you don’t need to worry about which AWS resources to launch, or how will they manage them.&lt;br&gt;
A function is a program or a script which runs in AWS serverless Lambda.&lt;br&gt;
Runtime allows functions in various languages which runs on the same base execution environment.&lt;br&gt;
An event source is an AWS service, such as Amazon SNS, or a custom service.&lt;br&gt;
Lambda layers are an important distribution mechanism for libraries, custom runtimes, and other important function dependencies.&lt;br&gt;
Log stream allows you to annotate your function code with custom logging statements which helps you to analyse the execution flow and performance of your Lambda functions.&lt;br&gt;
AWS Lambda is a Platform as a Service (PaaS). It helps you to run and execute your backend code.&lt;br&gt;
AWS EC2 Is an Infrastructure as a Service (laaS). It provides virtualized computing resources.&lt;br&gt;
Deploy and manage the apps on AWS Cloud without worrying about the infrastructure which runs those applications.&lt;br&gt;
AWS Lambda is used for running and executing your Back-end code. You can’t use it to deploy an application.&lt;br&gt;
AWS Lambda helps you for the ETL process.&lt;br&gt;
The best practice of Lambda function in AWS is to use the right “timeout.”&lt;br&gt;
It is not appropriate to use AWS Lambda software packages or applications which rely on calling underlying Windows RPCs&lt;br&gt;
AWS Lambda is a highly flexible tool.&lt;br&gt;
AWS Lambda tool is not suitable for small projects.&lt;br&gt;
A common event which will be triggered when you use AWS Lambda is Insert, updating and deleting data Dynamo DB table.&lt;br&gt;
You Might Like:&lt;br&gt;
How to Change Instance Type &amp;amp; Security Group of EC2 in AWS&lt;br&gt;
How to Create EC2 Instance in AWS: Step by Step Tutorial&lt;br&gt;
AWS (Amazon Web Services) Tutorial: Basics for Beginners&lt;br&gt;
Azure vs. AWS: What is the Difference Between AWS and Azure&lt;br&gt;
&lt;a href="https://aws.amazon.com/lambda/"&gt;AWS Lamda Documentation Official&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>coding</category>
      <category>webdev</category>
      <category>serverless</category>
    </item>
  </channel>
</rss>
