Skip to content

Instantly share code, notes, and snippets.

View aaronvg's full-sized avatar
🎯
Focusing

aaronvg

🎯
Focusing
  • 10:31 (UTC -07:00)
View GitHub Profile
@aaronvg
aaronvg / .cursorrules
Created November 26, 2024 02:06
CursorRules for BAML
<Overview>
BAML (Basically, A Made-Up Language) is a domain-specific language for building LLM prompts as functions.
You can build an agentic workflow with BAML.
</Overview>
<Schema>
// Define output schemas using classes
class MyObject {
// Optional string fields use ?
// @description is optional, but if you include it, it goes after the field.
@aaronvg
aaronvg / test.py
Last active November 26, 2024 00:43
instructor-pydantic-1b-param-example
from pydantic import BaseModel, Field
from typing import Optional, List, Literal
from datetime import datetime
class LogMetadata(BaseModel):
environment: str = Field(description="Production, staging, development")
resource_id: str = Field(description="ID of the resource generating the log")
duration: Optional[int] = Field(
None, description="Duration of the operation in milliseconds"
import os
import fire
from pdf2image import convert_from_bytes
from PIL import Image
import io
def convert_pdf_to_image(pdf_path: str, output_path: str, page: int = 1, dpi: int = 200):
try:
# Read PDF file
with open(pdf_path, 'rb') as file:
<html lang="en">
<AuthProvider authUrl={process.env.NEXT_PUBLIC_AUTH_URL!}>
<PHProvider>
<body className={inter.className}>
<PostHogPageView />
<SignedIn>
<RootDashboardLayout>{children}</RootDashboardLayout>
</SignedIn>
<SignedOut>
<RedirectToSignIn />
@aaronvg
aaronvg / baml-prompt.txt
Last active September 11, 2024 05:50
BAML Cursor Prompt
Generate a prompt using BAML.
The BAML programming language is used to write LLM prompts with certain inputs and outputs.
The syntax looks like this:
<BAML Example>
```baml
class ExtractedResume {
name string
In engine/baml-runtime/tests/test_runtime.rs
```
// #[cfg(feature = "internal")]
mod internal_tests {
use std::collections::HashMap;
use baml_runtime::BamlRuntime;
use baml_runtime::InternalRuntimeInterface;