Search

3,155 results found for anthropic (5950ms)

Code
3,144

import { Bot } from "https://deno.land/x/grammy@v1.35.0/mod.ts";
import { DateTime } from "https://esm.sh/luxon@3.4.4";
import Anthropic from "npm:@anthropic-ai/sdk@0.24.3";
import { backstory } from "../backstory.ts";
import {
} from "../memoryUtils.ts";
async function generateBriefingContent(anthropic, memories, today, isSunday) {
try {
const weekdaysHelp = generateWeekDays(today);
};
console.log("Sending prompt to Anthropic...", userMessage);
const response = await anthropic.messages.create({
model: "claude-3-7-sonnet-latest",
max_tokens: 30000,
export async function sendDailyBriefing(chatId?: string, today?: DateTime) {
// Get API keys from environment
const apiKey = Deno.env.get("ANTHROPIC_API_KEY");
const telegramToken = Deno.env.get("TELEGRAM_TOKEN");
if (!apiKey) {
console.error("Anthropic API key is not configured.");
return;
}
}
// Initialize Anthropic client
const anthropic = new Anthropic({ apiKey });
// Initialize Telegram bot
// Generate briefing content
const content = await generateBriefingContent(
anthropic,
memories,
today,
import { DateTime } from "https://esm.sh/luxon@3.4.4";
import Anthropic from "npm:@anthropic-ai/sdk@0.24.3";
const RECIPIENTS = ["Geoffrey", "Maggie"] as const;
async function analyzeHtmlContent(
anthropic: Anthropic,
htmlContent: string,
imageSummaries: ImageSummary[]
) {
try {
const response = await anthropic.messages.create({
model: "claude-3-5-sonnet-latest",
max_tokens: 4196,
console.log(e.text);
// Get Anthropic API key from environment
const apiKey = Deno.env.get("ANTHROPIC_API_KEY");
if (!apiKey) {
console.error("Anthropic API key is not configured for this val.");
return;
}
// Initialize Anthropic client
const anthropic = new Anthropic({ apiKey });
// Process each image attachment serially
);
const response = await anthropic.messages.create({
model: "claude-3-5-sonnet-latest",
max_tokens: 4196,
// Analyze HTML content
const htmlAnalysis = await analyzeHtmlContent(
anthropic,
e.html || "",
summaries
} from "https://deno.land/x/grammy@v1.35.0/mod.ts";
import { DateTime } from "https://esm.sh/luxon@3.4.4";
import Anthropic from "npm:@anthropic-ai/sdk@0.24.3";
import { backstory } from "../backstory.ts";
import {
/**
* Format chat history for Anthropic API
*/
function formatChatHistoryForAI(history) {
*/
async function analyzeMessageContent(
anthropic,
username,
messageText,
console.log({ systemPrompt, formattedHistory });
const response = await anthropic.messages.create({
model: "claude-3-5-sonnet-latest",
max_tokens: 4196,
bot.on("message", async (ctx) => {
try {
// Get Anthropic API key from environment
const apiKey = Deno.env.get("ANTHROPIC_API_KEY");
if (!apiKey) {
console.error("Anthropic API key is not configured.");
ctx.reply(
"I apologize, but I'm not properly configured at the moment. Please inform the household
}
// Initialize Anthropic client
const anthropic = new Anthropic({ apiKey });
// Get message text and user info
// Analyze message content with chat history context
const analysis = await analyzeMessageContent(
anthropic,
username,
messageText,
} from "https://esm.town/v/geoffreylitt/getWeather";
import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
import Anthropic from "npm:@anthropic-ai/sdk@0.24.3";
const TABLE_NAME = `memories`;
try {
// Get API key from environment
const apiKey = Deno.env.get("ANTHROPIC_API_KEY");
if (!apiKey) {
console.error("Anthropic API key is not configured.");
return null;
}
// Initialize Anthropic client
const anthropic = new Anthropic({ apiKey });
const response = await anthropic.messages.create({
model: "claude-3-5-sonnet-latest",
max_tokens: 150,
import { nanoid } from "https://esm.sh/nanoid@5.0.5";
import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
import Anthropic from "npm:@anthropic-ai/sdk@0.24.3";
const TABLE_NAME = `memories`;
try {
// Get API key from environment
const apiKey = Deno.env.get("ANTHROPIC_API_KEY");
if (!apiKey) {
console.error("Anthropic API key is not configured.");
return null;
}
// Initialize Anthropic client
const anthropic = new Anthropic({ apiKey });
// Format previous facts for the prompt
console.log({ message });
const response = await anthropic.messages.create({
model: "claude-3-5-sonnet-latest",
max_tokens: 1000,
project: any;
branchId: string | undefined;
anthropicApiKey: string;
bearerToken: string;
selectedFiles: string[];
project,
branchId,
anthropicApiKey,
bearerToken,
selectedFiles,
project,
branchId,
anthropicApiKey,
selectedFiles,
images: images
- [x] Add a "view source" / "send me a PR" link
- [x] Show the HTTP preview in second column if there is one (and let the user pick which one to
- [x] Figure out a convention to teach in the anthropic prompt mod where the LLM always checks t
- [x] Ability to create new projects from the interface
- [x] Figure out why OpenTownie can't create HTTP vals. Maybe give it a seperate tool for it?
- [x] Start a timer for messages
- [x] Add more indicators that it's "still working"
- [x] Require users supply their own Anthropic token?
- [x] Add cost indications on messages
- [x] Add a bell noise when the message is done to let us know
import { anthropic } from "npm:@ai-sdk/anthropic";
import { ValTown } from "npm:@valtown/sdk@0.37.0";
import fileWithLinesNumbers from "../utils/fileWithLinesNumbers.ts";
export function getTextEditorTool(bearerToken: string, project: any, branch_id: string | undefin
const vt = new ValTown({ bearerToken });
return anthropic.tools.textEditor_20250124({
execute: async ({
command,
import { readFile } from "https://esm.town/v/std/utils@71-main/index.ts";
import { createAnthropic } from "npm:@ai-sdk/anthropic";
import { ValTown } from "npm:@valtown/sdk@0.37.0";
import { convertToCoreMessages, type CoreUserMessage, streamText } from "npm:ai";
}
const { messages, project, branchId, anthropicApiKey, selectedFiles, images } = await c.req.js
console.log("Original messages:", JSON.stringify(messages, null, 2));
console.log("Images received:", JSON.stringify(images, null, 2));
// Check if API key is available
if (!anthropicApiKey) {
return Response.json({
error: "Anthropic API key is required. Please log out and add your Anthropic API key to us
}, { status: 400 });
}
let apiKey;
if (!anthropicApiKey) {
return Response.json({
error: "Anthropic API key is required. Please log out and add your Anthropic API key to us
}, { status: 400 });
} else if (anthropicApiKey === Deno.env.get("PASSWORD")) {
apiKey = Deno.env.get("PROVIDED_ANTHROPIC_API_KEY");
} else {
apiKey = anthropicApiKey;
}
const anthropic = createAnthropic({
apiKey,
});
// @ts-ignore
lastMessage.content.at(-1).providerOptions = {
anthropic: { cacheControl: { type: "ephemeral" } },
};
}
const result = await streamText({
model: anthropic("claude-3-7-sonnet-20250219"),
messages: coreMessages,
system: system + "\n\n" + open_townie_prompt_additions,
## How It Works
1. **Login**: Authenticate with your Val Town API token and Anthropic API key
2. **Select a Project**: Choose which Val Town project you want to work on
3. **Select Files**: Browse your project files and select which ones to include in the context w
- A Val Town account with API access
- An Anthropic API key (Claude 3.7 Sonnet)
### Setup
1. Visit the OpenTownie app
2. Enter your Val Town API token (with `projects:write` and `users:read` permissions)
3. Enter your Anthropic API key
4. Click "Login" to access your projects
- AI SDK for Claude integration
The application proxies requests to the Anthropic API and Val Town API, allowing Claude to view
## Privacy & Security
- Your Val Town API token and Anthropic API key are stored locally in your browser
- No data is stored on our servers
- All communication with the APIs is done directly from your browser

Vals

10
View more
diegoivo
anthropicWorkflow
 
Public
diegoivo
sdkAnthropic
 
Public
maddy
anthropicProxy
 
Public
stevekrouse
anthropicStreamDemo
 
Public
toowired
anthropicCaching
 
Public

Users

No users found
No docs found