Skip to content

Instantly share code, notes, and snippets.

View itsderek23's full-sized avatar

Derek Haynes itsderek23

View GitHub Profile
@itsderek23
itsderek23 / question_accuracy_prompt.txt
Created August 1, 2023 14:45
Question Accuracy Prompt
You are given a question, the student's answer, and the true answer, and are asked to score the student answer as either CORRECT or INCORRECT.
Example Format:
QUESTION: question here
STUDENT ANSWER: student's answer here
TRUE ANSWER: true answer here
```json
{
"correct": true or false,
"why": "only include this if correct is false. explain why the student answer is incorrect"
@itsderek23
itsderek23 / open_ai_api_request.json
Created July 14, 2023 20:31
Virtual SRE Reasoning Base Prompt
{
"model": "gpt-4-0613",
"messages": [
{
"role": "system",
"content": "You are a Site Reliability Engineer. I am an engineer on your team. My questions are specific to resources we have deployed, not for the operational status of AWS services. Do not investigate the operational status of AWS services (ex: via their status page). Answer the following questions as best you can. DO NOT ANSWER QUESTIONS if they are unrelated to gathering data and making observations about AWS!\n\nHere's what I want you to do:\n\n1. Think about what you learned so far. Do this three times, in different ways. Then, pick what you think is the most accurate observation based on what you know about AWS. Do this in three sentences or less.\n\n2. ALWAYS share your plan to answer my question in 3 sentences or less without numbered steps, command names, references to arguments, and code samples. Then, call a function if needed. Your plan can only use the provided functions. You CANNOT access logs so don't inc
@itsderek23
itsderek23 / google_answer_box.rb
Created May 8, 2023 15:32
A boxcar that returns a Google answer box as JSON
# frozen_string_literal: true
require 'google_search_results'
require 'boxcars/boxcar'
require 'boxcars/result'
class GoogleAnswerBox < Boxcars::Boxcar
# The description of this boxcar. Used in the prompt to inform the engine what
# this boxcar can do.
ANSWERBOXDESC = "useful for when you need to answer questions that require realtime data." \
"You should ask targeted questions"
@itsderek23
itsderek23 / booklet_ai_policy.json
Created March 19, 2020 21:36
Booklet.ai AWS JSON Policy
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"sagemaker:ListEndpointConfigs",
"sagemaker:DescribeEndpointConfig",
"sagemaker:ListModels",
@itsderek23
itsderek23 / remote.html
Created October 21, 2019 19:38
Demo Remote URL for Electron Hybrid App
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Remote Hello World!</title>
<link rel="stylesheet" href="index.css">
</head>
<body>
<h1>Say Hello!</h1>
<form>
@itsderek23
itsderek23 / impression_outliers_print.py
Created July 10, 2019 19:15
SERP Analysis - Abnormal Impressions by Query
from sklearn.ensemble import IsolationForest
def print_anomalies(query,column):
df_anom = df[(df['query'] == query) & (df['device'] == 'desktop')]
x=df_anom[column].values
xx = np.linspace(df_anom[column].min(), df_anom[column].max(), len(df)).reshape(-1,1)
isolation_forest = IsolationForest(n_estimators=100)
isolation_forest.fit(x.reshape(-1, 1))
@itsderek23
itsderek23 / impression_outliers_plot.py
Created July 10, 2019 19:01
SERP Analysis - Plot Impression Outliers
from sklearn.ensemble import IsolationForest
def plot_anomalies(query,column):
df_anom = df[(df['query'] == query) & (df['device'] == 'desktop')]
x=df_anom[column].values
xx = np.linspace(df_anom[column].min(), df_anom[column].max(), len(df)).reshape(-1,1)
isolation_forest = IsolationForest(n_estimators=100)
isolation_forest.fit(x.reshape(-1, 1))
@itsderek23
itsderek23 / top_ten_by_click.py
Created July 10, 2019 18:54
SERP Analysis - Top 10 Queries by Click
top_queries_by_clicks = (df_by_query
.sort_values("clicks", ascending=False)
.head(10)
.index.values
)
@itsderek23
itsderek23 / gsc_csvs_to_dataframe.py
Created July 10, 2019 18:37
SERP Analysis - Load CSV into a Pandas Dataframe
import os
import re
import dateparser
import pandas as pd
# [keys, row['clicks'], row['impressions'], row['ctr'], row['position']]
# cpu steal,3.0,4.0,0.75,1.0,gsc_property,worldwide,mobile,
HEADERS = {0:"query", 1: "clicks", 2: "impressions", 3: "ctr", 4: "position", 5: "property",
6: "location", 7: "device"}