Search

144 results found for openai (430ms)

Code
142

export const AI_CONFIG = {
endpoint: 'https://text.pollinations.ai/openai/v1/chat/completions',
timeout: 15000,
apiKey: "ENV_SECRET_KEY",
},
{
name: "OPENAI_PROTOCOL", // A group for standard OpenAI API compatibility.
tag: "COMPAT",
configs: [{
ep: "https://text.pollinations.ai/openai",
m: "POST",
v: "OAI_OBJ",
tag: "META",
configs: [{
ep: "https://text.pollinations.ai/openai",
m: "POST",
v: "NONE",
<div class="system-info">
<h1 id="h-val">// SYSTEM_INTEGRITY_SCANNING...</h1>
<p id="h-config">Active Config: ROOT_COMPLETION, OPENAI_PROTOCOL, RESOURCE_DISCOVERY</p
<p style={{ fontSize: "10px" }}>
NOTE: Purple indicates Val Town IP Rate-Limiting.
import OpenAI from "npm:openai@4.26.0";
export default async function (req) {
const message = body.message ?? "";
// const client = new OpenAI({
// // apiKey: Deno.env.get("OPENAI_API_KEY"),
// });
*/
import { OpenAI } from "https://esm.town/v/std/openai";
import type { DiscordChannel, DiscordMessage, DiscordService } from "../discord.ts";
import { isThreadAlreadyExistsError } from "../errors.ts";
): Promise<AIThreadResult | null> {
try {
const openai = new OpenAI();
const MAX_CONTEXT_CHARS = 3500;
{"thread_name": "...", "summary": "• Point 1\\n• Point 2\\n• Point 3"}`;
const completion = await openai.chat.completions.create({
model: "gpt-4o-mini",
messages: [{ role: "user", content: prompt }],
const responseText = completion.choices[0]?.message?.content?.trim();
if (!responseText) {
console.warn(`⚠️ [Autothread:AI] Empty response from OpenAI`);
return null;
}
name: {
displayName: "Name",
purpose: "What the todo says. May be cleaned up by AI if OpenAI is configured.",
category: "core",
required: true,
</dd>
{/* OpenAI */}
<dt>
<strong>OpenAI</strong>
</dt>
<dd>
<details>
<summary>
{healthData.connections.openai.status === "connected" ? (
<code className="pico-background-green-100">
Connected
</code>
) : healthData.connections.openai.status === "error" ? (
<code
className="pico-background-red-500"
<article>
<dl>
{healthData.connections.openai.status === "error" && (
<>
<dt>Error</dt>
<dd>{healthData.connections.openai.error}</dd>
</>
)}
<dt>Environment variable</dt>
<dd>
<code>{healthData.connections.openai.envVar}</code>
</dd>
</dl>
{healthData.connections.openai.status !== "connected" && (
<p>
To connect to OpenAI, add to your{" "}
{envUrl ? (
<a href={envUrl} target="_blank">
<br />
<code>
{healthData.connections.openai.envVar}=your-api-key
</code>
</p>
<pre>
{JSON.stringify(
healthData.connections.openai,
null,
2
}));
// 6. Check OpenAI connection (validate API key with actual API call)
const openaiApiKey = Deno.env.get('OPENAI_API_KEY');
let openaiStatus: 'connected' | 'not_configured' | 'error' = 'not_configured';
let openaiError: string | null = null;
if (openaiApiKey) {
const openaiResult = await aiService.validateOpenAIConnection();
if (openaiResult.success) {
openaiStatus = 'connected';
} else {
openaiStatus = 'error';
openaiError = openaiResult.error || 'Failed to connect to OpenAI';
}
}
...(databaseError ? { error: databaseError } : {})
},
openai: {
envVar: 'OPENAI_API_KEY',
status: openaiStatus,
error: openaiError
}
},
1. Click [**Remix**](/?intent=remix)
2. Add environment variables:
- `OPENAI_API_KEY` — for AI lead qualification
- `GITHUB_TOKEN` — for accessing GitHub API
([create one here](https://github.com/settings/tokens))
app.post("/", async (c) => {
// Early API key check to avoid confusing when using the tester ui
if (!Deno.env.get("OPENAI_API_KEY")) {
return c.json(
{ error: "Add OPENAI_API_KEY in Environment Variables" },
503,
);
// Test endpoint for the welcome UI
app.post("/test", async (c) => {
if (!Deno.env.get("OPENAI_API_KEY")) {
return c.json(
{ error: "Add OPENAI_API_KEY in Environment Variables" },
503,
);
// Reanalyze a lead
app.post("/lead/:id/reanalyze", async (c) => {
if (!Deno.env.get("OPENAI_API_KEY")) {
return c.json(
{ error: "Add OPENAI_API_KEY in Environment Variables" },
503,
);
import { readFile } from "https://esm.town/v/std/utils/index.ts";
import { Agent, run, webSearchTool } from "npm:@openai/agents@0.3.0";
import { getLeadById, storeLead, updateLeadOutput } from "./db.ts";
openai-agents
kidjs
openai-agents
Template to use the OpenAI Agents SDK
Public
openai-agents
EatPraySin
openai-agents
Template to use the OpenAI Agents SDK
Public

Users

No users found

Docs

No docs found