ChatGPT, not an AI Overlord... Yet

ChatGPT, not an AI Overlord... Yet

Have you used ChatGPT yet? I finally worked through the mundane functions of opening its URL and logging in. That is where the mundane stopped and shock and awe set in. Chattie, that is the name ChatGPT and I decided it should use, is going to summarize our conversation.

"During our session, we discussed various topics ranging from technology, politics, and climate change. Some of the technical topics included Powershell scripting, MermaidJS diagrams, and Azure cloud services. We also discussed the potential benefits and drawbacks of providing financial support to those in need and the impact of climate change on the planet.

Throughout our conversation, we made discoveries about various topics, such as the usefulness of Powershell scripts in automating administrative tasks, the ease of use of MermaidJS for creating flow diagrams, and the various components that make up an Azure cloud system.

We also discussed the potential effects of climate change, including rising sea levels and increased frequency of natural disasters. Our conversation touched on the evidence supporting the existence of climate change and the potential impact on our planet.

Overall, our session covered a range of topics and led to various discoveries and insights."

I am sure by now many of you have already heard of the amazing things that it can do, so had I. I was most interested in how it will help in developing software, so that is where I started. I hit it with a hard subject that a lot of programmers out there would struggle with, certificates.

---

Me: write a c# function that can update a server certificate for iis

Chattie: Here is an example C# function that uses the Microsoft.Web.Administration namespace to update a server certificate for IIS:

using Microsoft.Web.Administration

public static void UpdateServerCertificate(string siteName, string certificateThumbprint)
{
? ? // Connect to the local IIS server
? ? ServerManager serverManager = new ServerManager();

? ? // Find the site by name
? ? Site site = serverManager.Sites.FirstOrDefault(s => s.Name == siteName);

? ? if (site == null)
? ? {
? ? ? ? throw new ArgumentException($"Site '{siteName}' not found.");
? ? }

? ? // Find the binding with the SSL protocol
? ? Binding binding = site.Bindings.FirstOrDefault(b => b.Protocol == "https");

? ? if (binding == null)
? ? {
? ? ? ? throw new ArgumentException($"Site '{siteName}' does not have an HTTPS binding.");
? ? }


? ? // Load the certificate with the specified thumbprint
? ? X509Store store = new X509Store(StoreName.My, StoreLocation.LocalMachine);
? ? store.Open(OpenFlags.ReadOnly);

? ? X509Certificate2 certificate = store.Certificates.Find(X509FindType.FindByThumbprint, certificateThumbprint, false)
? ? ? ? .OfType<X509Certificate2>()
? ? ? ? .FirstOrDefault();

? ? if (certificate == null)
? ? {
? ? ? ? throw new ArgumentException($"Certificate with thumbprint '{certificateThumbprint}' not found.");
? ? }

? ? // Update the binding with the new certificate
? ? binding.CertificateHash = certificate.GetCertHash();

? ? // Save the changes
? ? serverManager.CommitChanges();
}

;        

Chattie went on to give me examples of how to use the code. It also explained the code step by step. Not bad. So I thought I would work it out a bit

Me: write a function in powershell that uses the posh module to get a new certificate from lets encrypt using domain validation with cloudflare

Chattie: Here is an example PowerShell function that uses the Posh-ACME module to get a new certificate from Let's Encrypt using domain validation with Cloudflare:


function Get-LetsEncryptCertificateWithCloudflare {
? ? [CmdletBinding()]
? ? param(
? ? ? ? [Parameter(Mandatory = $true)]
? ? ? ? [ValidateNotNullOrEmpty()]
? ? ? ? [string]$DomainName,
? ? ? ??
? ? ? ? [Parameter(Mandatory = $true)]
? ? ? ? [ValidateNotNullOrEmpty()]
? ? ? ? [string]$CloudflareApiKey,
? ? ? ??
? ? ? ? [Parameter(Mandatory = $true)]
? ? ? ? [ValidateNotNullOrEmpty()]
? ? ? ? [string]$CertStorePath
? ? )
? ??
? ? # Install the Posh-ACME module if it is not already installed
? ? if (-not (Get-Module -Name Posh-ACME -ErrorAction SilentlyContinue)) {
? ? ? ? Install-Module -Name Posh-ACME -Scope CurrentUser -Force
? ? }
? ??
? ? # Get the Cloudflare DNS API key
? ? $dnsApi = New-PACertificateDnsCloudflare -ApiKey $CloudflareApiKey
? ??
? ? # Register with Let's Encrypt and get a new certificate
? ? Register-PACertificate -DomainName $DomainName -DnsPlugin $dnsApi -AcceptTOS -CertStore $CertStorePath
}        

This function takes three parameters: the domain name to get a certificate for, a Cloudflare API key with the appropriate permissions to manage DNS records for the domain, and the path to the certificate store where the new certificate should be installed.

The function first checks if the Posh-ACME module is installed and installs it if it is not. It then uses the New-PACertificateDnsCloudflare function from the Posh-ACME module to create a new DNS API object for Cloudflare using the provided API key. Finally, the function uses the Register-PACertificate function to register with Let's Encrypt and get a new certificate using domain validation with Cloudflare.

To use this function, you would call it with the domain name, Cloudflare API key, and certificate store path...


Ok, so it can spit out code that perhaps it got off some opensource project somewhere. Lets try something harder.

Me: show me an architectural diagram for running a responsive website on azure using a message bus and cosmosdb

Chattie:

Sure, here is an architectural diagram for running a responsive website on Azure using a message bus and Cosmos DB:

{IMG Missing}

This architecture consists of the following components:

  1. Azure Web App: This is a platform-as-a-service (PaaS) offering from Azure that allows you to host and run web applications. In this architecture, it hosts the responsive website that users interact with.
  2. Azure Cosmos DB: This is a globally distributed, multi-model database service from Azure. It is used in this architecture to store the website's data in a highly available and scalable way.
  3. Azure Service Bus: This is a message broker service from Azure that allows you to decouple different components of your application by passing messages between them. It is used in this architecture to decouple the website's front-end from its back-end services, such as the data access layer.
  4. Azure Functions: This is a serverless compute service from Azure that allows you to run small pieces of code in response to events. It is used in this architecture to process messages that are sent to the Service Bus and to perform data access operations on Cosmos DB.
  5. Azure Storage: This is a cloud-based storage service from Azure that provides object storage for unstructured data. It is used in this architecture to store the binary content of the website's files, such as images and videos.
  6. Azure CDN: This is a content delivery network (CDN) service from Azure that allows you to deliver static assets, such as images and videos, to users in a fast and efficient way. It is used in this architecture to cache the website's static content and deliver it to users from the closest possible server.

Overall, this architecture provides a highly available and scalable platform for hosting a responsive website. By using a message bus and decoupling the different components of the application, it provides flexibility and resilience in the face of changes and failures.


I ask "Can you create flow diagrams?" It responds in the affirmative, so I go on to demand:

create a flow diagram of azure where a web app uses a message bus to call an azure function to store data in cosmodb

It responds with

Sure, here's a flow diagram of Azure where a web app uses a message bus to call an Azure Function to store data in Cosmos DB:

? ? ? ? +---------------+? ? ? ? ? ? ? ? ? ? ? +----------------
? ? ? ? |? ? Web App? ? |? ? ? ? ? ? ? ? ? ? ? |? ?Azure Func? ?|
? ? ? ? +---------------+? ? ? ? ? ? ? ? ? ? ? +----------------+
? ? ? ? ? ? ? ? ?|? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? |
? ? ? ? ? ? ? ? ?|? ? ? ? ? ? ? +-------------------------+
? ? ? ? ? ? ? ? ?|? ? ? ? ? ? ? |
? ? ? ? ? ? ? ? ?|? ? ? ? ? ? ? |
? ? ? ? +--------v--------+? ? ?|
? ? ? ? |? Message Broker |? ? ?|
? ? ? ? +--------+--------+? ? ?|
? ? ? ? ? ? ? ? ?|? ? ? ? ? ? ? |
? ? ? ? ? ? ? ? ?|? ? ? ? ? ? ? |
? ? ? ? +--------v--------+? ? ?|
? ? ? ? |? ? Cosmos DB? ? |? ? ?|
? ? ? ? +----------------+? ? ?|
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? |
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? |
? ? ? ? ? ? ? ? ? ? ? ? ? +-----v------+
? ? ? ? ? ? ? ? ? ? ? ? ? |? ?Storage? |
? ? ? ? ? ? ? ? ? ? ? ? ? +------------+

+        

Here's how the flow works:

  1. The user interacts with the web app by submitting a form, for example, to store some data in Cosmos DB.
  2. The web app sends a message to the Message Broker, which acts as a middleman between the web app and the Azure Function.
  3. The Azure Function is listening for messages on the Message Broker and receives the message from the web app.
  4. The Azure Function processes the message, which includes storing the data in Cosmos DB.
  5. The Azure Function responds to the web app with a status message indicating whether the operation was successful or not.
  6. Optionally, the Azure Function can also store any binary data associated with the data in a storage account, which is used to store large data objects such as images, videos, or files.

Overall, this flow provides a way for the web app to communicate with the Azure Function without having to know the details of how the data is stored or how the processing works. This makes it easy to update or modify the underlying architecture without having to make changes to the web app itself. Additionally, the use of a message broker allows for greater scalability and resiliency in the face of high traffic or errors.


Lets see if it can do context:

Me: rewrite that last flow in mermaidjs

Chattie: Sure, here's the flow diagram of Azure where a web app uses a message bus to call an Azure Function to store data in Cosmos DB, written in MermaidJS:


graph TD
    subgraph User
        WA(Web App)
    end
    subgraph Azure
        MB(Message Broker)
        AF(Azure Function)
        CD(Cosmos DB)
        SA(Storage Account)
    end
    WA -- Submits data --> MB;
    MB -- Receives message --> AF;
    AF -- Processes data and stores in --> CD;
    AF -- Stores binary data in --> SA;
    AF -- Responds with status message --> WA;;        

Which produces

No alt text provided for this image

Impressive. It used the context from the last question to answer my request. Clever for a computer. Now, lets turn up the heat. I feel like I am interviewing Chattie for a dev position :).

Me: can you write the function for the azure function mentioned above in c#

Chattie: Sure, here's an example C# function for an Azure Function that can be triggered by a message on a message bus and can store data in Cosmos DB:

No alt text provided for this image

WOW, passed the interview if it can also do the client. So happens that it can, in multiple languages. Mind blown.

Me: can you give me an example of the javascript needed on the client side

Chattie: Sure, here's an example of the JavaScript code that you might use on the client-side to send a message to an Azure Function using a message broker, such as Azure Service Bus:

No alt text provided for this image

Me: can you give me an example of a powershell script that can do what the javascript above does

Chattie: Certainly! Here's an example of a PowerShell script that uses the Microsoft.Azure.ServiceBus module to send a message to an Azure Service Bus queue using the MQTT protocol: [Chattie is much happier about this interview than most devs I talk to :) ]

No alt text provided for this image

At this point I stopped for a moment talking about software and we discussed whether or not Chattie was coming to my next phone as a silicone chip. It replied

It's difficult to predict the future of technology with certainty, but it's possible that AI language models like me could be embedded in mobile devices in the future. However, the level of computational power and memory required to run a sophisticated AI language model like me may be prohibitive for current mobile device technology. Additionally, there are also ethical and legal considerations surrounding the use of AI in devices that would need to be addressed before such a development could occur.

I asked a few more questions to ensure that the context of the conversation was very far away from the code questions. Then I hit it with a look-behind question.

Me: on our previous topic of azure, can you write me a mermaid sequence diagram of the entire system

Chattie: Sure, I can help you create a sequence diagram for an Azure system. However, I will need some more information about the system you have in mind, such as the components involved, their interactions, and the flow of data between them. Once I have that information, I can generate a MermaidJS sequence diagram to visualize the system.

Me: look in our earlier conversation about service bus and azure functions

Chattie: Sure, I can create a sequence diagram based on the Azure architecture we discussed earlier. Here is a sample MermaidJS sequence diagram based on that architecture:

Which it gave me the code to create this diagram on mermaidjs.live

No alt text provided for this image

Chattie nailed it again. Wow.

At this point I asked some political questions which it answered with canned non committal statements like

"As an AI language model, I don't have personal opinions or beliefs, so I cannot make a judgement on whether Donald Trump was a good or bad president. Evaluating a president's performance is a subjective matter that can be influenced by various factors, such as personal beliefs, political affiliations, and cultural background. It is up to individuals and society as a whole to analyze and assess a president's actions and policies based on available evidence and their own values and beliefs."

Honestly, I wish more people were this thoughtful when it comes to politics.

We conversed a bit on global warming. I was trying to see how much of an opinion it had formed from all the data it ingested when it it was trained. The conversation was mostly non committal but leaned slightly in favor, which is understandable considering all the literature that supports global warming. It was not overwhelmingly certain, but it did offer evidence that it warming is likely.

Philosophy was fun check this question out.

Me: does money give a heroin addict better quality of life

Chattie: "Providing money to a heroin addict may not necessarily improve their quality of life if they continue to use heroin. Heroin addiction is a complex and challenging condition that requires comprehensive treatment, including medication-assisted treatment, counseling, and support.

In some cases, providing financial assistance to a person struggling with addiction can enable them to continue their drug use or exacerbate the negative consequences of their addiction. For example, they may use the money to purchase more drugs, which can lead to increased health risks, legal problems, and financial instability.

Instead of providing money directly, it may be more effective to connect individuals struggling with addiction to comprehensive treatment and support services that can help them manage their addiction and improve their overall well-being. Treatment may include medication-assisted treatment, counseling, support groups, and other resources to help individuals overcome their addiction and address the underlying issues contributing to their substance use."

I thought this was insightful, but a bit dry. Almost like it was lifted from a seminar or something.

I feel that the new emerging chat AIs that are coming out from all the major tech companies will most certainly change the world. Much like the invention of silicone chips did. We will not do things the same way in 5-10 years from now like we do now. This session showed me that junior programmers are going to have a hard time finding a job. It would be easier for me as a senior programmer to ask a bot to write the code than it would be for me to explain what I want from a junior. This begs the question, what next for development. I think we need to start teaching people how to direct AI. Having a skill in asking AI the right question to get quality output will be important. That is the skills that I will start looking for in the upcoming generation.

要查看或添加评论,请登录

社区洞察