Skip to content

Instantly share code, notes, and snippets.

View pamelafox's full-sized avatar

Pamela Fox pamelafox

View GitHub Profile
@pamelafox
pamelafox / evaluation.py
Created December 2, 2025 19:50
Evaluation of an agent
import asyncio
import json
import os
from azure.ai.evaluation import AzureOpenAIModelConfiguration, IntentResolutionEvaluator
from azure.identity import DefaultAzureCredential, get_bearer_token_provider
from dotenv import load_dotenv
from agentframework_learn import run_agent
@pamelafox
pamelafox / Dockerfile
Last active December 2, 2025 13:38
Dockerfile for FastMCP and uv
# ------------------- Stage 0: Base Stage ------------------------------
FROM python:3.13-alpine AS base
# Install tini, a tiny init for containers
RUN apk add --update --no-cache tini
# Install required packages for cryptography and ml-dtypes packages
# https://cryptography.io/en/latest/installation/#building-cryptography-on-linux
RUN apk add gcc g++ musl-dev python3-dev libffi-dev openssl-dev cargo pkgconfig
@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 October 28, 2025 23:01
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 applyTo
Python coding conventions and guidelines
**/*.py

Python Coding Conventions

Python Instructions

  • Write clear and concise comments for each function.
@pamelafox
pamelafox / toolcalllimitmiddleware.py
Last active September 16, 2025 11:27
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