This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const annotateLogProbs = (logprobs) => { | |
if (!logprobs?.length) { | |
// Fix people not deconstructing for us | |
if (logprobs?.content?.length) { | |
// eslint-disable-next-line no-param-reassign | |
logprobs = logprobs.content; | |
} else { | |
return {}; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable no-unused-vars */ | |
import Logger, { chalk } from 'shared/utils/Logger'; | |
import { jsonSafeParse } from 'shared/utils/jsonSafeParse'; | |
import { jsonSafeStringify } from 'shared/utils/jsonSafeStringify'; | |
import { normalizeDecimals } from 'shared/utils/normalizeDecimals'; | |
import { dedupBy } from 'shared/utils/dedupBy'; | |
import { setProperty } from 'dot-prop'; | |
import { annotateLogProbs } from './annotateLogProbs'; | |
const propPathArrayToString = (pathArray) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Coax an LLM into generated grounded JSON based on key/value-level perplexity checks with a custom | |
* `yup` validation test for perplexity, model fallbacks, and a customizable failure injection callback | |
* to inject grounding instructions on request for exact paths (e.g. for specific keys, if perplexity too high). | |
* | |
* Contributing to the community as an example of how to coax an LLM into generating JSON that conforms | |
* to a schema with key-level perplexity checks and fallback models for retries. | |
*/ | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This is a simple wrapper script that orchestrates the PlanetScale API | |
* so we can synchronize our schema changes via DDL to a dev branch and | |
* automatically release them.' | |
* | |
* This was created for my own project using my own ORM (https://github.com/josiahbryan/yass-orm) | |
* but the PlanetScale API operations below should be easily reusable | |
* for other scenarios. | |
* | |
* The main flow looks something like: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Simple controller for use with the Wangdd22 Ethernet Relay, available on Amazon for ~$35 | |
// | |
// See https://www.amazon.com/dp/B01MRQTFMJ?psc=1&ref=ppx_yo2ov_dt_b_product_details | |
// | |
// Special thanks to commentors on the product listing: | |
// Python Client: https://www.amazon.com/gp/customer-reviews/RAEHN60VSX3LV/ref=cm_cr_dp_d_rvw_ttl?ie=UTF8&ASIN=B01MRQTFMJ | |
// Config format: https://www.amazon.com/gp/customer-reviews/R19ZMADG7S2GX2/ref=cm_cr_dp_d_rvw_ttl?ie=UTF8&ASIN=B01MRQTFMJ | |
// | |
// This client just turns on/off the relays, doesn't handle config, but could easily be added thanks to the info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
# About BottomPanel | |
Renders a bottom panel which exposes a custom amount of content | |
at the bottom of the screen in a "closed" state, along with an animated | |
drag handle. The panel can then be "swiped" / "dragged" open by clicking | |
or touching anywhere in the panel. The drag handle will animate smoothly | |
between open/closed arrow states. The max open size of the panel can | |
also be customized, defaults to entire window height. The BottomPanel | |
wraps any children provided in a custom content area with overflow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Revised 2/26/20 with a video filter to try using setpts - didn't help... | |
// Ticket ongoing at https://github.com/Streampunk/beamcoder/issues/36 | |
const beamcoder = require('beamcoder'); | |
async function main() { | |
// Get this file from http://dl5.webmfiles.org/big-buck-bunny_trailer.webm | |
let demuxer = await beamcoder.demuxer('file:./big-buck-bunny_trailer.webm'); | |
let decoder = beamcoder.decoder({ demuxer, stream_index: 0 }); | |
const inVideoStream = demuxer.streams[0]; | |
// console.log(JSON.parse(JSON.stringify(inVideoStream))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// From: https://github.com/justadudewhohacks/face-api.js/issues/47 | |
// This is needed because face-api.js does not support working in a WebWorker natively | |
// Updated Dec 1 2020 to work on latest Chrome (tested in WebWorkers on Chrome Mobile on Android / Google Pixel 3 as well) | |
self.Canvas = self.HTMLCanvasElement = OffscreenCanvas; | |
// self.HTMLCanvasElement.name = 'HTMLCanvasElement'; | |
// self.Canvas.name = 'Canvas'; | |
self.CanvasRenderingContext2D = OffscreenCanvasRenderingContext2D; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Aerostat Beam Coder - Node.js native bindings for FFmpeg. | |
Copyright (C) 2019 Streampunk Media Ltd. | |
This program is free software: you can redistribute it and/or modify | |
it under the terms of the GNU General Public License as published by | |
the Free Software Foundation, either version 3 of the License, or | |
(at your option) any later version. | |
This program is distributed in the hope that it will be useful, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Aerostat Beam Coder - Node.js native bindings for FFmpeg. | |
Copyright (C) 2019 Streampunk Media Ltd. | |
This program is free software: you can redistribute it and/or modify | |
it under the terms of the GNU General Public License as published by | |
the Free Software Foundation, either version 3 of the License, or | |
(at your option) any later version. | |
This program is distributed in the hope that it will be useful, |
NewerOlder