Search

Results include substring matches and semantically similar vals. Learn more
pomdtr avatar
oauthConcept
@pomdtr
// oauth middleware protect the val behind github oauth
HTTP
// oauth middleware protect the val behind github oauth
export default oauth({
scopes: ["read:user"],
client_id: Deno.env.get("GITHUB_CLIENT_ID"),
client_secret: Deno.env.get("GITHUB_CLIENT_SECRET"),
auth_url: "https://github.com/login/oauth/authorize",
token_url: "https://github.com/login/oauth/access_token",
}, async (req: Request, accessToken: string) => {
const octokit = new Octokit({ auth: accessToken });
const { data: { login } } = await octokit.rest.users.getAuthenticated();
snm avatar
untitled4965473
@snm
An interactive, runnable TypeScript val by snm
Script
import { trackOpenAiFreeUsage } from "https://esm.town/v/snm/trackOpenAiFreeUsage";
import { openAiTextCompletion } from "https://esm.town/v/patrickjm/openAiTextCompletion?v=8";
import { openAiModeration } from "https://esm.town/v/snm/openAiModeration";
import { openAiFreeQuotaExceeded } from "https://esm.town/v/patrickjm/openAiFreeQuotaExceeded?v=2";
import { openAiFreeUsageConfig } from "https://esm.town/v/snm/openAiFreeUsageConfig";
* OpenAI text completion. https://platform.openai.com/docs/api-reference/completions
* To see if the quota has been met, you can run @patrickjm.openAiFreeQuotaExceeded()
* For full REST API access, see @patrickjm.openAiTextCompletion
openAiKey?: string,
const apiKey = params.openAiKey ?? openAiFreeUsageConfig.key;
jacoblee93 avatar
untitled_silverPinniped
@jacoblee93
An interactive, runnable TypeScript val by jacoblee93
Script
const { ChatPromptTemplate } = await import("npm:langchain/prompts");
const { ChatOpenAI } = await import("npm:langchain/chat_models/openai");
const { StringOutputParser } = await import(
["human", "{input}"],
const model = new ChatOpenAI({
modelName: "gpt-4",
temperature: 0.2,
openAIApiKey: process.env.OPENAI_API_KEY,
// Output parser converts the chat message into a raw string. Also works with streaming.
stevekrouse avatar
untitled_orangeImpala
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
export const untitled_orangeImpala = fetchJSON(
"https://api.openai.com/v1/usage?date=2023-11-01",
headers: {
authorization: "Bearer " + Deno.env.get("openai"),
cyrilis avatar
untitled2983099
@cyrilis
An interactive, runnable TypeScript val by cyrilis
Script
export let untitled2983099 = default (params) => {
return gpt3({
openAiKey: process.env.openai_key,
prompt: params.question,
.then((result) => result);
jacoblee93 avatar
untitled_chocolateSquid
@jacoblee93
An interactive, runnable TypeScript val by jacoblee93
Script
export const untitled_chocolateSquid = (async () => {
const { ChatOpenAI } = await import(
"https://esm.sh/langchain@0.0.146/chat_models/openai"
const { LLMChain } = await import("https://esm.sh/langchain@0.0.146/chains");
["human", humanTemplate],
const chat = new ChatOpenAI({
temperature: 0,
openAIApiKey: process.env.OPENAI_API_KEY,
const chain = new LLMChain({
cyrilis avatar
untitled8745444
@cyrilis
An interactive, runnable TypeScript val by cyrilis
Script
export let untitled8745444 = default (params) => {
return gpt3({
openAiKey: process.env.openai_key,
prompt: params.question,
.then((result) => result);
cyrilis avatar
untitled8294445
@cyrilis
An interactive, runnable TypeScript val by cyrilis
Script
export let untitled8294445 = default (params) => {
return gpt3({
openAiKey: process.env.openai_key,
prompt: params.question,
.then((result) => result);
40
Next