Skip to content

Instantly share code, notes, and snippets.

View bigsnarfdude's full-sized avatar

BigsnarfDude bigsnarfdude

View GitHub Profile
@bigsnarfdude
bigsnarfdude / langchain_ollama_llama3.2_reddit_search.ipynb
Last active November 15, 2024 14:46
langchain_ollama_llama3.2_reddit_search.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bigsnarfdude
bigsnarfdude / workshops.json.parser.py
Last active November 14, 2024 16:24
workshops.json.parser.py
import requests
from datetime import datetime, timedelta
# URL to fetch data from
url = "https://workshops.birs.ca/events/future.json"
def get_nearest_monday(given_date):
weekday = given_date.weekday()
@bigsnarfdude
bigsnarfdude / function_calling weather curl
Created November 14, 2024 13:04
function_calling weather curl
curl http://localhost:11434/api/chat -d '{
"model": "llama3.2",
"messages": [
{
"role": "user",
"content": "What is the weather today in Banff, Alberta?"
}
],
"stream": false,
"tools": [
@bigsnarfdude
bigsnarfdude / ollama_function_calling_example.py
Last active November 14, 2024 06:20
ollama_function_calling_example.py
import json
import ollama
import asyncio
import sqlite3
def get_workshop(workshop: str) -> str:
workshops = {
"24w5302": {
"Title": "Community in Algebraic and Enumerative Combinatorics",
"Arrival Date": "01/07/2024",
@bigsnarfdude
bigsnarfdude / sqlitevec_demo.py
Created November 13, 2024 16:40
sqlitevec_demo.py
import sqlite3
import sqlite_vec
from typing import List
import struct
def serialize_f32(vector: List[float]) -> bytes:
"""serializes a list of floats into a compact "raw bytes" format"""
return struct.pack("%sf" % len(vector), *vector)
@bigsnarfdude
bigsnarfdude / chromadb_chatgpt4.py
Last active November 13, 2024 01:42
chromadb_chatgpt4.py
import os
import chromadb
from chromadb.utils import embedding_functions
from car_data_etl import prepare_car_reviews_data
from chroma_utils import build_chroma_collection
import openai
DATA_PATH = "data/archive/*"
CHROMA_PATH = "car_review_embeddings"
EMBEDDING_FUNC_NAME = "multi-qa-MiniLM-L6-cos-v1"
@bigsnarfdude
bigsnarfdude / llama3.2-vision.py
Last active November 12, 2024 17:34
llama3.2-vision.py
import ollama
target_images = ['1.jpg']
questions = [ 'What is in this image?',
'Is this a slide show presentation?',
'Is the person teaching? (YES/NO): ',
'Is a person drawing on the green chalk board? (YES/NO): ',
'Is a person in the scene? (YES/NO): '
]
@bigsnarfdude
bigsnarfdude / gist:50b0b9872b8434ade77482c5f4abf514
Created November 12, 2024 05:48
chromadb_ollama3.2_rag.py
import ollama
import chromadb
documents = [
"Llamas are members of the camelid family meaning they're pretty closely related to vicuñas and camels",
"Llamas were first domesticated and used as pack animals 4,000 to 5,000 years ago in the Peruvian highlands",
"Llamas can grow as much as 6 feet tall though the average llama between 5 feet 6 inches and 5 feet 9 inches tall",
"Llamas weigh between 280 and 450 pounds and can carry 25 to 30 percent of their body weight",
"Llamas are vegetarians and have very efficient digestive systems",
"Llamas live to be about 20 years old, though some only live for 15 years and others live to be 30 years old",
@bigsnarfdude
bigsnarfdude / swarmExample.ipynb
Last active November 6, 2024 17:24
swarmExample.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bigsnarfdude
bigsnarfdude / openai-swarm-multi-agent-not-a-framework.ipynb
Last active November 6, 2024 17:23
openai-swarm-multi-agent-not-a-framework.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.