Search

3,155 results found for anthropic (6081ms)

Code
3,144

<h2>What is MCP?</h2>
<p>
MCP (Model Context Protocol) is an open protocol developed by Anthropic that lets LLMs
interact with external tools and data sources. It allows AI agents to access data and execut
functionality in a standardized way across different applications.
import { importDiscordDataExport } from "./importer.ts";
import { initDatabase } from "./database.ts";
// Using the official Anthropic JS SDK
import Anthropic from "https://esm.sh/@anthropic-ai/sdk@0.10.0";
// This is critical for Discord verification - DO NOT REMOVE
const DISCORD_TOKEN = Deno.env.get("DISCORD_TOKEN");
const DISCORD_APPLICATION_ID = Deno.env.get("DISCORD_APPLICATION_ID");
const ANTHROPIC_API_KEY = Deno.env.get("ANTHROPIC_API_KEY");
if (!DISCORD_TOKEN || !DISCORD_APPLICATION_ID) {
// Initialize Claude API client
const anthropic = ANTHROPIC_API_KEY ? new Anthropic({
apiKey: ANTHROPIC_API_KEY,
}) : null;
}
if (!anthropic) {
return respondToInteraction("Claude API is not configured");
}
// Ask Claude for analysis
const claudeResponse = await anthropic.messages.create({
model: "claude-3-opus-20240229",
max_tokens: 1000,
// Bot logic and message processing
import Anthropic from "https://esm.sh/@anthropic-ai/sdk@0.10.0";
import * as db from "./database.ts";
import * as discord from "./discord.ts";
// Initialize Claude API client
const ANTHROPIC_API_KEY = Deno.env.get("ANTHROPIC_API_KEY");
const anthropic = new Anthropic({
apiKey: ANTHROPIC_API_KEY || "",
});
// Use Claude to analyze the content and suggest categories
const response = await anthropic.messages.create({
model: "claude-3-haiku-20240307",
max_tokens: 100,
// Use Claude to classify the message
const response = await anthropic.messages.create({
model: "claude-3-haiku-20240307",
max_tokens: 200,
if (messages.length < 10) {
// Use Claude to extract key search terms
const response = await anthropic.messages.create({
model: "claude-3-haiku-20240307",
max_tokens: 100,
const formattedMessages = formatMessagesForClaudeAnalysis(messages, userMap);
const response = await anthropic.messages.create({
model: "claude-3-opus-20240229", // Using our most capable model for deep analysis
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,
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
} 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,
- Discord Bot Token
- Discord Application ID
- Anthropic API Key (for Claude)
- A private Discord server with just you and your partner
- Val Town account for hosting
- `DISCORD_TOKEN`: Your Discord bot token
- `DISCORD_APPLICATION_ID`: Your Discord application ID
- `ANTHROPIC_API_KEY`: Your Claude API key
- `VAL_TOWN_URL`: The URL of your Val Town deployment

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