npm init -y && npm install ai @ai-sdk/openai zod tsx
POE_API_KEY=your-key npx tsx poe-repro.ts/v1/responses returns invalid output_text for Google models when making tool calls:
| { | |
| "name": "investigation-scripts", | |
| "version": "1.0.0", | |
| "description": "", | |
| "main": "test_poe_opus46_anthropic.js", | |
| "scripts": { | |
| "test": "echo \"Error: no test specified\" && exit 1" | |
| }, | |
| "keywords": [], | |
| "author": "", |
| // Repro: AI SDK (OpenAI Responses) calling Poe API (google/nano-banana) | |
| // | |
| // Install (in an empty repo): | |
| // npm i ai @ai-sdk/openai | |
| // | |
| // Run: | |
| // node --env-file=.env tests/scripts/repro-responses-google-nano-banana.mjs | |
| // or: | |
| // POE_API_KEY=your_key node tests/scripts/repro-responses-google-nano-banana.mjs |
| // Test prompt caching with Anthropic SDK via Poe API | |
| // | |
| // Run: | |
| // node --env-file=.env tests/scripts/test-prompt-caching.mjs | |
| // or: | |
| // POE_API_KEY=your_key node tests/scripts/test-prompt-caching.mjs | |
| import Anthropic from "@anthropic-ai/sdk"; | |
| const client = new Anthropic({ |
| // *** Middleware - custom thunk implementation (slightly diffferent though) - maybe more scalable appraoch | |
| export default function createEventBusMiddleware(eventBus) { | |
| return ({ dispatch, getState }) => (next) => (action) => { | |
| // we could optimize further here and use rest operator to get all arguments and compose the middlewares | |
| if (typeof action === 'function') { | |
| return action({ dispatch, eventBus, getState }); | |
| } | |
| return next(action); | |
| }; |
| // *************************** | |
| // Programming with functions (Kamil Jopek) | |
| // Stuttgart JS Meetup Talk (13th April 2015) | |
| // *************************** | |
| // Basic functions | |
| var add = function(a, b) { | |
| return a + b; | |
| }; |
Are you writing a new gem and you are not sure how to let user configure it? Here is a short gist to show you how to do it. I like this style of configurations, inspired by many already existing gems such as Devise, Airbrake, PDFkit and many more.
# Configuration
MyShinyGem.configure do |config|
config.binary = '/bin/ls'
config.username = 'superuser'| RSpec::Core::RakeTask.module_eval do | |
| def pattern | |
| dir = EngineName.root # replace with you the name of your engine | |
| extras = [] | |
| if File.directory?( dir ) | |
| extras << File.join( dir, 'spec', '**', '*_spec.rb' ).to_s | |
| end | |
| [@pattern] | extras | |
| end | |
| end |