Search

4,282 results found for openai (1434ms)

Code
4,173

/**
* OpenAI connection status
*/
export interface OpenAIConnection {
envVar: string;
status: ConnectionStatus;
notion: NotionConnection;
database: DatabaseConnection;
openai: OpenAIConnection;
}
│ │ │ ├── blocks.ts # Block operations
│ │ │ └── search.ts # Search operations
│ │ ├── aiService.ts # OpenAI for fuzzy matching
│ │ └── blobService.ts # Val Town blob storage
│ └── utils/ # Utility functions
### Strategy 4: AI Fuzzy Matching with Date Disambiguation
If strategies 1-3 don't find a match, the system uses OpenAI (via Val Town's `@std/openai`) to m
**Initial AI Match**:
- Sends the todo text and list of projects (with client names) to OpenAI (`gpt-4o-mini`)
- AI returns one of:
- A specific project ID (if confident match to a project name)
4. The relation named in `TODOS_PROPERTIES.projects` also gets AI matching (Strategies 4-5)
**OpenAI Integration**:
- Uses Val Town's built-in OpenAI integration (`@std/openai`)
- Model: `gpt-4o-mini` (fast, cost-effective)
- AI calls per todo (when needed):
name: {
displayName: "Name",
purpose: "What the todo says. May be cleaned up by AI if OpenAI is configured.",
category: "core",
required: true,
}));
// 6. Check OpenAI connection (just check if env var is set)
const openaiApiKey = Deno.env.get('OPENAI_API_KEY');
const openaiStatus: 'connected' | 'not_configured' = openaiApiKey ? 'connected' : 'not_configu
return {
...(databaseError ? { error: databaseError } : {})
},
openai: {
envVar: 'OPENAI_API_KEY',
status: openaiStatus
}
},
</dd>
{/* OpenAI */}
<dt>OpenAI</dt>
<dd>
<details>
<summary>
{healthData.connections.openai.status === "connected"
? "OpenAI is connected"
: "OpenAI is not configured"}
</summary>
<article>
<dt>Environment variable</dt>
<dd>
<code>{healthData.connections.openai.envVar}</code>
</dd>
</dl>
{healthData.connections.openai.status !== "connected" && (
<p>
To enable AI summaries, add to your Val Town
<br />
<code>
{healthData.connections.openai.envVar}=your-api-key
</code>
</p>
for (const post of search.data.posts) {
const groqRes = await fetch("https://api.groq.com/openai/v1/chat/completions", {
method: "POST",
headers: { "Authorization": `Bearer ${Deno.env.get("GROQ_API_KEY")}`, "Content-Type": "app
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" },
# PineconeIndex
A simple interface for making and querying Pinecone vector databases. Use OpenAI
embeddings to vectorize and search
Create keys for
[Pinecone](https://docs.pinecone.io/guides/projects/manage-api-keys) and
[OpenAI](https://platform.openai.com/docs/api-reference/project-api-keys), and
store then in your environment variables. Then,
// set up your environment variables
const pineconeKey = Deno.env.get("PINECONE_KEY");
const modelToken = Deno.env.get("OPENAI_KEY");
const index = new PineconeIndex({
PineconeIndex also provides `handleRequest` as a convenience method to access
your indices via HTTP. This is useful when accessing the index from other vals,
especially without sharing Pinecone and OpenAI credentials.
### Server setup
import { Hono } from "npm:hono";
import { sqlite } from "https://esm.town/v/std/sqlite";
import { OpenAI } from "npm:openai";
const app = new Hono();
const TABLE_ID = "PATH_GEN_STABLE_V1";
const openai = new OpenAI();
// --- DATABASE LAYER ---
async function generatePage(path: string) {
const topic = path.replace(/[^a-zA-Z0-9]/g, " ");
const completion = await openai.chat.completions.create({
messages: [
{
import pg from "npm:pg@8.11.3";
import OpenAI from "npm:openai@4.20.1";
const { Client } = pg;
// Environment variables (set in Val.town secrets)
const OPENAI_API_KEY = Deno.env.get("OPENAI_API_KEY");
const RDS_HOST = Deno.env.get("RDS_HOST");
const RDS_USER = Deno.env.get("RDS_USER");
const EMBEDDING_MODEL = "text-embedding-ada-002";
const openai = new OpenAI({ apiKey: OPENAI_API_KEY });
async function generateQueryEmbedding(query: string): Promise<number[]> {
const response = await openai.embeddings.create({
model: EMBEDDING_MODEL,
input: query,

Vals

95
View more
peterqliu
PineconeIndex
Vector db's on Pinecone, with OpenAI embeddings
Public
openai-agents
stevekrouse
openai-agents
Template to use the OpenAI Agents SDK
Public
Ronsykes
hello-realtime
Sample app for the OpenAI Realtime API
Public
Ronsykes
hello-realtime-rs
Sample app for the OpenAI Realtime API
Public
dcm31
turso_events_estimator
Estimate OpenAI calls from Turso GitHub events
Public

Docs

11
View more
No docs found