Search

3,155 results found for anthropic (5557ms)

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,
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://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
- [ ] Give it a replace_file command (instead of delete & create)?
- [ ] Add other LLMs ie Gemini, Deepseek, o3-mini, etc. Figure out how to get a text-editing 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