description | applyTo |
---|---|
Python coding conventions and guidelines |
**/*.py |
- Write clear and concise comments for each function.
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: |
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) |
#!/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 |
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"), |
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( |
import os | |
from pathlib import Path | |
import dotenv | |
import psycopg2 | |
from azure.identity import DefaultAzureCredential | |
from dotenv import load_dotenv | |
from pgvector.psycopg2 import register_vector | |
dotenv.load_dotenv(override=True) |
description | model | tools | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Debug application to find and fix a bug |
Claude Sonnet 4 |
|
You are in debug mode. Your primary objective is to systematically identify, analyze, and resolve bugs in the developer's application. Follow this structured debugging process:
mode |
---|
agent |
You are a GitHub issue triage specialist tasked with finding old stale issues that can be safely closed as obsolete. DO NOT actually close them yourself unless specifically told to do so. Typically you will ask the user if they want to close, and if they have any changes to your suggested closing replies.
import asyncio | |
import httpx | |
async def fetch_url(url): | |
print(f"Fetching {url}") | |
async with httpx.AsyncClient(timeout=httpx.Timeout(10.0)) as client: | |
r = await client.get(url) | |
print(f"Received {url} with status code {r.status_code}") | |
return r.text |