OpenTowniegenerateCode.ts3 matches
1import OpenAI from "https://esm.sh/openai";
23function parseValResponse(response: string) {
28const system = await (await fetch(`${import.meta.url.split("/").slice(0, -1).join("/")}/system_prompt.txt`)).text();
2930const openai = new OpenAI({
31baseURL: "https://openrouter.ai/api/v1",
32apiKey: Deno.env.get("OPEN_ROUTER_KEY"),
33});
34console.log(messages);
35const completion = await openai.chat.completions.create({
36model: "deepseek/deepseek-r1",
37messages: [
translateToEnglishWithOpenAImain.tsx4 matches
1import { OpenAI } from "https://esm.town/v/std/openai";
23export default async function translateToEnglishWithOpenAI(text: string) {
4const openai = new OpenAI();
5const completion = await openai.chat.completions.create({
6messages: [
7{
utmostBlackChickenmain.tsx3 matches
1import { OpenAI } from "https://esm.town/v/std/openai";
23const openai = new OpenAI();
45const completion = await openai.chat.completions.create({
6messages: [
7{ role: "user", content: "Say hello in a creative way" },
OpenTowniesystem_prompt.txt7 matches
8384<library>
85## OpenAI
8687Val Town includes a free, proxied OpenAI:
8889```ts
90import { OpenAI } from "https://esm.town/v/std/openai";
91const openai = new OpenAI();
92const completion = await openai.chat.completions.create({
93messages: [
94{ role: "user", content: "Say hello in a creative way" },
99```
100101OpenAI only works on the server. If the val includes client-side code, use dynamic imports to import this module in the server function, e.g.:
102`const { OpenAI } = await import "https://esm.town/v/std/openai");`
103</library>
104
constantGrayRavenmain.tsx3 matches
3import React, { useEffect, useState } from "https://esm.sh/react@18.2.0";
4import { blob } from "https://esm.town/v/std/blob";
5import { OpenAI } from "https://esm.town/v/std/openai";
67// Operational Data Science Tool Report Generator
8async function generateDataScienceToolReport() {
9const openai = new OpenAI();
1011// Comprehensive Data Science and Database Tool Categories
49// Advanced Operational Analysis
50async function generateOperationalInsights(category: string) {
51const operationalCompletion = await openai.chat.completions.create({
52model: "gpt-4o-mini",
53messages: [
RareVibesBoostmain.tsx3 matches
3import React, { useEffect, useState } from "https://esm.sh/react@18.2.0";
4import { blob } from "https://esm.town/v/std/blob";
5import { OpenAI } from "https://esm.town/v/std/openai";
67// Operational Data Science Tool Report Generator
8async function generateDataScienceToolReport() {
9const openai = new OpenAI();
1011// Comprehensive Data Science and Database Tool Categories
49// Advanced Operational Analysis
50async function generateOperationalInsights(category: string) {
51const operationalCompletion = await openai.chat.completions.create({
52model: "gpt-4o-mini",
53messages: [
2import { Hono } from "npm:hono@3";
3import { cors } from "npm:hono/cors";
4import { createOpenAI } from "npm:@ai-sdk/openai";
5import { createAnthropic } from "npm:@ai-sdk/anthropic@0.0.48";
6import { google, createGoogleGenerativeAI } from 'npm:@ai-sdk/google';
30});
3132const openai = createOpenAI({
33// apiKey = Deno.env.get("OPENAI_API_KEY");
34apiKey: Deno.env.get("OPENAI_API_KEY_COVERSHEET")
35});
363738const groq = createOpenAI({
39baseURL: 'https://api.groq.com/openai/v1',
40apiKey: Deno.env.get("GROQ_API_KEY"),
41});
4243const perplexity = createOpenAI({
44apiKey: Deno.env.get("PERPLEXITY_API_KEY") ?? '',
45baseURL: 'https://api.perplexity.ai/',
57this.memories = options.memories || [];
58this.messages = options.messages || [];
59this.defaultProvider = options.provider || 'openai';
60this.defaultModel = options.model;
61this.defaultMaxTokens = options.maxTokens;
122let result;
123switch (provider) {
124case 'openai':
125result = await this.generateOpenAIResponse({ model, prompt, maxTokens, temperature, streaming, schema, system, messages, tools, ...additionalSettings });
126break;
127case 'anthropic':
171}
172173async generateOpenAIResponse({ model, prompt, maxTokens, temperature, streaming, schema, system, messages, tools, embed, value, dimensions, user, ...additionalSettings }) {
174const modelId = model || 'gpt-3.5-turbo';
175176if (embed) {
177let result = await this.generateOpenAIEmbedding({ model, value, dimensions, user });
178// console.log('embed!', result)
179return result
181182const options = {
183model: openai(modelId),
184system,
185temperature,
235}
236237async generateOpenAIEmbedding({ model, value, dimensions, user }) {
238const modelId = model || 'text-embedding-3-large';
239const options = {
240model: openai.embedding(modelId, {
241dimensions,
242user,
491492app.get('/generate', async (c) => {
493const provider = c.req.query('provider') || 'openai';
494const model = c.req.query('model');
495const prompt = c.req.query('prompt');
523console.log("post/generate", { mode: 'post/generate', prompt, provider, model });
524const response = await modelProvider.gen({
525provider: provider || 'openai',
526model,
527prompt,
OpenTowniegenerateCode3 matches
1import OpenAI from "https://esm.sh/openai";
23function parseValResponse(response: string) {
28const system = await (await fetch(`${import.meta.url.split("/").slice(0, -1).join("/")}/system_prompt.txt`)).text();
2930const openai = new OpenAI({
31baseURL: "https://openrouter.ai/api/v1",
32apiKey: Deno.env.get("OPEN_ROUTER_KEY"),
33});
34console.log(messages);
35const completion = await openai.chat.completions.create({
36model: "deepseek/deepseek-r1",
37messages: [
OpenTowniesystem_prompt.txt7 matches
8384<library>
85## OpenAI
8687Val Town includes a free, proxied OpenAI:
8889```ts
90import { OpenAI } from "https://esm.town/v/std/openai";
91const openai = new OpenAI();
92const completion = await openai.chat.completions.create({
93messages: [
94{ role: "user", content: "Say hello in a creative way" },
99```
100101OpenAI only works on the server. If the val includes client-side code, use dynamic imports to import this module in the server function, e.g.:
102`const { OpenAI } = await import "https://esm.town/v/std/openai");`
103</library>
104
MrIdentifymain.tsx3 matches
106if (request.method === 'POST' && new URL(request.url).pathname === '/identify') {
107try {
108const { OpenAI } = await import("https://esm.town/v/std/openai");
109const openai = new OpenAI();
110
111const formData = await request.formData();
124);
125126const response = await openai.chat.completions.create({
127model: "gpt-4o",
128messages: [