Search

3,377 results found for openai (5293ms)

Code
3,282

c15r/MCP/README.md
1 matches
- **SQLite Database**: Execute queries and manage database operations
- **Email**: Send emails through Val Town's email service
- **OpenAI Integration**: Access OpenAI API through Val Town's service
- **File Operations**: Read and list project files
- **Environment Variables**: Access environment configuration
c15r/MCP/README.md
2 matches
- `email_send` - Send emails
4. **OpenAI**
- `openai_chat` - Generate text with OpenAI
5. **File Operations**
c15r/MCP/tools.ts
9 matches
import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
import { email } from "https://esm.town/v/std/email";
import { OpenAI } from "https://esm.town/v/std/openai";
import { readFile, listFiles } from "https://esm.town/v/std/utils@85-main/index.ts";
import { MCPTool, MCPToolResult } from "./types.ts";
},
{
name: "openai_chat",
description: "Generate text using OpenAI's chat completion API",
inputSchema: {
type: "object",
}
},
model: { type: "string", default: "gpt-4o-mini", description: "OpenAI model to use" },
max_tokens: { type: "number", description: "Maximum tokens to generate" },
temperature: { type: "number", description: "Sampling temperature" }
case "email_send":
return await handleEmailSend(args);
case "openai_chat":
return await handleOpenAIChat(args);
case "file_read":
return await handleFileRead(args);
}
async function handleOpenAIChat(args: any): Promise<MCPToolResult> {
validateRequired(args, ["messages"]);
const openai = new OpenAI();
const options: any = {
messages: args.messages,
if (args.temperature !== undefined) options.temperature = args.temperature;
const completion = await openai.chat.completions.create(options);
return {
## Technology Stack
- **Backend**: Hono + SQLite + OpenAI
- **Frontend**: React + TypeScript + TailwindCSS
- **Offline**: Service Workers + Cache API
1. When a new message is posted in a configured Slack channel (ie. #bugs, or #support), Slack se
2. The val makes an OpenAI call to determine if the message is a bug
tHub for semantically related open issues with a separate OpenAI call
4. It posts a comment in the Slack thread with links to related GitHub issues, with a "Relevance
*/
import { OpenAI } from "https://esm.town/v/std/openai";
import { Octokit } from "https://esm.sh/@octokit/rest@20.0.2";
import { WebClient } from "https://esm.sh/@slack/web-api@7.0.2";
async function isBugReportLLM(text: string): Promise<boolean> {
try {
// Check if OpenAI API key is available
if (!Deno.env.get("OPENAI_API_KEY")) {
console.warn("OpenAI API key not found - bug detection disabled");
return false;
}
const openai = new OpenAI();
const completion = await openai.chat.completions.create({
messages: [
{
async function findRelatedIssues(slackMessage: string, issues: any[]): Promise<any[]> {
try {
// Check if OpenAI API key is available
if (!Deno.env.get("OPENAI_API_KEY")) {
return [];
}
}).join("\n\n");
const openai = new OpenAI();
const completion = await openai.chat.completions.create({
messages: [
{
# OpenAI Proxy
This OpenAI API proxy injects Val Town's API keys. For usage documentation, check out https://ww
Migrated from folder: openai/openaiproxy
import { parseBearerString } from "https://esm.town/v/andreterron/parseBearerString";
import { API_URL } from "https://esm.town/v/std/API_URL?v=5";
import { OpenAIUsage } from "https://esm.town/v/std/OpenAIUsage";
import { RateLimit } from "npm:@rlimit/http";
const client = new OpenAIUsage();
const allowedPathnames = [
// Proxy the request
const url = new URL("." + pathname, "https://api.openai.com");
url.search = search;
const headers = new Headers(req.headers);
headers.set("Host", url.hostname);
headers.set("Authorization", `Bearer ${Deno.env.get("OPENAI_API_KEY")}`);
headers.set("OpenAI-Organization", Deno.env.get("OPENAI_API_ORG"));
const modifiedBody = await limitFreeModel(req, user);
});
const openAIRes = await fetch(url, {
method: req.method,
headers,
// Remove internal header
const res = new Response(openAIRes.body, openAIRes);
res.headers.delete("openai-organization");
return res;
}
Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to cre
### OpenAI
```ts
import { OpenAI } from "https://esm.town/v/std/openai";
const openai = new OpenAI();
const completion = await openai.chat.completions.create({
messages: [
{ role: "user", content: "Say hello in a creative way" },
Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to cre
### OpenAI
```ts
import { OpenAI } from "https://esm.town/v/std/openai";
const openai = new OpenAI();
const completion = await openai.chat.completions.create({
messages: [
{ role: "user", content: "Say hello in a creative way" },