Tag: AIExperiments

  • Adding a Local Model to Ollama through the GUI

    I saw some good reviews of the small gemma3 model in a few places and wanted to try it locally. This

    If you want to get started, read my post on setting up a Local LLM. This post gives an alternative to connecting to the container from the CLI and running a command.

    This is part of a series of experiments with AI systems.

    Adding a Model

    Using the Ollama-WebUI server, it’s easy to add models. I wrote about setting up the UI and I’m running that as my interface to the local model. I created a new container for this post, so when I see the interface, there are no models to choose from. You can see this below.

    2025-09_0090

    I need a model because if I try to ask a question, I get an error that the model is not selected. You can see the error at the top in this image and the query at the bottom.

    2025-09_0091

    If I click the gear icon by the model drop down, I get a list of settings. One of these is “Models”, which is third on the left.

    2025-09_0092

    I click Models and get this list. As you can see I have no models. Notice I need a model name to enter. However, where the cursor is below, there is a “click here” for a list of models.

    2025-09_0094

    This opens the Ollama site at https://ollama.com/library

    2025-09_0095

    If I scroll down, I see the gemma3 model. If I click this I see a few different ones. I am not a big fan of latest, but this is a test. I decided to just grab it since I’m not programming things.

    2025-09_0097

    If I enter this in my WebUI and click download, it starts downloading.

    2025-09_0098

    Progress is shown, and it’s not quick. I went on to other work and this is the view about 15 minutes later.

    2025-09_0100

    Once this is complete, I close settings and see my model in the list. Since this is the only model for this container, I’ll click “set as default”.

    2025-09_0102

    Now I can get my fun fact:

    2025-09_0103

    Now I have a safe, secure, local model to use. If you want to see this run in real-time, check out this video:

  • A Prompt AI Experiment

    Prompt AI released recently and I decided to try a few things with the tool that might help me in database work. I’ve had to do this task, but I had a customer recently ask me about this as well. They were wondering where they were short FKs.

    This post showed what I tried with Prompt AI.

    This is part of a series of experiments with AI systems. This is part of a series of posts on SQL Prompt. You can see all my posts on SQL Prompt under that tag.

     

    Help Me Query the Database

    In a recent post, I looked at the MSSQL agent in VS Code to query my database. I decided to try a few things with Prompt AI, working inline. First, I connected to the database and then I asked a question of the AI: who hit the most home runs.

    2025-09_0342

    From the time I shot the video, I had updated Prompt, and possibly the AI got smarter, because this was the result: I had a qood query.

    2025-09_0343

    I wanted more, so I asked for seasons. You can see the prompt at the bottom, but seasons were added.

    2025-09_0344

    Click Accept and then run it and I get the correct answer.

    2025-09_0345

    How nice would this be for some of the BI analysts to use this to get work done?

    Getting Help Fixing the Database

    In this db, there aren’t any FKs. I decided to (poorly) ask about this.

    2025-09_0347

    Note the misspelling. One of the amazing things is the AI recognizes little errors, just as a human would, and corrects them. I get an OK result, but not great.

    2025-09_0349

    I rewrite my prompt to ask which ones “should” have FKs. I get this:

    2025-09_0350

    Helpful, but I don’t want to work through this list.

    2025-09_0351

    I get this. No code, and I feel like I’m talking to a junior dev who is either trying to avoid work or doesn’t have the understanding that I want work done. I’ll try again.

    2025-09_0354

    I get something I can use. I wouldn’t likely create all these at once, I’d test things, I might start to add these as migration scripts I can deploy over time, after I’ve verified this isn’t going to break an app or cause issues. Or there aren’t already data issues.

    2025-09_0355

    Still, this is one  of those nice time savings for me writing a script to try and create these or working through time one by one. Now I can just set up tests.

    Or ask Prompt AI to help Winking smile

    Summary

    The new features in Prompt AI let you keep coding inline, but add some AI help to what you do. I’ve seen some neat things, and some frustrating ones, but overall, it’s helpful to produce code.

    If you haven’t tried SQL Prompt, download the eval and give it a try. I think you’ll find this is one of the best tools to increase your productivity writing SQL.

    Video Walkthrough

    This isn’t exactly what is above, because LLMs aren’t deterministic.

     

  • Getting Started with the MSSQL AI Agent in VS Code

    Recently I was working in VS Code and I saw a walkthrough for the new Copilot chat features. I decided to give those a try in trying to get some information from my SQL Server instance.

    This post walks through a few things I did with this GenAI agent. There is a video walkthrough at the end.

    Note: I have copilot access set on VS Code as a part of my employer’s benefit.

    This is part of a series of experiments with AI systems.

    First Steps

    When I start VS Code, I see something like this.

    2025-08_0105

    One of the Walkthroughts recently mentioned copilot. If I click the “More” at the bottom right, I’ll get this image. You might see something different, but Id’ expect you have a Copilot walkthrough if you can use Copilot. I choose the 4th one down (where the mouse pointer is).

    2025-08_0106

    This opened a Copilot pane. There were a few items, and you can see on the left in the image below, some have checkmarks. I’d explored these before.

    2025-08_0107

    If I scroll up, I see the one I wanted to get, which was “chat about your code”. I picked this one. This opened a blade to the left when I clicked the blue “Chat with Copilot” button.

    2025-08_0109

    I had read there are these @ agents (look up at the right side) and decided to type “@”. I saw a list of things.

    2025-08_0110

    Lots of places to work, but I choose the @mssql agent, since this is the place I tend to work. In the lower pane, I typed a question.

    2025-08_0111

    Above this (still in the left blade), I got a response.

    2025-08_0112

    Below this, I got some text and code explaining how to access a list of databases on various platforms. Not sure why MySQL is first, but I’m assuming this is alphabetical. For SQL Server, I saw this. This is a reasonable answer, with some help on how to execute it.

    2025-08_0113

    I then decided to connect to my local instance. I have the MSSQL extension, so I clicked that and got a connection.

    2025-08_0114

    Rerunning that query produced the same response. However, when I opened a query window, I got different results. Note the little database icon on the left, below my prompt, with “Untitled-1” next to it. This is the context, which I also saw added to the lower prompt box, just above where I would enter a prompt.

    2025-08_0115

    However, this didn’t work.  After a few minutes,  I got this.

    2025-08_0116

    and this. The LLM is trying, but can’t seem to get a query to run. It did try.

    2025-08_0119

    I then decide to move on.

    Getting Results Back from Questions

    This isn’t really the type of thing I’d do, but I decided to try and get some info from a database. The one above isn’t that interesting, so I switched to asking the model some questions. Here’s the first one, where I don’t remember the exact table name, but I ask.

    2025-08_0120

    It’s queried the database, and there isn’t a player table. However, it continues to look and finds dbo.players.

    2025-08_0121

    Even better, once it has the answer, it also provides a little more info. Maybe good, maybe bad. This reminds me of talking with a person that gives me more information than I asked for.

    2025-08_0122

    I try something else. Let’s get some metadata, since I clearly don’t remember what’s in this database.

    2025-08_0125

    I get a nice response, with some guesses about what information is contained inside these tables.

    2025-08_0126

    OK, can I query for information. I’ve always been a bit more of a hitter than a pitcher, so I’ll ask a question. This isn’t asking to join specific tables, but get me an answer.

    2025-08_0127

    It worked, though to be fair, I tabbed over to SSMS and wrote this query in the same time (with SQL Prompt) as the Copilot agent. Cool to see as I’d forgotten Thome and Vlad were up there.

    2025-08_0134

    While I got the answer, I didn’t get the query. I asked for it and got it, with an apology.

    2025-08_0128

    I’ll do something else. Who played the longest. Might be a somewhat funny query to write for a quick answer. I’d have to join a few tables and look for a sum.

    2025-08_0130

    It likely remembered I wanted the query, so that was included, with an explanation. However, it only looked at the batting table.

    I asked other questions about fielding and pitching and got those answers (Nolan Ryan, 27 years with fielding stats and pitching stats. So I asked that:

    2025-08_0151

    Below this, I see the two players who tied, which Copilot noted.

    2025-08_0152

    The code provided only returned one player. I checked, which is something that you should always do. I asked if I could get better code. I got a few options, and I liked the RANK one, so I tried it and it worked.

    2025-08_0180

    Slightly annoying, but when I think about this type of conversation with someone else, especially a junior dev, I might have the same results and iterate this way.

    At this point I also asked about databases, and I got a result. Maybe I needed a query to run first? Not sure why this works now.

    2025-08_0133

    Summary

    This was an interesting set of things I could get done with this agent in VS Code. It’s not amazing, but it was helpful. I could tackle some light query tasks or db query ones while also handling some other work. In this case I wasn’t in the zone, trying to code or decode a database schema. Instead, I had a few things to try, and I let the agent work while I tabbed over to close some emails and chats.

    In a job where I might need to find info from an unfamiliar database, this could be helpful in getting things done, though it’s hard to know if it’s slower for me if I were focused on ths all the time. The agent can find some info without me, but it also failed in a few cases. I started to try and get other things done when I noticed delays in responding and some hung queries.

    Learning to use an AI agent to help you is a skill, and it’s one that takes time to develop.

    I’ll look at some more practical tasks in the next post.

    Video Walkthrough

    Here’s a video walkthrough of most of the stuff in this post. It differs slightly as working with LLMs is not deterministic.

  • Sample Data with GenAI in Seconds

    A friend was asking for help with some data analysis. This was in PowerBI, and the source data was PII. I asked them to mask the data for me to work with but realized that’s a chore. I could mock it myself with AI.

    This is part of a series of experiments with AI systems.

    The Process

    I started by building a table. It’s what I often do to solve problems. I could have asked the AI, but I wasn’t sure what I wanted and across 5 minutes or so I was thinking about the problem and what data was needed.

    This is a subset. The original table and model had many more columns, but after thinking for a couple of minutes, I realized these would let me model the report someone wanted. At least enough to see if the requirements might be correct and the code work or not work.

    CREATE TABLE MarketData
    ( UserID INT
    , ContactDate DATETIME
    , ContactType VARCHAR(10)
    , ContactDesc VARCHAR(30)
    )
    GO

    Once I had the code, I jumped over to Claude to give this a try. You can see the prompt below, but it was this: I need sample data for this schema. Duplicate some customerIDs across various dates, and duplicate contacttype for each customer (from 1 to 5), but randomly mix these in across dates. Not every customer needs every contact type. Make this for 10 customers across two years

    2025-06_line0121

    I could then move on to another task, since I was getting going in the am and answering emails around this task. As it generated, I realized this wasn’t quite what I needed. So I addd this prompt.

    2025-06_line0122

    I got a bunch of data.

    2025-06_line0128

    This wasn’t perfect, and I actually went back and asked for more users with only a “1” and got the data altered.

    I could have done this, but I’ve also found myself sometimes spending as much time mocking an environment as I did writing a query to solve a problem. I can use this to answer questions on SQL Server Central and even quickly strip code out of poorly asked questions.

    It’s amazing. Don’t be afraid of AI. Give it a try. Keep trying. If it fails after a few prompts, just do the work you’re do, but go back and try again later.

    I’ve got a video walkthrough of this below.