Skip to content

Instantly share code, notes, and snippets.

View metadaddy's full-sized avatar

Pat Patterson metadaddy

View GitHub Profile
@metadaddy
metadaddy / gist:da4f4a5e98810f41d06ce510d05ed20a
Created January 14, 2025 22:27
Transcript of a LangGraph ReAct agent invocation, correctly creating a SQL query on the Drive Stats data set to find the annual failure rate of a particular drive model for a particular time period.
================================ Human Message =================================
What was the annual failure rate of the ST8000NM000A drive model in Q3 2024?
================================== Ai Message ==================================
Tool Calls:
sql_db_list_tables (call_LLdny3ctJeEkZQOdFVfCuLhw)
Call ID: call_LLdny3ctJeEkZQOdFVfCuLhw
Args:
================================= Tool Message =================================
Name: sql_db_list_tables
@metadaddy
metadaddy / gist:2838c8521b6dfd6de57fb11c38417d31
Created January 14, 2025 22:18
Transcript of a LangGraph ReAct agent invocation, correctly creating a SQL query on the Drive Stats data set to find the annual failure rate of a particular drive model.
================================ Human Message =================================
What is the annual failure rate of the ST4000DM000 drive model?
================================== Ai Message ==================================
Tool Calls:
sql_db_list_tables (call_BYVEqCmtF2zbEDwPyHlps2in)
Call ID: call_BYVEqCmtF2zbEDwPyHlps2in
Args:
================================= Tool Message =================================
Name: sql_db_list_tables
@metadaddy
metadaddy / gist:8349f733d9244b8f7c880158bf02adfb
Last active January 14, 2025 22:17
Transcript of a LangGraph ReAct agent invocation, incorrectly creating a SQL query on the Drive Stats data set to find the annual failure rate of a particular drive model.
================================ Human Message =================================
Each drive has its own serial number. What is the annualized failure rate of the ST4000DM000 drive model?
================================== Ai Message ==================================
Tool Calls:
sql_db_list_tables (call_ShVR0SwihRgw2hzPpdMXGyxn)
Call ID: call_ShVR0SwihRgw2hzPpdMXGyxn
Args:
================================= Tool Message =================================
Name: sql_db_list_tables
@metadaddy
metadaddy / gist:95eef09c35df4e2e3a53f70e81453ad3
Last active January 14, 2025 21:48
Transcript of a LangGraph ReAct agent invocation, creating a SQL query on the Drive Stats data set to find the number of drives per data center on a given date.
================================ Human Message =================================
Each drive has its own serial number. How many drives did each data center have on 9/1/2024?
================================== Ai Message ==================================
Tool Calls:
sql_db_list_tables (call_e8gfZp1frECuMjDEjXt13wj4)
Call ID: call_e8gfZp1frECuMjDEjXt13wj4
Args:
================================= Tool Message =================================
Name: sql_db_list_tables
@metadaddy
metadaddy / app.py
Last active October 30, 2024 01:13
Test aborting an S3 multipart upload while a part is in flight
import asyncio
import datetime
import functools
from dotenv import load_dotenv
from aiobotocore.session import get_session
ITERATIONS = 100
# Set the following environment variables, or add them to a .env file
@metadaddy
metadaddy / last_upload.py
Last active October 6, 2024 23:10
Find most recently uploaded file in a Backblaze B2 bucket (with optional prefix)
import argparse
from datetime import datetime, MINYEAR, timezone
import boto3
from dotenv import load_dotenv
def list_objects(client, bucket_name, prefix=''):
"""
Python generator to allow easy iteration over object versions, making
@metadaddy
metadaddy / b2_multipart.php
Last active September 18, 2024 18:44
PHP sample code for a multipart file upload to Backblaze B2. Usage: php php_multipart.php [-v] <bucket_name> <local_file>
<?php
// PHP sample code to show multipart file upload using the B2 Native API
// User supplies optional -v for verbose output from curl, then bucket name
// and path to local file
$rest_index = null;
$opts = getopt("v::", [], $rest_index);
$args = array_slice($argv, $rest_index);
@metadaddy
metadaddy / put_object_benchmark.py
Created October 14, 2023 00:25
Simple Python app to benchmark file uploads using the S3 PutObject API
# MIT License
#
# Copyright (c) 2023 Backblaze, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@metadaddy
metadaddy / drivestats2parquet.py
Last active September 9, 2023 03:41
Python code for loading Drive Stats data into Backblaze B2 Cloud Storage
import copy
import os
import re
from datetime import date
from io import BytesIO
from zipfile import ZipFile
import pyarrow as pa
import pyarrow.csv as csv
@metadaddy
metadaddy / makepdfs.py
Created September 1, 2023 17:23
This script uses the PDF file at https://github.com/Snowflake-Labs/snowpark-python-demos/blob/main/pdf-analysis/prod_review10.pdf as a template for creating more PDFs with random names, dates, product selections and recommendations. This PDF file is used in the Snowflake demo "How To Analyze PDF Docs Using Snowpark" at https://www.youtube.com/wa…
# Backblaze wants developers and organization to copy and re-use our
# code examples, so we make the samples available by several different
# licenses. One option is the MIT license (below). Other options are
# available here:
#
# https://www.backblaze.com/using_b2_code.html
#
#
# The MIT License (MIT)
#