Tag: AI

  • AI Thoughts on the Build Keynote

    If you haven’t seen the Build 2023 keynote, it’s, well, interesting. At a surface level, it’s focused on AI and delivers some demos that many of us might find to be useful and intriguing. I didn’t attend the event (or watch it live), but I did see it a bit later and I made some notes, pausing the 30-minute talk a few times to think about what I’d seen.

    The opening lightly glosses over some of the AI enhancements to development tools and the environments that can be created quickly in GitHub or Azure. Some of us will like those, and maybe they’ll grow on me, but I tend to prefer a development environment on my own hardware, where I have unlimited compute power at a fixed cost. The first big announcement is then showing Copilot technology, essentially some ChatGPT-like abilities, embedded into Windows 11. The demo shows asking Windows where settings are, with the response including buttons to take actions, like setting dark mode. Minorly useful, though I think Windows search works fine. I can type “env” and get the “edit environment variables” in the results. I still have to click through to change things, but this doesn’t seem like a better use of AI, especially if I need to type “set dark mode” instead of “dark”.

    To be fair, the demo has the user asking for ways to adjust the system to get more work done. The suggestions are for dark mode and a focus timer. I knew about the former, but not the latter. Perhaps being able to ask for general assistance with tasks is useful as there are likely lots of features I know nothing about and wouldn’t even think to look for. There is also the option to drop a document, like a PDF, in the chat and Windows asks if the user wants the system to “explain”, “rewrite”, or “summarize” the document. The user clicks summarize and gets a summary of the document.

    There is also a demo with plugins that developers can write for Bing, such as one that uses a legal package to make a change to a document. While lawyers might be worried about their practices (or paralegals about job prospects), I’m more worried about a fundamental problem that many of us data professionals have seen in the past: garbage in, garbage out.

    In this case, if the AI model isn’t well-trained, can I really trust it to summarize a PDF or change a legal document? How can I tell if it’s wrong, or slightly off? In some sense, this reminds me of a high school report. It might summarize some text at an A level, or a D level. It’s up to me to judge that, and I can’t assume the results are good or bad.

    The important thing to keep in mind, however, is that we aren’t in that place with AI. We can’t just trust the AI. We are in a time when AI is an assistant, where it can help us complete a task or get something done a little quicker. We are still responsible. We still have to verify and do some work, but if the Copilot can automatically launch Jira and navigate to a ticket, or attach a document and create a short message to our team, that saves us time. It saves us tedium. It can make our jobs easier. We are still needed, but we don’t do all the heavy lifting.

    I do worry about some of the opportunities for plugins that developers will write strictly to monetize their efforts. If I want a shopping list, I don’t want it to go to Instacart. I want a list I can use. I realize that doesn’t necessarily make Microsoft or a developer any money, but not all the tasks and advances are about profit. Or at least, I hope they all aren’t. I hope some are here to just make the world better. For a quick view of what that could be, watch the keynote closing video.

    Steve Jones

    Listen to the podcast at Libsyn, Stitcher, Spotify, or iTunes.

  • AI Experiments–Who am I and how am I remembered?

    I saw someone noting that AIs shouldn’t write obituaries. Since I maintain sqlmemorial.org, I wanted to see what would happen for me.

    This is part of a series of experiments with the ChatGPT and other AI systems.

    First, a simple prompt. This was delayed for about 20s while the AI was processing data. I assume it was looking over the sites for my name.

    2023-05-09 09_42_21-

    When it started to write, I thought it did a decent job.

    2023-05-09 09_46_34-Steve Jones SQL summary.

    I then tried for an obituary.

    2023-05-09 09_43_21-Steve Jones SQL summary.

    I very much appreciate the first part of the response. It isn’t good to do this publicly, though for figures, there are people who have to write and update these things so they are prepared. Not that they won’t edit this if someone dies, but often journalists are prepared.

    However, I also appreciate the kind words in the second para. I am not quite sure where/how this data was assembled, but it isn’t a part of any bio I’ve written.

    Not bad, ChatGPT.

  • T-SQL Tuesday #162–Using AI with Data Science

    This month is a timely topic, with Tomaz Kastrun hosting. I was lucky to meet Tomaz before the pandemic, and we had a great time at the SQL Saturday as well as at Lake Bled the next day.

    2023-05-02 09_58_26-Photo - Google Photos

    Tomaz does a lot of data science with R, Python, and a lot of data. He has some great blogs and does a neat advent series every December. This month he asks us about Data Science in the era of ChatGPT, with two prompts:

    • Where and what have you used it [ChatGPT] for?
    • Have you considered responsible usage of Chat GPT?

    I’ll tackle these below. First my experiments with the AI, and second, Ethics.

    This is part of a series of experiments with the ChatGPT and other AI systems.

    Getting a Visualization

    One of Tomaz’ ideas was a visualization. I have some data, so I used this prompt:

    2023-05-02 10_16_40-

    A very poor prompt on my part, but the AI tried. I asked other questions and kept context of the process.

    2023-05-02 10_17_10-Create KW Visualization.

    Not sure why the image didn’t appear, but there was an explanation, so I asked for code.

    2023-05-02 10_17_59-Create KW Visualization.

    I got some code, and decided to restart this experiment. I started a new chat and recorded my efforts. That result  is on YouTube and (hopefully) embedded below.

    It wasn’t perfect, but I could see this being the way software developers end up using ChatGPT.

    Ethics in AI

    There are a lot of things to think about here, but let me focus in on two things. First, is it ethical to get paid for a job if you are asking ChatGPT for help? Second, is it ethical for ChatGPT to synthesize code samples from SQL Server Central, Stack Overflow, etc., that others have written, and give it to you to use in your code.

    The first one is easy. I say yes, since this is what many of us do with colleagues. We ask them for help, they give us code or examples, and we use them in our work that we commit, turn in, etc. We don’t write all code by ourselves, so I see ChatGPT as asking someone else or posting on a forum.

    The second one is tricky. If I see code on SQL Server Central, then I know who wrote it, or who posted it. If I use that, I need to have rights to do so, or give someone credit. For example, I can post this code:

    –============================================================================= — Create and populate a Tally table –============================================================================= –===== Conditionally drop IF OBJECT_ID(‘dbo.Tally’) IS NOT NULL DROP TABLE dbo.Tally –===== Create and populate the Tally table on the fly SELECT TOP 11000 –equates to more than 30 years of dates IDENTITY(INT,1,1) AS N INTO dbo.Tally FROM Master.dbo.SysColumns sc1, Master.dbo.SysColumns sc2 –===== Add a Primary Key to maximize performance ALTER TABLE dbo.Tally ADD CONSTRAINT PK_Tally_N PRIMARY KEY CLUSTERED (N) WITH FILLFACTOR = 100 –===== Let the public use it GRANT SELECT, REFERENCES ON dbo.Tally TO PUBLIC

    
    

    In doing so, I would give credit to Jeff Moden for writing this code. If I used this inside an organization, I should ask Jeff for permission.

    If I get this from ChatGPT, it is providing sources? Potentially the AI read a lot of code and then synthesized something that works the same, but perhaps it’s also copied the most popular code it’s seen in many training sets of data. Hard to know.

    It’s also hard to know what rights we want to give to the AI, it’s programmers, it’s corporate (or personal) owner, etc. How do we deal with rights here? I’m not sure. This is a an area where I don’t even know what I want.

    What do you think?

  • Experiments with GitHub CoPilot

    There has been a lot of attention given to ChatGPT and AI over the last month or two. I’ve tried a few things with the public interface at Open.ai. Some worked well, like this one:

    2023-04-29 09_06_27-

    Others not so well:

    2023-04-24 10_26_10-Window

    This post looks at a few things I tried with VS Code and GitHub Copilot.

    Getting Access

    I saw a note in our internal Redgate Slack that all developers were given access to Github Copilot. This is something you can subscribe to for about US$10/month, or if you are a student, you can get it for free. In my case, I filed a ticket:

    2023-04-29 09_08_52-Inbox - steve.jones@red-gate.com - Outlook

    It took a week or so as someone was out on holiday and this was a low priority ticket. In any case, I got a note from our ticket system, as well as GitHub, that I had access:

    2023-04-29 09_10_04-Inbox - steve.jones@red-gate.com - Outlook

    So I added the extension to VSCode.

    2023-04-29 08_58_23-Extension_ GitHub Copilot - sqlsatwebsite - Visual Studio Code

    Once installed, I got a note to sign in to GitHub, and when I had completed that, I saw the Copilot icon in the lower right corner of my IDE.

    2023-04-29 09_11_04-Window

    Getting Started

    My first experiment was to open my ZeroDowntime client code and see what happened. This is a VS 2019 project, but I opened it in VSCode, specifically the form1.cs code. I highlighted some code and …

    Nothing.

    Then I tried something I’d seen. I added a comment above some code. Still nothing, but when I opened the Github Copilot completions panel, I saw this:

    2023-04-29 09_02_27-● Form1.cs - sqlsatwebsite - Visual Studio Code

    Not helpful, nor what I asked for. Both solutions were similar.

    Starting from Scratch

    I decided to then start from scratch. I created a new file, set this to C# and wrote this:

    2023-04-29 09_14_18-● __ write the outline of a console applic • Untitled-1 - sqlsatwebsite - Visual

    Initially I got nothing, but when I opened the Copilot panel I saw this:

    2023-04-29 09_14_46-● __ write the outline of a console applic • Untitled-1 - sqlsatwebsite - Visual

    That is more interesting. Clearly poor specifications on my part.

    Let’s try something else. I added more detail, and as I did, Copilot even added a few things after to help me specify what I needed.

    2023-04-29 09_16_06-● __ write the outline of a console applic • Untitled-1 - sqlsatwebsite - Visual

    I finished these lines and hit enter and I got something, though not what I wanted.

    2023-04-29 09_18_07-● __ write the outline of a console applic • Untitled-1 - sqlsatwebsite - Visual

    Let’s try something else:

    2023-04-29 09_19_22-● __ write the outline of a console applic • Untitled-1 - sqlsatwebsite - Visual

    That’s better. Not great, but better. This doesn’t quite match what I asked for. I copied this to a template project and then added another comment. I want to check for the existence of the parameter, and I got this code, which is better than something I’d write.

    2023-04-29 09_30_22-● Program.cs - sqlsatwebsite - Visual Studio Code

    Not quite right, and I have some lines to delete, but this gives me something, and as a middling C# dev, this is helpful. Once cleaned, I compiled and ran the code, and it seemed to work, at least for a very basic console app.

    2023-04-29 09_37_18-cmd

    Let’s try SQL

    I opened a new file, set the type to SQL and wrote a comment, using the appropriate comment style.

    2023-04-29 09_38_33-● Untitled-1 - sqlsatwebsite - Visual Studio Code

    I guess that’s OK. Not great, but I didn’t provide much detail. Interesting that it chose to use a created_at column with a timestamp. I never use timestamp, which is deprecated. Not sure how the AI learned about this type, perhaps because of a large corpus of training data using old code with this? Who knows.

    Let’s try something else. I’ll ask for a query using a known schema.

    2023-04-29 09_40_29-● Untitled-1 - sqlsatwebsite - Visual Studio Code

    A start, but not quite right. I do have to keep hitting enter to get the query written. A couple more Enters and Tabs to accept code get me this:

    2023-04-29 09_48_03-● Untitled-1 - sqlsatwebsite - Visual Studio Code

    If I keep going, I get a long query, but it doens’t work. At least not on my version of AdventureWorks.

    2023-04-29 09_50_45-SQLQuery2.sql - ARISTOTLE.AdventureWorks (ARISTOTLE_Steve (51))_ - Microsoft SQL

    Not great.

    What if I add a comment? I’ll ask for window functions.

    2023-04-29 09_51_45-● Untitled-1 - sqlsatwebsite - Visual Studio Code

    I get something else, but again, the final query doesn’t work. This time there are less errors, but the join listed seems to think the Customer table has a first name and last name, which it doesn’t.

    Initial Thoughts

    I’m not sure how useful this is. I think this is going to be one of those tools that I’ll have to practice with and understand how it works. My basic tests are mostly because I’m not sure what to do with it, or how it can be helpful.

    I have lightly seen some demos, but I realize that I need to watch a few more and also experiment with the features. I was hoping it would clean up some of my C# code, which is fairly basic, but it didn’t, at least not with my prompts.

    We’ll see how this goes, and I’ll see if I can use it in ADS and if it can actually recognize and use my database schemas to write queries or tests.