terminal:
npm i --save-dev rollup rollup-watch rollup-plugin-typescript typescript typings
npm i -S react react-dom
./node_modules/.bin/typings install react react-dom --save
mkdir src dist
touch src/index.tsx| /*! | |
| * Copyright 2015 Google Inc. All rights reserved. | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
terminal:
npm i --save-dev rollup rollup-watch rollup-plugin-typescript typescript typings
npm i -S react react-dom
./node_modules/.bin/typings install react react-dom --save
mkdir src dist
touch src/index.tsx| /** | |
| * This parses multipart/form-data when passed into a Lambda function through | |
| * API Gateway using the following Integration Request Mapping Template: | |
| #set($allParams = $input.params()) | |
| { | |
| "body" : $input.json('$'), | |
| "params" : { | |
| #foreach($type in $allParams.keySet()) | |
| #set($params = $allParams.get($type)) |
| export default (routes) => { | |
| return { | |
| fire (func,funcname, args){ | |
| funcname = (funcname === undefined) ? 'init' : funcname; | |
| if (func !== '' && routes[func] && typeof routes[func][funcname] == 'function'){ | |
| routes[func][funcname](args); | |
| } | |
| }, | |
| load() { | |
| var bodyId = document.body.id; |
I got to here after spending hours trying to deploy to an Elastic Beanstalk instance via CircleCi 2.0 so I thought I'd write up what worked for me to hopefully help others. Shout out to RobertoSchneiders who's steps for getting it to work with CircleCi 1.0 were my starting point.
For the record, I'm not the most server-savvy of developers so there may be a better way of doing this.
| #!/bin/bash | |
| # Launch inside a create-react-app project after building the production build. | |
| # Require `jq`. | |
| diff \ | |
| <(find src -type f \( -name '*.js' -o -name '*.jsx' -o -name '*.css' \) | sort) \ | |
| <(cat build/**/*.map | jq --raw-output '.sources | join("\n")' \ | |
| | grep -v '\.\./' | grep -E '\.(js|jsx|css)$' \ | |
| | sed "s#^#src/#" | sort | uniq) \ |
| # ZSH | |
| autoload -U add-zsh-hook | |
| # place default node version under $HOME/.node-version | |
| load-nvmrc() { | |
| DEFAULT_NODE_VERSION=`cat $HOME/.node-version` | |
| if [[ -f .nvmrc && -r .nvmrc ]]; then | |
| fnm use | |
| elif [[ `node -v` != $DEFAULT_NODE_VERSION ]]; then | |
| echo Reverting to node from "`node -v`" to "$DEFAULT_NODE_VERSION" |
This is an up-to-date guide on running Chromium in Vercel serverless functions in 2022. What you will read below is the result of two days of research, debugging, 100+ failed deployments, and a little bit of stress.
Use chrome-aws-lambda that comes with Chromium pre-configured to run in serverless, and puppeteer-core due to the smaller size of Chromium distributive.
| import { z } from "zod"; | |
| import { zodToTs, printNode } from "zod-to-ts"; | |
| // Replace with your `openai` thing | |
| import { openai } from "../openai.server"; | |
| import endent from "endent"; | |
| function createJSONCompletion<T extends z.ZodType>({ | |
| prompt, | |
| schema_name, |
Apologies for the snarky title, but there has been a huge amount of discussion around so called "Prompt Engineering" these past few months on all kinds of platforms. Much of it is coming from individuals who are peddling around an awful lot of "Prompting" and very little "Engineering".
Most of these discussions are little more than users finding that writing more creative and complicated prompts can help them solve a task that a more simple prompt was unable to help with. I claim this is not Prompt Engineering. This is not to say that crafting good prompts is not a difficult task, but it does not involve doing any kind of sophisticated modifications to general "template" of a prompt.
Others, who I think do deserve to call themselves "Prompt Engineers" (and an awful lot more than that), have been writing about and utilizing the rich new eco-system