Search

3,362 results found for openai (1878ms)

Code
3,267

import { type OpenAI } from "npm:openai";
import { dedent } from "npm:ts-dedent";
`.trim();
const developerPrompt: OpenAI.ChatCompletionDeveloperMessageParam = {
"role": "developer",
"content": promptContent,
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" },
import { z } from "npm:zod@4.0.5";
import { generateText, tool } from "npm:ai@5.0.0-beta.16";
import { openai } from "npm:@ai-sdk/openai@2.0.0-beta.7";
const result = await generateText({
model: openai("gpt-4o"),
tools: {
weather: tool({
Note: When changing a SQLite table's schema, change the table's name (e.g., add \_2 or \_3) to c
### 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" }],
model: "gpt-4o-mini",
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" },
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" },
│ │ ├── files-tools.ts # Files store tool handlers
│ │ ├── code-tools.ts # Code execution tool handlers
│ │ └── openai-tools.ts # OpenAI API tool handlers
│ └── valtown/
│ └── client.ts # Val Town API client (for admin features)
- **admin-project-info**: Get project information and structure overview using Val Town API (adm
#### OpenAI API Tools
- **openai-chat-completion**: Create chat completions using OpenAI's API via Val Town's built-in
## OpenAI Integration
The server includes OpenAI chat completion functionality using Val Town's built-in OpenAI integr
### Example Usage
"method": "tools/call",
"params": {
"name": "openai-chat-completion",
"arguments": {
"messages": [
"method": "tools/call",
"params": {
"name": "openai-chat-completion",
"arguments": {
"messages": [
- `tools["files-exists"](args)` - Check if file exists in your personal file store
- `tools["files-metadata"](args)` - Get file metadata from your personal file store
- `tools["openai-chat-completion"](args)` - Create OpenAI chat completions
### Two Execution Modes
**Note**: `AWS_SECRET_ACCESS_KEY` is NOT set as an environment variable. Instead, it's passed vi
**OpenAI Integration**: OpenAI functionality uses Val Town's built-in OpenAI integration, which
### DynamoDB Table Schema
] as const;
// OpenAI Tools
export const OPENAI_TOOLS = [
{
name: "openai-chat-completion",
description: "Create a chat completion using OpenAI's API via Val Town's OpenAI integration"
inputSchema: {
type: "object",
model: {
type: "string",
description: "The OpenAI model to use",
default: "gpt-4o-mini",
enum: [
...FILES_TOOLS,
...CODE_TOOLS,
...OPENAI_TOOLS,
] as const;
...FILES_TOOLS,
...CODE_TOOLS,
...OPENAI_TOOLS,
...ADMIN_TOOLS,
] as const;
import { OpenAI } from "https://esm.town/v/std/openai";
import { zodResponseFormat } from "npm:openai/helpers/zod";
import { z } from "npm:zod";
const VERIFY_TOKEN = "butler";
const openai = new OpenAI();
const app = new Hono();
export async function parseReminder(text: string) {
const completion = await openai.chat.completions.create({
messages: [
{