<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>gemini-api on S Anand</title>
    <link>https://www.s-anand.net/blog/tag/gemini-api/</link>
    <description>Recent content in gemini-api on S Anand</description>
    <generator>Hugo -- 0.164.0</generator>
    <language>en-us</language>
    <lastBuildDate>Sun, 11 May 2025 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://www.s-anand.net/blog/tag/gemini-api/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Things I Learned - 11 May 2025</title>
      <link>https://www.s-anand.net/blog/things-i-learned-11-may-2025/</link>
      <pubDate>Sun, 11 May 2025 00:00:00 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/things-i-learned-11-may-2025/</guid>
      <description>&lt;p&gt;This week, I learned:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/zumerlab/snapdom&#34;&gt;snapdom&lt;/a&gt; is a fast, light, element capture alternative to &lt;a href=&#34;https://html2canvas.hertzen.com/&#34;&gt;html2canvas&lt;/a&gt; but doesn&amp;rsquo;t work well with non-CORS images or iframes.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://sli.dev/&#34;&gt;Sli.dev&lt;/a&gt; is a Markdown slide language. Similar to &lt;a href=&#34;https://marp.app/&#34;&gt;Marp&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Don&amp;rsquo;t split your code into microservices until you need to scale. &lt;a href=&#34;https://nexo.sh/posts/microservices-for-startups/&#34;&gt;Ref&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Vibe coding is like getting others&amp;rsquo; code to work, which is exactly what most devs do. &lt;a href=&#34;https://simonwillison.net/2025/May/8/ashley-willis/&#34;&gt;Simon Willison&lt;/a&gt; #ai-coding&lt;/li&gt;
&lt;li&gt;Tofu Yakitori is a Japanese dish. It&amp;rsquo;s like a dhokla. Marinated tofu cubes brushed with that sweet‑savory tare (soy, mirin, sake, a hint of sugar), then grilled until caramel‑charred. One of the better (tasty + different) dishes I&amp;rsquo;ve had recently. I used &lt;a href=&#34;https://chatgpt.com/share/681d880f-5860-800c-ab21-68c07a25277a&#34;&gt;ChatGPT&lt;/a&gt; to remind me of the dish name.&lt;/li&gt;
&lt;li&gt;Trust, attitudes and use of artificial intelligence surveyed ~1,000 people across 47 countries on their views on AI. &lt;a href=&#34;https://mbs.edu/-/media/PDF/Research/Trust_in_AI_Report.pdf&#34;&gt;PDF&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;Emerging economies trust and use AI more. It&amp;rsquo;s an opportunity to leapfrog.&lt;/li&gt;
&lt;li&gt;26% of students use AI daily (vs 17% employees). Efficiency is the main benefit.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Gemini APIs now have automatic caching for 75% cost reduction if message is &amp;gt;1K (Flash) or &amp;gt;2K (Pro) tokens. &lt;a href=&#34;https://ai.google.dev/gemini-api/docs/caching&#34;&gt;Ref&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;YOLO is much better than Gemini at object detection. Use for pro-processing. &lt;a href=&#34;https://github.com/prudhvi1709/yolovsgemini&#34;&gt;Ref&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Using &lt;code&gt;[[n]]&lt;/code&gt; is probably the best citation format for inline search references in RAG. &lt;a href=&#34;https://chatgpt.com/share/681ca8c8-0570-800c-bd96-6b1970e98a36&#34;&gt;ChatGPT&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;⭐ Double-checking is surprisingly efficient since LLM hallucinations are mostly uncorrelated. LLMs perform human tasks (e.g. classifying customer support messages) at ~85% accuracy. This might be unacceptable. But by asking 2 moderately correlated LLMs and double-checking discrepancies, we reduce automation by ~20% but reduce errors to 0.25%. Triple-checking reduces automation by ~25% but errors to under ~0.01%! &lt;a href=&#34;https://sanand0.github.io/llmevals/double-checking/&#34;&gt;Ref&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Anthropic introduces &lt;a href=&#34;https://docs.anthropic.com/en/docs/build-with-claude/tool-use/web-search-tool&#34;&gt;web search in the API&lt;/a&gt; at $10 / 1K searches. Here&amp;rsquo;s how it compares:
&lt;ul&gt;
&lt;li&gt;$0.1: &lt;a href=&#34;https://rapidapi.com/apiriot/api/duckduckgo-search-api/pricing&#34;&gt;DuckDuckGo Search API (RapidAPI)&lt;/a&gt; (monthly pricing)&lt;/li&gt;
&lt;li&gt;$3: &lt;a href=&#34;https://brave.com/blog/search-api-launch/&#34;&gt;Brave Search API&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;$5: &lt;a href=&#34;https://developers.google.com/custom-search/v1/overview&#34;&gt;Google Custom Search JSON API&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;$15: &lt;a href=&#34;https://serpapi.com/pricing&#34;&gt;SerpAPI&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;$10: &lt;a href=&#34;https://zenserp.com/serp-api-alternative&#34;&gt;Zenserp&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;$10: &lt;a href=&#34;https://docs.anthropic.com/en/docs/build-with-claude/tool-use/web-search-tool&#34;&gt;Anthropic Web Search Tool&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;$25: &lt;a href=&#34;https://www.microsoft.com/en-us/bing/apis/pricing&#34;&gt;Bing Search API&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;$35: &lt;a href=&#34;https://ai.google.com/gemini-api/docs/pricing&#34;&gt;Gemini API&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;$35: &lt;a href=&#34;https://openai.com/api/pricing&#34;&gt;OpenAI API&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;India attacked Pakistan!&lt;/li&gt;
&lt;li&gt;⭐ When writing notes, summarize at the end of the day the learnings and next steps.&lt;/li&gt;
&lt;li&gt;GitHub does not let you control the cache duration, but there are many creative workarounds. &lt;a href=&#34;https://chatgpt.com/share/6819df70-4310-800c-acdc-5b743e1cde31&#34;&gt;ChatGPT&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;HTML meta tags: &lt;code&gt;&amp;lt;meta http-equiv=&amp;quot;Cache-Control&amp;quot; content=&amp;quot;no-cache, no-store, must-revalidate&amp;quot;&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Use a &lt;a href=&#34;https://github.com/gzuidhof/coi-serviceworker&#34;&gt;service worker&lt;/a&gt; (&lt;a href=&#34;https://dev.to/stefnotch/enabling-coop-coep-without-touching-the-server-2d3n&#34;&gt;blog&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Proxy through a CDN. Cloudflare, Netlify&lt;/li&gt;
&lt;li&gt;Move to another static host: S3 + CloudFront, Heroku, Vercel, Surge, Firebase Hosting&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Notes from the &lt;a href=&#34;https://arxiv.org/abs/2504.14738&#34;&gt;PromptEvals paper&lt;/a&gt;:
&lt;ul&gt;
&lt;li&gt;Good evals must be:
&lt;ul&gt;
&lt;li&gt;Objectively MEASURABLE (even if by an LLM). Otherwise, we won&amp;rsquo;t know if it&amp;rsquo;s right.&lt;/li&gt;
&lt;li&gt;Directly RELEVANT to the input/prompt. Otherwise, we&amp;rsquo;re not evaluating the input.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Typical evals fall into 6 categories
&lt;ul&gt;
&lt;li&gt;Structured output: Adhere to a schema (Markdown, HTML, DSL, JSON + Schema)&lt;/li&gt;
&lt;li&gt;Multiple choice&lt;/li&gt;
&lt;li&gt;Length constraints: N characters, words, sentences, list items, etc.&lt;/li&gt;
&lt;li&gt;Semantic constraints: Exclude terms, topic relevance, follow grammar, etc.&lt;/li&gt;
&lt;li&gt;Stylistic constraints: Style, tone, persona&lt;/li&gt;
&lt;li&gt;Prevent hallucinations: Factual accuracy. Instruction following&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    <item>
      <title>Things I Learned - 17 Nov 2024</title>
      <link>https://www.s-anand.net/blog/things-i-learned-17-nov-2024/</link>
      <pubDate>Sun, 17 Nov 2024 00:00:00 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/things-i-learned-17-nov-2024/</guid>
      <description>&lt;p&gt;This week, I learned:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Anthropic has single-plage docs for LLMs. &lt;a href=&#34;https://docs.anthropic.com/llms.txt&#34;&gt;Condensed version&lt;/a&gt; and &lt;a href=&#34;https://docs.anthropic.com/llms-full.txt&#34;&gt;Full version&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.ted.com/pages/malcolm-gladwell-on-the-importance-of-self-correction-transcript&#34;&gt;Malcolm Gladwell on the importance of self-correction&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;Belonging to multiple social worlds is a good way to defend against no longer being good at what you used to be. Diverse values and social groups help.&lt;/li&gt;
&lt;li&gt;Self handicapping explains a lot about the world. You study late for a maths test - so you can fail for lack of trying, not aptitude. Ecosystems (e.g. sports teams) mitigate self-handicapping.&lt;/li&gt;
&lt;li&gt;You don&amp;rsquo;t have to be good in athletics to get the benefits. A slow runner gets the same discipline, pumping up, etc that a fast runner does&lt;/li&gt;
&lt;li&gt;Mono cultures are good to accomplish a known mission. Diversity is good to pivot during uncertainty. So, localize mono cultures&lt;/li&gt;
&lt;li&gt;Diversity helps only if there are sufficient numbers, or if they have enough power to change the organization&amp;rsquo;s thinking.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Use a standardized password strategy, e.g. use the month like GramNov2024 (via Namit)&lt;/li&gt;
&lt;li&gt;Gemini has an OpenAI compatible API. &lt;a href=&#34;https://ai.google.dev/gemini-api/docs/openai&#34;&gt;Gemini Docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Ethan Mollick says Claude is solving MBA case studies well. &lt;a href=&#34;https://x.com/emollick/status/1856161026238025835&#34;&gt;x.com&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;LLMs pay a lot of attention to the first 6 tokens. &lt;a href=&#34;https://huggingface.co/blog/tomaarsen/attention-sinks&#34;&gt;Ref&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;This is an interesting article on &amp;ldquo;UI in the age of Gen AI&amp;rdquo;. &lt;a href=&#34;https://agao.substack.com/p/uiux-in-the-age-of-generative-ai&#34;&gt;Ref&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Google Open sourced Alphafold 3. &lt;a href=&#34;https://github.com/google-deepmind/alphafold3&#34;&gt;Repo&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Cloudflare R2 has the same API as S3 but is cheaper&lt;/li&gt;
&lt;li&gt;Prefect.io is a good alternative to Airflow / cron. Can use for synchronisation tasks, e.g. Drive to server. But no Auth, UI params or config.&lt;/li&gt;
&lt;li&gt;Gemini transcription does not give accurate timestamps. Whisper does. But the quality of transcription is similar.&lt;/li&gt;
&lt;li&gt;Pass a complex data structure to Claude.ai and have it create an app to visualize it. It does well. &lt;a href=&#34;https://x.com/simonw/status/1855819673482461216&#34;&gt;Simin Willison&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://techcouncilventures.com/&#34;&gt;Tech Council Ventures&lt;/a&gt; and &lt;a href=&#34;https://sunicon.vc/&#34;&gt;Sunicon VC&lt;/a&gt; invest in early stage startups, and aloso provide them technology support (via Naveen)&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    <item>
      <title>Things I Learned - 27 Oct 2024</title>
      <link>https://www.s-anand.net/blog/things-i-learned-27-oct-2024/</link>
      <pubDate>Sun, 27 Oct 2024 00:00:00 +0000</pubDate>
      <guid>https://www.s-anand.net/blog/things-i-learned-27-oct-2024/</guid>
      <description>&lt;p&gt;This week, I learned:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://lancedb.github.io/lancedb/&#34;&gt;LanceDB&lt;/a&gt; is a more scalable alternative to ChromaDB. Written in Rust. Does not require a separate HSNW library.&lt;/li&gt;
&lt;li&gt;Meta has a bunch of image embedding models:
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/roboflow/notebooks/blob/main/notebooks/dinov2-image-retrieval.ipynb&#34;&gt;DINOv2&lt;/a&gt; creates image embeddings (Apr 2023)&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://research.facebook.com/publications/imagebind-one-embedding-space-to-bind-them-all/&#34;&gt;ImageBind&lt;/a&gt; is an embedding model for text, images, audio, and more (Jun 2023)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Gemini has a &lt;a href=&#34;https://ai.google.dev/gemini-api/docs/code-execution&#34;&gt;code execution API&lt;/a&gt;!&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://0x0.st/&#34;&gt;0x0.st&lt;/a&gt; is an open API-based file upload + URL shortening service. You can dump files there temporarily.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://novnc.com/info.html&#34;&gt;noVNC&lt;/a&gt; is a JavaScript VNC client. You can control a remote (virtual) machine from your browser.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.wired.com/story/friend-ai-pendant/&#34;&gt;Friend&lt;/a&gt; is an always recording pendant that you can ask questions to.&lt;/li&gt;
&lt;li&gt;Anthropic&amp;rsquo;s new Sonnet model is even better at code. Plus it has the ability to extract coordinates from images. &lt;a href=&#34;https://www.anthropic.com/news/3-5-models-and-computer-use&#34;&gt;Ref&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Gemini sort-of supports diarization. &lt;a href=&#34;https://cloud.google.com/vertex-ai/generative-ai/docs/prompt-gallery/samples/classify_audio_diarization&#34;&gt;Ref&lt;/a&gt;. I tried it and it&amp;rsquo;s OK but not perfect.
&lt;ul&gt;
&lt;li&gt;#IMPOSSIBLE LLMs cannot diarize reliably yet. (Gemini just guesses the speaker differences.)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Replit is good for hobbyists, Cursor for developers, and Pythagora &amp;amp; Bolt for non-developers building business apps. &lt;a href=&#34;https://youtu.be/8fEdaXwdDl8&#34;&gt;Ref&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
  </channel>
</rss>
