Skip to content

Instantly share code, notes, and snippets.

View igor9silva's full-sized avatar
🧑‍🍳
cooking

Igor Silva igor9silva

🧑‍🍳
cooking
View GitHub Profile
@igor9silva
igor9silva / unfinished_json.ts
Created August 23, 2025 12:54
reproduction of Kimi K2 failure on Moonshot API
import { createOpenAICompatible } from '@ai-sdk/openai-compatible';
import { generateText, tool } from "ai";
import { z } from "zod";
const moonshot = createOpenAICompatible({
name: 'moonshot',
apiKey: '???',
baseURL: 'https://api.moonshot.ai/v1',
});
@igor9silva
igor9silva / streaming.svelte.ts
Created December 30, 2025 12:37
Type-safe utility for accessing streaming promises from SvelteKit server load functions.
import { page } from '$app/state';
/**
* Type-safe utility for accessing streaming promises from SvelteKit server load functions.
*
* Solves two key problems:
* 1. **Prop drilling**: Components can access page.data.streaming directly without passing promises through parent components
* 2. **Type safety**: Infers exact promise types instead of unions, avoiding type guards everywhere
*
* @example