untitled-2604new-file-9513.tsx18 matches
3// Fecha: 05 de mayo de 2025
45// Este sistema permite probar distintas APIs de LLMs como ChatGPT (OpenAI) y Claude (Anthropic)
6// Puede implementarse en ValTown como un endpoint HTTP
742// Seleccionar el proveedor de LLM
43switch (provider.toLowerCase()) {
44case 'openai':
45result = await callOpenAI(apiKey, prompt, model || 'gpt-4o', temperature || 0.7, maxTokens || 1000);
46break;
47case 'anthropic':
51return new Response(
52JSON.stringify({
53error: 'Proveedor no soportado. Utilice "openai" o "anthropic"'
54}),
55{ status: 400, headers }
73}
7475// Función para llamar a la API de OpenAI
76async function callOpenAI(apiKey, prompt, model, temperature, maxTokens) {
77const url = 'https://api.openai.com/v1/chat/completions';
78
79const response = await fetch(url, {
95if (!response.ok) {
96const error = await response.json();
97throw new Error(`Error de OpenAI: ${error.error?.message || JSON.stringify(error)}`);
98}
99
101
102return {
103provider: 'openai',
104model: model,
105response: data.choices[0].message.content,
233<body>
234<h1>Probador de APIs de LLMs</h1>
235<p>Esta herramienta te permite probar diferentes APIs de modelos de lenguaje como OpenAI (ChatGPT) y Claude (Anthropic).</p>
236
237<div class="container">
239<label for="provider">Proveedor:</label>
240<select id="provider">
241<option value="openai">OpenAI (ChatGPT)</option>
242<option value="anthropic">Anthropic (Claude)</option>
243</select>
252<label for="model">Modelo:</label>
253<select id="model">
254<option value="gpt-4o">OpenAI: GPT-4o</option>
255<option value="gpt-4-0613">OpenAI: GPT-4</option>
256<option value="gpt-3.5-turbo">OpenAI: GPT-3.5 Turbo</option>
257<option value="claude-3-5-sonnet-20240521">Claude: Claude 3.5 Sonnet</option>
258<option value="claude-3-opus-20240229">Claude: Claude 3 Opus</option>
328
329// Agregar opciones según el proveedor
330if (provider === 'openai') {
331addOption(modelSelect, 'gpt-4o', 'OpenAI: GPT-4o');
332addOption(modelSelect, 'gpt-4-0613', 'OpenAI: GPT-4');
333addOption(modelSelect, 'gpt-3.5-turbo', 'OpenAI: GPT-3.5 Turbo');
334} else if (provider === 'anthropic') {
335addOption(modelSelect, 'claude-3-5-sonnet-20240521', 'Claude: Claude 3.5 Sonnet');
testOpenAInew-file-2085.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" },
Towniesystem_prompt.txt4 matches
88Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
8990### OpenAI
9192```ts
93import { OpenAI } from "https://esm.town/v/std/openai";
94const openai = new OpenAI();
95const completion = await openai.chat.completions.create({
96messages: [
97{ role: "user", content: "Say hello in a creative way" },
Towniesystem_prompt.txt4 matches
88Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
8990### OpenAI
9192```ts
93import { OpenAI } from "https://esm.town/v/std/openai";
94const openai = new OpenAI();
95const completion = await openai.chat.completions.create({
96messages: [
97{ role: "user", content: "Say hello in a creative way" },
image-inpaintingApp.tsx3 matches
142return (
143<div style={{ padding: 16 }}>
144<h1>OpenAI In-painting Mask Editor</h1>
145146<input type="file" accept="image/*" onChange={onFileChange} />
184correspond to your strokes – exactly what{" "}
185<a
186href="https://platform.openai.com/docs/guides/image-generation#mask-requirements"
187target="_blank"
188rel="noopener noreferrer"
189>
190OpenAI’s in-painting API
191</a>{" "}
192expects.
stevensDemo.cursorrules4 matches
100Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
101102### OpenAI
103```ts
104import { OpenAI } from "https://esm.town/v/std/openai";
105const openai = new OpenAI();
106const completion = await openai.chat.completions.create({
107messages: [
108{ role: "user", content: "Say hello in a creative way" },
18brian@airbnb.com,Brian Chesky
19drew@dropbox.com,Drew Houston
20sam@openai.com,Sam Altman
21tim@apple.com,Tim Cook
22jeff@amazon.com,Jeff Bezos
stevensDemo.cursorrules4 matches
100Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
101102### OpenAI
103```ts
104import { OpenAI } from "https://esm.town/v/std/openai";
105const openai = new OpenAI();
106const completion = await openai.chat.completions.create({
107messages: [
108{ role: "user", content: "Say hello in a creative way" },
a4595dc5b24_.cursorrules4 matches
100Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
101102### OpenAI
103```ts
104import { OpenAI } from "https://esm.town/v/std/openai";
105const openai = new OpenAI();
106const completion = await openai.chat.completions.create({
107messages: [
108{ role: "user", content: "Say hello in a creative way" },
a55fa86a2ad_.cursorrules4 matches
100Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
101102### OpenAI
103```ts
104import { OpenAI } from "https://esm.town/v/std/openai";
105const openai = new OpenAI();
106const completion = await openai.chat.completions.create({
107messages: [
108{ role: "user", content: "Say hello in a creative way" },