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
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ai-sdk/anthropic - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

24

./dist/index.js

@@ -24,3 +24,4 @@ "use strict";

Anthropic: () => Anthropic,
anthropic: () => anthropic
anthropic: () => anthropic,
createAnthropic: () => createAnthropic
});

@@ -477,8 +478,25 @@ module.exports = __toCommonJS(src_exports);

};
var anthropic = new Anthropic();
// src/anthropic-provider.ts
function createAnthropic(options = {}) {
const anthropic2 = new Anthropic(options);
const provider = function(modelId, settings) {
if (new.target) {
throw new Error(
"The Anthropic model function cannot be called with the new keyword."
);
}
return anthropic2.chat(modelId, settings);
};
provider.chat = anthropic2.chat.bind(anthropic2);
provider.messages = anthropic2.messages.bind(anthropic2);
return provider;
}
var anthropic = createAnthropic();
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Anthropic,
anthropic
anthropic,
createAnthropic
});
//# sourceMappingURL=index.js.map

@@ -33,3 +33,3 @@ import { LanguageModelV1 } from '@ai-sdk/provider';

/**
* Anthropic provider.
* @deprecated Use `createAnthropic` instead.
*/

@@ -67,7 +67,34 @@ declare class Anthropic {

}
interface AnthropicProvider {
(modelId: AnthropicMessagesModelId, settings?: AnthropicMessagesSettings): AnthropicMessagesLanguageModel;
chat(modelId: AnthropicMessagesModelId, settings?: AnthropicMessagesSettings): AnthropicMessagesLanguageModel;
/**
* @deprecated Use `chat()` instead.
*/
messages(modelId: AnthropicMessagesModelId, settings?: AnthropicMessagesSettings): AnthropicMessagesLanguageModel;
}
/**
* Create an Anthropic provider.
*/
declare function createAnthropic(options?: {
/**
* Base URL for the Google API calls.
*/
baseURL?: string;
/**
* @deprecated Use `baseURL` instead.
*/
baseUrl?: string;
/**
* API key for authenticating requests.
*/
apiKey?: string;
generateId?: () => string;
}): AnthropicProvider;
/**
* Default Anthropic provider instance.
*/
declare const anthropic: Anthropic;
declare const anthropic: AnthropicProvider;
export { Anthropic, anthropic };
export { Anthropic, type AnthropicProvider, anthropic, createAnthropic };

@@ -24,3 +24,4 @@ "use strict";

Anthropic: () => Anthropic,
anthropic: () => anthropic
anthropic: () => anthropic,
createAnthropic: () => createAnthropic
});

@@ -477,8 +478,25 @@ module.exports = __toCommonJS(src_exports);

};
var anthropic = new Anthropic();
// src/anthropic-provider.ts
function createAnthropic(options = {}) {
const anthropic2 = new Anthropic(options);
const provider = function(modelId, settings) {
if (new.target) {
throw new Error(
"The Anthropic model function cannot be called with the new keyword."
);
}
return anthropic2.chat(modelId, settings);
};
provider.chat = anthropic2.chat.bind(anthropic2);
provider.messages = anthropic2.messages.bind(anthropic2);
return provider;
}
var anthropic = createAnthropic();
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Anthropic,
anthropic
anthropic,
createAnthropic
});
//# sourceMappingURL=index.js.map

2

package.json
{
"name": "@ai-sdk/anthropic",
"version": "0.0.3",
"version": "0.0.4",
"license": "Apache-2.0",

@@ -5,0 +5,0 @@ "sideEffects": false,

@@ -18,8 +18,8 @@ # Vercel AI SDK - Anthropic Provider

You can import `Anthropic` from `ai/anthropic` and initialize a provider instance with various settings:
You can import `createAnthropic` from `@ai-sdk/anthropic` and create a provider instance with various settings:
```ts
import { Anthropic } from '@ai-sdk/anthropic';
import { createAnthropic } from '@ai-sdk/anthropic';
const anthropic = new Anthropic({
const anthropic = createAnthropic({
baseURL: '', // optional base URL for proxies etc.

@@ -36,5 +36,5 @@ apiKey: '', // optional API key, default to env property ANTHROPIC_API_KEY

## Messages Models
## Models
You can create models that call the [Anthropic Messages API](https://docs.anthropic.com/claude/reference/messages_post) using the `.chat()` factory method.
You can create models that call the [Anthropic Messages API](https://docs.anthropic.com/claude/reference/messages_post) using the provider instance.
The first argument is the model id, e.g. `claude-3-haiku-20240307`.

@@ -44,3 +44,3 @@ Some models have multi-modal capabilities.

```ts
const model = anthropic.chat('claude-3-haiku-20240307');
const model = anthropic('claude-3-haiku-20240307');
```

@@ -52,5 +52,5 @@

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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