Search

3,029 results found for anthropic (3595ms)

Code
3,018

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,
so the whole thing is kind of recursive. I guess it should also let you put in (for completion
s that claude react artifacts can now make calls to the anthropic api, so you should be able to
it should by default find your influences' top 3-5 influences then stop, then have a button to p
// Anthropic API call to get influences
async function getInfluences(person: string): Promise<{ influences: string[], relationships: str
const apiKey = Deno.env.get('ANTHROPIC_API_KEY');
if (!apiKey) {
throw new Error('ANTHROPIC_API_KEY environment variable is required');
}
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({
if (!response.ok) {
const errorText = await response.text();
throw new Error(`Anthropic API error: ${response.status} - ${errorText}`);
}
return { influences, relationships };
} catch (error) {
console.error('Error calling Anthropic API:', error);
// Return error info for debugging
throw error;
## Environment Setup
Requires `ANTHROPIC_API_KEY` environment variable for Claude API access.
async function getInfluences(personName: string, context?: string): Promise<InfluenceResponse> {
const apiKey = Deno.env.get("ANTHROPIC_API_KEY");
if (!apiKey) {
throw new Error("ANTHROPIC_API_KEY not found in environment variables");
}
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({
if (!response.ok) {
throw new Error(`Anthropic API error: ${response.status} ${response.statusText}`);
}
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
We charge a 50% markup on top of raw LLM costs. If you use $10 in Townie
credits, Anthropic will get $6.66 and we'll get $3.33. We think this is fair,
sustainable, and transparent. We don't want to be in the business of having
murky limits, obfuscated credits, or unsustainable margins.

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