jadpo

packages / @jadpo

@jadpo/anthropic

Anthropic: the app's models asked through Anthropic's Claude API, as the `ai` capability: typed answers and streamed answers. Anthropic has no embeddings endpoint, so it doesn't embed.

Install
jadpo package add @jadpo/anthropic

Adds the newest version, skipping any that were withdrawn (yanked) and pre-releases such as 2.0.0-beta.1. --to 2.0.0 picks a version. Your app then calls it as Anthropic.v2.

Use it in your app

@jadpo hasn't added a recipe to this package yet. A recipe is a working example of using the package in an app. After installing it, jadpo package show @jadpo/anthropic lists its operations (the calls it makes to an outside API), functions and types, and the guide on installing and using a package shows how to add one to your app.

What this package can do

  • Connects to one serviceIt sends requests to the address its connection gives, and nowhere else. Your app gives it a connection to that service, with your own credentials.
  • Works with Jadpo 0.6.0, Jadpo's newest releaseIt works with 0.4.0, 0.4.1 and 0.5.0 too. Each time a new Jadpo release comes out, jadpo.dev checks every package's newest version with it.0.4.0 · 0.4.1 · 0.5.0 · 0.6.0

jadpo.dev works out what this package can do from its code each time it checks a version, such as which services it calls and what personal data it sends, so the list doesn't depend on what its author says.

What it offersgenerated from the package's code

Operations

The calls this package makes to the outside API.

messages.create
request POST /v1/messages
input MessageRequest
output MessageResponse
confirmed recordings/messages.create.json

Documentation for the API call

messages.stream
request POST /v1/messages
input StreamedMessageRequest
output MessageStreamEvent
confirmed recordings/messages.stream.json

Documentation for the API call

Types

The shapes of the values it takes and gives back.

ContentBlock= Object

One block of a message's content: its type (`text`, `thinking` and others), and the text of a `text` block.

text: Text?
type: Text
MessageParam= Object

One turn of the conversation: `user` or `assistant`, and what it says.

content: Text
role: Text { max_length: 20 }
MessageRequest= Object

What asking a model for a message takes: the model, the most tokens it may answer with (its thinking included), the system prompt and the conversation.

max_tokens: Int { min: 1, max: 1000000 }
messages: List<MessageParam> { max_length: 100000 }
model: Text { max_length: 200 }
system: Text
MessageResponse= Object

A message the model answers with: its content blocks, why it stopped (`end_turn`, `max_tokens`, `stop_sequence`, `tool_use`, `pause_turn`, `refusal` or `model_context_window_exceeded`), and the tokens it took.

content: List<ContentBlock>
id: Text
model: Text
role: Text
stop_reason: Text?
type: Text
usage: MessageUsage
MessageStreamDelta= Object

What an event adds: a `text_delta`'s text, or, in `message_delta`, why the model stopped.

stop_reason: Text?
text: Text?
type: Text?
MessageStreamEvent= Object

One event of a streamed message, a server-sent event's data: its type (`message_start`, `content_block_start`, `content_block_delta`, `content_block_stop`, `message_delta`, `message_stop`, `ping`, `error`), the block it adds to, and what it adds.

delta: MessageStreamDelta?
index: Int { min: 0, max: 1000000 }?
type: Text
MessageUsage= Object

The tokens a message took: its input apart from the prompt cache's, its output, and the input read from and written to the cache.

cache_creation_input_tokens: TokenCount?
cache_read_input_tokens: TokenCount?
input_tokens: TokenCount
output_tokens: TokenCount
StreamedMessageRequest= Object

What asking a model for a streamed message takes: a message's request, with `stream` set so its answer comes as server-sent events.

max_tokens: Int { min: 1, max: 1000000 }
messages: List<MessageParam> { max_length: 100000 }
model: Text { max_length: 200 }
stream: Bool
system: Text