New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ai-sdk/anthropic

Package Overview
Dependencies
Maintainers
2
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ai-sdk/anthropic

**Note: The Anthropic API does not support streaming tool calls yet.**

  • 0.0.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
27K
decreased by-79.98%
Maintainers
2
Weekly downloads
 
Created
Source

Vercel AI SDK - Anthropic Provider

Note: The Anthropic API does not support streaming tool calls yet.

The Anthropic provider contains language model support for the Anthropic Messages API. It creates language model objects that can be used with the generateText and streamTextAI functions.

Setup

The Anthropic provider is available in the @ai-sdk/anthropic module. You can install it with

npm i @ai-sdk/anthropic

Provider Instance

You can import createAnthropic from @ai-sdk/anthropic and create a provider instance with various settings:

import { createAnthropic } from '@ai-sdk/anthropic';

const anthropic = createAnthropic({
  baseURL: '', // optional base URL for proxies etc.
  apiKey: '', // optional API key, default to env property ANTHROPIC_API_KEY
});

The AI SDK also provides a shorthand anthropic import with a Anthropic provider instance that uses defaults:

import { anthropic } from '@ai-sdk/anthropic';

Models

You can create models that call the Anthropic Messages API using the provider instance. The first argument is the model id, e.g. claude-3-haiku-20240307. Some models have multi-modal capabilities.

const model = anthropic('claude-3-haiku-20240307');

Anthropic Messages` models support also some model specific settings that are not part of the standard call settings. You can pass them as an options argument:

const model = anthropic('claude-3-haiku-20240307', {
  topK: 0.2,
});

Keywords

FAQs

Package last updated on 22 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc