Search

3,155 results found for anthropic (3509ms)

Code
3,144

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,
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 { 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,
export function Login() {
const [bearerToken, setBearerToken] = useLocalStorage("bearer", "");
const [anthropicApiKey, setAnthropicApiKey] = useLocalStorage("anthropic_api_key", "");
return (
<label className="block text-sm font-medium text-gray-700">
<div className="flex items-center mb-1">
<span>Anthropic API Key</span>
<a
href="https://console.anthropic.com/settings/keys"
target="_blank"
className="ml-1 text-xs text-indigo-600 hover:text-indigo-800 transition-color
<input
type="password"
value={anthropicApiKey}
onChange={(e: any) => setAnthropicApiKey(e.target.value)}
placeholder="sk-ant-xxxxx"
autoComplete="off"
project,
bearerToken,
anthropicApiKey,
setProject,
}: {
project: any;
bearerToken: string;
anthropicApiKey: string;
setProject: (project: any) => void;
}) {
project,
branchId,
anthropicApiKey,
bearerToken,
selectedFiles,
<div className="p-6 flex flex-col h-full w-full">
<ApiKeyWarning show={!anthropicApiKey} />
<div className="flex flex-col lg:flex-row gap-4">
return (
<div className="bg-yellow-100 border-l-4 border-yellow-500 text-yellow-700 p-4 mb-4 rounded"
<p className="font-bold">Anthropic API Key Missing</p>
<p>Please log out and add your Anthropic API key to use this app.</p>
</div>
);
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,
You'll need to set up some environment variables to make it run.
- `ANTHROPIC_API_KEY` for LLM calls
- You'll need to follow [these instructions](https://docs.val.town/integrations/telegram/) to ma
- For the Google Calendar integration you'll need `GOOGLE_CALENDAR_ACCOUNT_ID` and `GOOGLE_CALEN
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

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