Skip to content

Instantly share code, notes, and snippets.

View kmgrassi's full-sized avatar

kmgrassi

View GitHub Profile
@kmgrassi
kmgrassi / realtime.api.ts
Created February 28, 2025 21:48
OpenAI Realtime client/server session handling function calling
// This is a client side file. There are a couple fetch helper functions here
import { setHeaderOptions } from "./apiHelpers";
import { ApiEndpoints } from "./apiEndpoints";
import { fetchData } from "./apiHelpers";
type RealTimeTokenResponse = {
client_secret: { value: string };
};
@kmgrassi
kmgrassi / gist:2274e2b4f6b2f8d139bfab4ccacf552d
Last active November 27, 2024 22:13
js function to auto run arbitrary functions passed to Open AI assistant call
import OpenAI from "openai";
import {
RunnableFunctionWithParse,
RunnableFunctionWithoutParse,
} from "openai/lib/RunnableFunction";
import { AssistantTool } from "openai/resources/beta/assistants";
import { MessageCreateParams } from "openai/resources/beta/threads/messages";
const configuration = {
apiKey: "<Your API Key>",