Skip to content

Instantly share code, notes, and snippets.

View vyasgiridhar's full-sized avatar

Vyas Giridharan vyasgiridhar

  • MS in Informatik, TUM
  • München
View GitHub Profile
@aviadr1
aviadr1 / json_schema.py
Last active November 17, 2025 07:02
**OpenAI JSON Schema Sanitizer for Pydantic Models** - A production-ready function that transforms any Pydantic model into an OpenAI Structured Outputs-compatible JSON schema, handling optionals, unions, recursion detection, numeric constraints, and additionalProperties issues that cause API failures. Includes comprehensive test suite covering a…
"""
File: gv/ai/common/llm/json_schema.py
Author: Aviad Rozenhek
OpenAI Structured Outputs (`response_format={"type":"json_schema"}`) supports only a subset of JSON Schema.
Many perfectly valid Pydantic constructs won't fly as-is. Use these patterns:
-------------------------------------------------------------------------
1) Optional / nullable / Default fields
-------------------------------------------------------------------------
@manangandhi7
manangandhi7 / ExternalSort.cpp
Created December 28, 2018 17:38
External sort in c++
#include <iostream>
#include <fstream>
#include<sstream>
#include <queue>
#include<algorithm>
using namespace std;
class Compare
{
public:
@AlanHohn
AlanHohn / makecsv.py
Created January 19, 2017 13:59
Generate a random CSV in Python
#!/usr/bin/python
import csv
import random
records=9000000
print("Making %d records\n" % records)
fieldnames=['id','name','age','city']
writer = csv.DictWriter(open("people.csv", "w"), fieldnames=fieldnames)
@NeoTheFox
NeoTheFox / .conkyrc
Last active November 30, 2015 10:20
.conkyrc for X230 running archlinux
background yes
use_xft yes
font Arimo:size=7.5
text_buffer_size 2048
# Update interval in seconds
update_interval 5
# This is the number of times Conky will update before quitting.
# Set to zero to run forever.
@DeepInTheCode
DeepInTheCode / GetJSON.sql
Created May 30, 2013 19:53
SQL table to JSON Object
/****** Object: StoredProcedure [dbo].[GetJSON] Script Date: 5/28/2013 4:31:01 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE procedure [dbo].[GetJSON]
(
@table_name varchar(50),