Skip to content

Instantly share code, notes, and snippets.

@kristoph
kristoph / gist:78a203f10c23ff8f4f831bb7e85b9b9f
Created September 26, 2024 22:38
Google Generative Language API request + response example
$ curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:streamGenerateContent?alt=sse&key=${GOOGLE_API_KEY}" \
-H 'Content-Type: application/json' \
--no-buffer \
-d '{ "contents":[{"parts":[{"text": "Write a story about a magic backpack."}]}]}'
data: {"candidates": [{"content": {"parts": [{"text": "The"}],"role": "model"},"finishReason": "STOP","index": 0}],"usageMetadata": {"promptTokenCount": 8,"candidatesTokenCount": 1,"totalTokenCount": 9}}
data: {"candidates": [{"content": {"parts": [{"text": " old, dusty attic smelled of mothballs and forgotten dreams. Elias, a boy with"}],"role": "model"},"finishReason": "STOP","index": 0,"safetyRatings": [{"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HATE_SPEECH","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_HARASSMENT","probability": "NEGLIGIBLE"},{"category": "HARM_CATEGORY_DANGEROUS_CONTENT","probability": "NEGLIGIBLE"}]}],"usageMetadata": {"prom
@kristoph
kristoph / gemini-1.5-pro-002-spacing-issue.txt
Created September 26, 2024 23:55
Google Gemini 1.5 Pro 002 Space Issue
$ curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-pro-002:generateContent?key=${GOOGLE_API_KEY}" \
-H 'Content-Type: application/json' \
--no-buffer \
-d '{ "contents":[{"parts":[{"text": "Write a story about a magic backpack."}]}]}'
{
"candidates": [
{
"content": {
"parts": [
{
{
"model": "together_ai/llama_31_70B_T0",
"system_prompt": null,
"prompt": "\nIn Caucasians the incidence of cystic fibrosis is about 1 in 2,000 births; but, among nonwhites the incidence is about 1 in 250,000 births. What would be the rate of incidence amongmatingsbetween Caucasians and nonwhites? If these offspring were to mate randomly among themselves, what incidence would be expected among their offspring?\n\nA) 1 in 125,000 births; 1 in 62,500 births\nB) 1 in 30,000 births; 1 in 15,000 births\nC) 1 in 4,000 births; 1 in 100,000 births\nD) 1 in 10,000 births; 1 in 20,000 births\nE) 1 in 2,000 births; 1 in 250,000 births\nF) 1 in 8,000 births; 1 in 16,000 births\nG) 1 in 60,000 births; 1 in 120,000 births\nH) 1 in 1,000 births; 1 in 5,000 births\nI) 1 in 22,000 births; 1 in 6,700 births\nJ) 1 in 16,000 births; 1 in 32,000 births\n\nYou MUST end your response with the following text:\n\n\"The answer is X.\"\n\n( where X is replaced with the letter that corresponds with your answer )",
"answer": "I"
@kristoph
kristoph / request.json
Created October 31, 2024 18:48
the payload of a failing request with base64 encoded audio
{"generationConfig":{"maxOutputTokens":32,"temperature":0.0},"systemInstruction":{"role":"user","parts":[{"text":"\n You are integrated into a test platform. It is very important that you answer \n succinctly and always provide the text in the requested format without any additional \n text. \n "}]},"contents":[{"role":"user","parts":[{"text":"what is the text in the attached file?\n"},{"inline_data":{"mime_type":"audio/mp4","data":"..."}}]},{"role":"model","parts":[{"text":"this is a test\n"}]},{"role":"user","parts":[{"text":"what about this file?\n"},{"inline_data":{"mime_type":"audio/mp4","data":"AAAAHGZ0eXBNNEEgAAAAAE00QSBpc29tbXA0MgAAAAFtZGF0AAAAAAAAOYYA0EAHAOafzD835UuVG4N5w76yrrbj8+5aX3rQ4Q2/3gBwuhUnwCEHQUTlyTkEYNQnlMhQUi1DE1z7OlYBI7bIHP5bJoKDOQOWFXYXsv7po3W/G8ZQxu3n+o+t+7+XeGlDxtIi0HEey5Mtu8KFCcKvuurrOH1z9vyiz9UzvOJ8H+m44fd86G1Y7s9xPOd6v2JOhtyTZWEbuVv31gbLYWWNxEk8Ksm9aoZ/qtldfrwiV8pORrn5RNPZzPwWzY91TZ8lr/Oy2S6pZ27cZ/NJKC7ms8PvaknDK09Xhn9/TzbxWMtGfkrLnbO91rRPAk
@kristoph
kristoph / batch_scrape_failure_0.txt
Created November 4, 2024 17:04
Firecrawl: url of call with result from that that call
https://api.firecrawl.dev/v1/batch/scrape/e6d1cc2b-3884-4e16-b219-7fb8a155f471
{:success=>true, :status=>"scraping", :completed=>0, :total=>3, :creditsUsed=>3, :expiresAt=>"2024-11-05T17:01:42.000Z", :next=>"https://api.firecrawl.dev/v1/batch/scrape/e6d1cc2b-3884-4e16-b219-7fb8a155f471?skip=0", :data=>[]}
https://api.firecrawl.dev/v1/batch/scrape/e6d1cc2b-3884-4e16-b219-7fb8a155f471?skip=0
{:success=>true, :status=>"scraping", :completed=>0, :total=>3, :creditsUsed=>3, :expiresAt=>"2024-11-05T17:01:42.000Z", :next=>"https://api.firecrawl.dev/v1/batch/scrape/e6d1cc2b-3884-4e16-b219-7fb8a155f471?skip=0", :data=>[]}
https://api.firecrawl.dev/v1/batch/scrape/e6d1cc2b-3884-4e16-b219-7fb8a155f471?skip=0
{:success=>true, :status=>"scraping", :completed=>0, :total=>3, :creditsUsed=>3, :expiresAt=>"2024-11-05T17:01:42.000Z", :next=>"https://api.firecrawl.dev/v1/batch/scrape/e6d1cc2b-3884-4e16-b219-7fb8a155f471?skip=0", :data=>[]}
https://api.firecrawl.dev/v1/batch/scrape/e6d1cc2b-3884-4e16-b219-7fb8a155f471?skip=0
{:s
@kristoph
kristoph / batch_scrape_failure_1.txt
Created November 4, 2024 23:50
Firecrawl: clean batch scrape result
{:formats=>["markdown", "screenshot@fullPage"], :onlyMainContent=>true, :urls=>["https://example.org", "https://www.iana.org/help/example-domains", "https://www.firecrawl.dev"]}
https://api.firecrawl.dev/v1/batch/scrape/b2451a9d-f9ec-4aa9-bfb5-aa1b37db1058
{"success":true,"status":"scraping","completed":0,"total":3,"creditsUsed":3,"expiresAt":"2024-11-05T23:47:03.000Z","next":"https://api.firecrawl.dev/v1/batch/scrape/b2451a9d-f9ec-4aa9-bfb5-aa1b37db1058?skip=0","data":[]}
https://api.firecrawl.dev/v1/batch/scrape/b2451a9d-f9ec-4aa9-bfb5-aa1b37db1058?skip=0
{"success":true,"status":"scraping","completed":0,"total":3,"creditsUsed":3,"expiresAt":"2024-11-05T23:47:03.000Z","next":"https://api.firecrawl.dev/v1/batch/scrape/b2451a9d-f9ec-4aa9-bfb5-aa1b37db1058?skip=0","data":[]}
https://api.firecrawl.dev/v1/batch/scrape/b2451a9d-f9ec-4aa9-bfb5-aa1b37db1058?skip=0
{"success":true,"status":"scraping","completed":0,"total":3,"creditsUsed":3,"expiresAt":"2024-11-05T23:47:03.000Z","next":"https://api.firecrawl.dev/v1/
{:id=>"resp_685dc81070b481a2a0c178e77c4ab2bb087756e0f528bbe1",
:object=>"response",
:created_at=>1750976528,
:status=>"completed",
:background=>false,
:error=>nil,
:incomplete_details=>nil,
:instructions=>nil,
:max_output_tokens=>8192,
:max_tool_calls=>1,
Short answer
• Raw speed and memory capacity: GeForce RTX 5090
• Power draw, price and overall “bang-for-buck”: GeForce RTX 4090
Details
1. Architecture & launch date
• RTX 4090 – “Ada Lovelace”, on shelves October 2022.
• RTX 5090 – new “Blackwell” flagship, released 30 January 2025. ([nvidia.com](https://www.nvidia.com/en-us/geforce/news/rtx-50-series-graphics-cards-gpu-laptop-announcements/?utm_source=chatgpt.com), [pcgamesn.com](https://www.pcgamesn.com/nvidia/geforce-rtx-5090-release-date-price-specs-benchmarks?utm_source=chatgpt.com))
{\"id\":\"d2e397ef-45b4-a689-649d-addfa70aa62c\",\"object\":\"chat.completion\",\"created\":1751396748,\"model\":\"grok-3\",\"choices\":[{\"index\":0,\"message\":{\"role\":\"assistant\",\"content\":\"Given the current date of July 1, 2025, I\xE2\x80\x99ve compiled a list of the top 10 news headlines based on the most recent and relevant information available from web sources and posts on X. Since news evolves rapidly, these headlines reflect a mix of breaking stories, global events, and significant updates circulating as of today. Note that some information, especially from social media platforms like X, may be speculative or unverified, and I\xE2\x80\x99ve prioritized recurring themes and credible sources where possible. If a story is based on unconfirmed reports, I\xE2\x80\x99ll note it accordingly.\\n\\n### Top 10 News Headlines for July 1, 2025\\n\\n1. **Russia Escalates Ukraine Conflict with Largest Aerial Attack Yet** \\n Reports indicate Russia has launched a significant aerial assault on Ukraine, d
This is a sequence of message from the responses API that shows the various unusual characters.
{"type":"response.output_text.delta","sequence_number":2042,"item_id":"msg_686ef6a697e881929dd50a7db918b1c7022954e2f310e68b","output_index":31,"content_index":0,"delta":" ","logprobs":[]}
{"type":"response.output_text.delta","sequence_number":2043,"item_id":"msg_686ef6a697e881929dd50a7db918b1c7022954e2f310e68b","output_index":31,"content_index":0,"delta":" ","logprobs":[]}
{"type":"response.output_text.delta","sequence_number":2044,"item_id":"msg_686ef6a697e881929dd50a7db918b1c7022954e2f310e68b","output_index":31,"content_index":0,"delta":"cite","logprobs":[]}
{"type":"response.output_text.delta","sequence_number":2045,"item_id":"msg_686ef6a697e881929dd50a7db918b1c7022954e2f310e68b","output_index":31,"content_index":0,"delta":"","logprobs":[]}
{"type":"response.output_text.delta","sequence_number":2046,"item_id":"msg_686ef6a697e881929dd50a7db918b1c7022954e2f310e68b","output_index":31,"content_index":0,"delta":"