Skip to content

Instantly share code, notes, and snippets.

from dotenv import load_dotenv
from google import genai
from pydantic import BaseModel
import argparse
import logging
from datetime import datetime
load_dotenv()
parser = argparse.ArgumentParser(description="Amy and Frank chatbot simulator")
User input: Hey :) tell me something about yourself, the first thing that comes to mind
Response: role='assistant' content="**Amy:** Hmm, the first thing that comes to mind... I was just thinking about how much I enjoy getting lost in London. Not literally lost, but exploring hidden streets and noticing the details in old buildings. It's funny how a walk can sometimes feel like a journey through time."
User input: Journey through time... does That means that you get lost in historical parts?
Response: role='assistant' content="**Amy:** Not *just* historical parts, though I do love the stories old buildings tell. It's more about how different eras blend together, or stumbling upon a quiet mews tucked away behind a bustling street. Like finding a little secret history within the modern city. Do you find yourself drawn to any particular parts of London?"
User input: I loooove the mews, South Kensington is so good for that. What's certainly interesting is the City on the weekend, so empty and pristine
Response: r
const url = `https://texttospeech.googleapis.com/v1/text:synthesize?key=${apiKey}`
const request = {
input: { ssml: ssmlInput },
voice: {
name: "en-US-Studio-O",
languageCode: "en-US",
// ssmlGender: "MALE",
},
audioConfig: { audioEncoding: "MP3" },
@asjir
asjir / async_derived.ts
Created February 16, 2025 12:18
Svelte async derived store
import { derived, type Readable } from "svelte/store"
export type AsyncDerivedState<T> =
| {
status: "loading"
data: undefined
error: undefined
}
| {
status: "success"
@asjir
asjir / FunnyORM.jl
Last active September 3, 2022 12:41
Medium FunnyORM1
abstract type AbstractModel end
"""default conversion of struct name to table name"""
tablename(::Type{T}) where {T<:AbstractModel} = T |> string |> lowercase |> to_plural
"""default primary key"""
pk(::Type{T}) where {T<:AbstractModel} = T |> fieldnames |> first
"""get the primary key"""
pk(m::T) where {T<:AbstractModel} = getfield(m, pk(T))