Search

3,029 results found for anthropic (5026ms)

Code
3,018

} 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,
"ClickHouse/ClickHouse",
"databendlabs/databend",
"anthropics/claude-code",
];
- **Styling**: TailwindCSS (via Twind)
- **Weather API**: Open-Meteo (no API key required)
- **AI**: Claude 3.5 Sonnet (Anthropic)
- **Hosting**: Val Town
1. Create a new Val Town project
2. Copy all files from this repository into your Val Town project
3. Set the `ANTHROPIC_API_KEY` environment variable:
- Get your API key from https://console.anthropic.com/
- In Val Town, go to Settings → Environment Variables
- Add: `ANTHROPIC_API_KEY` = `your-api-key-here`
4. The main entry point is `backend/index.http.tsx`
5. Deploy and access your app!
## Environment Variables
- `ANTHROPIC_API_KEY` (required): Your Anthropic API key for Claude AI recommendations
## API Endpoints
const { weather } = body;
const apiKey = Deno.env.get('ANTHROPIC_API_KEY');
if (!apiKey) {
return c.json({ error: "ANTHROPIC_API_KEY not configured" }, 500);
}
try {
const response = await fetch('https://api.anthropic.com/v1/messages', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': apiKey,
'anthropic-version': '2023-06-01',
},
body: JSON.stringify({
## Environment Variables
- `ANTHROPIC_API_KEY`: API key for Claude AI recommendations
## Routes
Once you've piped input into a val, you could analyze or classify data with
[OpenAI](https://docs.val.town/std/openai/) or Anthropic, enrich it with browser
automation via [Browserbase](https://docs.val.town/integrations/browserbase/) or
[Kernel](https://docs.val.town/integrations/kernel/), verify phone numbers or
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

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