Skip to content

Instantly share code, notes, and snippets.

View pamelafox's full-sized avatar

Pamela Fox pamelafox

View GitHub Profile
@pamelafox
pamelafox / claude-anthropic.py
Last active November 25, 2025 22:25
Claude with Python
import os
from anthropic import AnthropicFoundry
from dotenv import load_dotenv
load_dotenv()
endpoint = "https://pf-claude-foundry-proje-resource.openai.azure.com/anthropic"
deployment_name = "claude-sonnet-4-5"
@pamelafox
pamelafox / compare_search_indexes.py
Created November 11, 2025 22:27
compare_search_indexes.py
"""Compare documents across two Azure AI Search indexes"""
import argparse
import asyncio
import logging
import os
from collections.abc import Iterable, Mapping
from dataclasses import dataclass, field
from typing import Any, cast
@pamelafox
pamelafox / gist:c6318cb5d367731ce7ec01340ebd780c
Last active February 1, 2026 11:10
Agent Frameworks comparison

Agents using MCP servers

Framework MCP integration Tool filtering? Example
Langchain MultiServerMCPClient accepts a dictionary of MCP servers Filter with get_tools() after connecting to servers Example
Agent-framework MCPStreamableHTTPTool for each MCP server Filter with allowed_tools on that class, or tools on agent.run() Example
Pydantic AI MCPServerStreamableHTTP for each MCP server Apply .filtered() method to the server and use result as a toolset for agent Example
@pamelafox
pamelafox / techspec.md
Created October 16, 2025 22:52
YouTube to Article Tech Spec

YouTube Talk to Article – Lean MVP Technical Spec

Derived from the original PRD but intentionally simplified for fastest viable implementation. Focus: “folder in, article out” with minimal config, vision-first extraction, and straightforward alignment (no embeddings initially).

1. MVP Goal & Non-Goals

Goal: Given a folder containing a deck.pptx (and optionally a transcript + config.yaml), produce article.md plus slide images using a simple CLI: talk2article <folder>.

Included in MVP:

@pamelafox
pamelafox / python.instructions.md
Created October 11, 2025 05:18
Python Coding Instructions
description Python coding conventions and guidelines
applyTo **/*.py

Python Coding Conventions

Python Instructions

  • Write clear and concise comments for each function.
@pamelafox
pamelafox / toolcalllimitmiddleware.py
Last active March 4, 2026 15:57
ToolCallLimitMiddleware
from langchain.agents.middleware import AgentMiddleware, AgentState, ModelRequest
class ToolCallLimitMiddleware(AgentMiddleware):
def __init__(self, limit) -> None:
super().__init__()
self.limit = limit
def modify_model_request(
self, request: ModelRequest, state: AgentState
) -> ModelRequest:
@pamelafox
pamelafox / function_calling_extended.py
Last active September 2, 2025 19:09
Ollama gpt-oss examples
import json
import os
import azure.identity
import openai
from dotenv import load_dotenv
from rich import print
# Setup the OpenAI client to use either Azure, OpenAI.com, or Ollama API
load_dotenv(override=True)
@pamelafox
pamelafox / find_single_token_char.py
Created August 23, 2025 05:32
Find a stable single-token
#!/usr/bin/env python3
"""
Find characters whose repetitions tokenize to one token per character with tiktoken.
A character c is considered "stable single-token" if:
len(encode(c)) == 1 AND for all k in [1, max_reps], len(encode(c * k)) == k.
Usage (from repo root with virtual env active):
python find_single_token_char.py
python find_single_token_char.py --model text-embedding-3-large --max-reps 32
@pamelafox
pamelafox / example1.py
Last active August 14, 2025 06:21
GPT-5 code
import os
import openai
from azure.identity import DefaultAzureCredential, get_bearer_token_provider
client = openai.AzureOpenAI(
api_version=os.environ["AZURE_OPENAI_VERSION"],
azure_endpoint=os.environ["AZURE_OPENAI_ENDPOINT"],
azure_ad_token_provider=get_bearer_token_provider(DefaultAzureCredential(),
"https://cognitiveservices.azure.com/.default"),
@pamelafox
pamelafox / chat.py
Created August 8, 2025 21:55
GPT-5 + Python + OpenAI SDK
import os
import azure.identity
import openai
# Setup the OpenAI client to use either Azure, OpenAI.com, or Ollama API
API_HOST = os.getenv("API_HOST", "azure")
if API_HOST == "azure":
token_provider = azure.identity.get_bearer_token_provider(