Skip to content

Instantly share code, notes, and snippets.

View kordless's full-sized avatar
🦥
sloth mode

Коrd Campbell kordless

🦥
sloth mode
  • Straight outta the 60s.
View GitHub Profile
@kordless
kordless / status_page_finder.py
Created June 6, 2025 16:53
A Michael Wilde Inspiration
import sys
import os
import logging
import requests
import re
import json
from typing import Dict, Any, Optional, List, Tuple
from mcp.server.fastmcp import FastMCP, Context
from urllib.parse import urlparse, urljoin
import asyncio
"""
Adaptive Connector Framework (ACF)
A self-bootstrapping alternative to MCP that dynamically builds and tests
connectors based on current needs. The system evolves its own capabilities
through iterative learning and testing.
Key components:
1. Registry - Manages available connectors and their capabilities
2. Connector Builder - Dynamically creates new connectors
@kordless
kordless / 003-tutorial.py
Last active July 23, 2024 19:14
Simple LangChain Tool Call with WeatherAPI
import os
import sys
from dotenv import load_dotenv, set_key
from langchain_openai import ChatOpenAI
from langchain.prompts import ChatPromptTemplate, PromptTemplate
from langchain_core.runnables import RunnableSequence
from langchain.tools import Tool
from langchain.agents import create_react_agent, AgentExecutor
from langchain.schema import HumanMessage
import getpass
@kordless
kordless / README.md
Created December 1, 2023 22:08
PDF File Splitter

To run the Python script for splitting a PDF into segments of just under 25MB each, you'll need to follow these steps:

Prerequisites

Python Installation: Ensure that Python is installed on your system. If not, you can download and install it from python.org.

PyPDF2 Library: The script uses the PyPDF2 library. You can install it using pip, Python's package installer. If pip is not already installed, it comes bundled with Python 3.4 and later versions.

Installation Steps

Open Terminal or Command Prompt: On Windows, you can open Command Prompt by searching for cmd in the Start menu.

@kordless
kordless / config.py
Last active August 15, 2023 15:30
Instructor Embeddings w/FeatureBase
# tokens from https://cloud.featurebase.com/configuration/api-keys
featurebase_token = "<token>"
# featurebase ($300 free credit on signup)
# https://query.featurebase.com/v2/databases/bc355-t-t-t-362c1416/query/sql (but remove /query/sql)
featurebase_endpoint = "https://query.featurebase.com/v2/databases/<uuid-only-no-query-sql>"
@kordless
kordless / README.md
Last active January 1, 2024 11:19
Example of using OpenAI functions in completions with Python decorators.

Example of using OpenAI functions in completions with Python decorators

This example illustrates a way to utilize a function dynamically while querying an OpenAI GPT model. It uses the newly released functions support in the completion endpoints OpenAI provides.

The general concept is based on using a decorator to extract information from a function so it can be presented to the language model for use, and then pass the result of that function back to the completion endpoint for language augmentation.

In general, a wide variety of functions can be swapped in for use by the model. By changing the get_top_stories function, plus the prompt in run_conversation, you should be able to get the model to run your function without changing any of the other code.

Configuration

To use this, create a config.py file and add a variable with your OpenAI token:

@kordless
kordless / sample.py
Created June 14, 2023 19:28
Developing an OpenAI Functions Decorator
"""
Hacker News Top Stories
Author:
Date: June 12, 2023
Description:
This script fetches the top 10 stories from Hacker News using Algolia's search API. It retrieves the stories posted within the last 24 hours and prints their titles and URLs.
Dependencies:
- requests: HTTP library for sending API requests
import openai
import numpy as np
from openai.embeddings_utils import get_embedding
openai.api_key = "TOKEN"
def gpt3_embedding(content, engine='text-similarity-ada-001'):
content = content.encode(encoding='ASCII',errors='ignore').decode()
response = openai.Embedding.create(input=content,engine=engine)
vector = response['data'][0]['embedding'] # this is a normal list
State of AI Report
October 11, 2022
#stateofai
stateof.ai
Ian Hogarth
Nathan Benaich
About the authors
Nathan is the General Partner of Air Street Capital, a venture capital firm investing in AI-first technology and life science companies. He founded RAAIS and London.AI (AI community for industry and research), the RAAIS Foundation (funding open-source AI projects), and Spinout.fyi (improving university spinout creation). He studied biology at Williams College and earned a PhD from Cambridge in cancer research.
Nathan Benaich
@kordless
kordless / README.md
Last active September 28, 2022 15:56
Analyzing 5 Billion Games of Set with FeatureBase

Analyzing 5 Billion Games of Set with FeatureBase

FeatureBase is a binary-tree database built on Roaring Bitmaps. This makes it suitable for running analytics on massive data sets in real time. If you've never used FeatureBase before, you can get it running locally in about 5 minutes.

Today, we're going to take a look at using FeatureBase to simulate and analyze a very large number of Set games in real-time.

Set (the game)

Set is a card game designed by Marsha Falco in 1974 and published by Set Enterprises in 1991. The deck consists of 81 unique cards that vary in four features across three possibilities for each kind of feature: number of shapes (one, two, or three), shape (diamond, squiggle, oval), shading (solid, striped, or open), and color (red, green, or purple).

In a game of Set, the cards are shuffled and then 12 cards are drawn from the top of the deck and placed on the table. Game play then com